diff options
| author | Adib Taraben <theadib@gmail.com> | 2014-06-22 22:34:55 +0000 |
|---|---|---|
| committer | theadib <theadib@gmail.com> | 2014-06-22 22:34:55 +0000 |
| commit | a97ba835bc5800cbd361014c446400d86b9a3f36 (patch) | |
| tree | 7f61ac1591a87d0c0b227b3bb55026e6f9b0c67b /packaging/wix | |
| parent | Fix for ungrouping/non-LPEItem masks (diff) | |
| download | inkscape-a97ba835bc5800cbd361014c446400d86b9a3f36.tar.gz inkscape-a97ba835bc5800cbd361014c446400d86b9a3f36.zip | |
win32 wix install creator: use version and architecture info from src/inkscape.rc and inkscape/inkscape.exe, create inkscape-#version#-x64.msi on 64bit target
(bzr r13437)
Diffstat (limited to 'packaging/wix')
| -rw-r--r-- | packaging/wix/files.py | 7 | ||||
| -rw-r--r-- | packaging/wix/inkscape.wxs | 32 | ||||
| -rw-r--r-- | packaging/wix/version.py | 61 | ||||
| -rw-r--r-- | packaging/wix/wixenv.bat | 4 |
4 files changed, 76 insertions, 28 deletions
diff --git a/packaging/wix/files.py b/packaging/wix/files.py index 93a7c8dd1..ada4d62f2 100644 --- a/packaging/wix/files.py +++ b/packaging/wix/files.py @@ -27,7 +27,7 @@ def directory(root, breadcrumb, level, exclude=[]): file_key = os.path.join(root, file) _id = '_%06d' % (len(file_ids.keys()) + 1) file_ids[file_key] = 'component' + _id - wxs.write(indent(level)+ "<Component Id='component" + _id + "' Guid='" + str(uuid.uuid4()) + "' DiskId='1'>\n") + wxs.write(indent(level)+ "<Component Id='component" + _id + "' Guid='" + str(uuid.uuid4()) + "' DiskId='1' Win64='$(var.Win64)'>\n") if file == 'inkscape.exe': # we refenrence inkscape.exe in inkscape.wxs _id = '_inkscape_exe' @@ -62,10 +62,11 @@ def ComponentGroup(name, condition, level): with open('files.wxs', 'w') as wxs: wxs.write("<!-- do not edit, this file is created by files.py tool any changes will be lost -->\n") wxs.write("<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\n") + wxs.write(indent(1) + "<?include version.wxi?>\n") wxs.write(indent(1) + "<Fragment>\n") wxs.write(indent(2) + "<!-- Step 1: Define the directory structure -->\n") wxs.write(indent(2) + "<Directory Id='TARGETDIR' Name='SourceDir'>\n") - wxs.write(indent(3) + "<Directory Id='ProgramFilesFolder' Name='PFiles'>\n") + wxs.write(indent(3) + "<Directory Id='$(var.ProgramFilesFolder)' Name='PFiles'>\n") wxs.write(indent(4) + "<Directory Id='INSTALLDIR' Name='Inkscape'>\n") print "start parsing ..\..\inkscape" directory('..\..\inkscape', 'inkscape', 5, ['inkscape.dbg', 'inkview.dbg', 'gdb.exe']) @@ -74,7 +75,7 @@ with open('files.wxs', 'w') as wxs: wxs.write(indent(3) + "</Directory>\n") # link to ProgrmMenu wxs.write(indent(3) + "<Directory Id='ProgramMenuFolder'>\n") - wxs.write(indent(4) + "<Directory Id='ApplicationProgramsFolder' Name='Inkscape 0.48'/>\n") + wxs.write(indent(4) + "<Directory Id='ApplicationProgramsFolder' Name='$(var.FullProductName)'/>\n") wxs.write(indent(3) + "</Directory>\n") wxs.write(indent(3) + "<Directory Id='DesktopFolder' Name='Desktop' />\n") wxs.write(indent(2) + "</Directory>\n") diff --git a/packaging/wix/inkscape.wxs b/packaging/wix/inkscape.wxs index dfe61defd..3b4152a5f 100644 --- a/packaging/wix/inkscape.wxs +++ b/packaging/wix/inkscape.wxs @@ -1,10 +1,10 @@ <?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?include version.wxi?>
-
- <Product Name="$(var.FullProductName)" Id='81922150-317e-4bb0-a31d-ff1c14f707c5' UpgradeCode='4d5fedaa-84a0-48be-bd2a-08246398361a' Language='1033' Codepage='1252' Version='0.48' Manufacturer='inkscape.org'>
- <Package Id='*' Keywords='Installer' Description="Inkscape Installer" Comments='inkscape is registered trademark of inkscape.org' Manufacturer='inkscape.org' InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+ <Product Name="$(var.FullProductName)" Id='81922150-317e-4bb0-a31d-ff1c14f707c5' UpgradeCode='4d5fedaa-84a0-48be-bd2a-08246398361a' Language='1033' Codepage='1252' Version='$(var.ProductVersion)' Manufacturer='inkscape.org'>
+
+ <Package Id='*' Keywords='Installer' Description="Inkscape Installer" Comments='inkscape is registered trademark of inkscape.org' Manufacturer='inkscape.org' InstallerVersion='$(var.InstallerVersion)' Platform='$(var.Platform)' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="inkscape Installation [1]" />
@@ -12,7 +12,7 @@ <Property Id='ALLUSERS' Value="2" />
<DirectoryRef Id="ApplicationProgramsFolder">
- <Component Id="ApplicationShortcut" Guid="37de8ea4-e83a-4e40-8f9c-c6066b78d935">
+ <Component Id="ApplicationShortcut" Guid="37de8ea4-e83a-4e40-8f9c-c6066b78d935" Win64='$(var.Win64)' >
<Shortcut Id="ApplicationStartMenuShortcut"
Name="$(var.FullProductName)"
Description="Inkscape Vector Graphics Application"
@@ -27,16 +27,16 @@ </DirectoryRef>
<DirectoryRef Id="DesktopFolder">
- <Component Id="DesktopShortcut" Guid="3afc08a7-05a1-40cf-90c2-0d6c042bfc41">
- <!-- Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Target="[INSTALLDIR]inkscape.exe" Name="Inkscape 0.48" WorkingDirectory='INSTALLDIR' Icon="file_inkscape_exe" IconIndex="0" / -->
+ <Component Id="DesktopShortcut" Guid="3afc08a7-05a1-40cf-90c2-0d6c042bfc41" Win64='$(var.Win64)'>
+ <!-- Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Target="[INSTALLDIR]inkscape.exe" Name="$(var.FullProductName)" WorkingDirectory='INSTALLDIR' Icon="file_inkscape_exe" IconIndex="0" / -->
<Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Target="[INSTALLDIR]inkscape.exe" Name="$(var.FullProductName)" WorkingDirectory='INSTALLDIR' />
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
-
+
<DirectoryRef Id="INSTALLDIR">
- <Component Id="RegisterExtension" Guid="d544e040-573e-4ea8-983e-4bcae6b87f3d">
+ <Component Id="RegisterExtension" Guid="d544e040-573e-4ea8-983e-4bcae6b87f3d" Win64='$(var.Win64)'>
<ProgId Id="inkscape.svg" Description='scalable vector graphics file' Icon='file_inkscape_exe'>
<Extension Id='svg' ContentType='application/svg'>
<Verb Id='edit' Command='Edit with Inkscape' TargetFile='file_inkscape_exe' Argument='"%1"' />
@@ -44,15 +44,15 @@ <Extension Id='svgz' ContentType='application/svgz'>
<Verb Id='open' Command='Open with Inkscape' TargetFile='file_inkscape_exe' Argument='"%1"' />
</Extension>
-
+
</ProgId>
</Component>
</DirectoryRef>
-
+
<Feature Id='Complete' Title="$(var.FullProductName)" Description='The complete Package' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR' Absent="disallow" AllowAdvertise='no'>
-<!--
+ <!--
<Feature Id='MainProgram' Level='1' Title='inkscape Application' Description='the inkscape Application' Absent="disallow" AllowAdvertise='no'>
<ComponentRef Id='MainExecutable' />
</Feature>
@@ -60,20 +60,20 @@ <!--
<Feature Id='MainProgram' Level='1' Title='inkscape Application' Description='the inkscape Application' Absent="disallow" AllowAdvertise='no'>
-->
- <ComponentGroupRef Id='AllOther' />
+ <ComponentGroupRef Id='AllOther' />
<!--
</Feature>
-->
-
+
<!-- shortcuts -->
<Feature Id='ApplicationShortcut' Level='1' Title='Start Menu entry' Description='an entry in the start Menu' AllowAdvertise='no'>
<ComponentRef Id='ApplicationShortcut' />
</Feature>
-
+
<Feature Id='DesktopShortcut' Level='1' Title='Desktop link' Description='an link on the desktop' AllowAdvertise='no'>
<ComponentRef Id='DesktopShortcut' />
</Feature>
-
+
<Feature Id='RegisterExtension' Level='1' Title='register file extension' Description='register .svg and .svgz file extension to explorer context menu' AllowAdvertise='no'>
<ComponentRef Id='RegisterExtension' />
</Feature>
@@ -89,7 +89,7 @@ <Feature Id='Tutorials' Level='1' Title='Tutorials' Description='tutorials as svg' AllowAdvertise='no'>
<ComponentGroupRef Id='Tutorials' />
</Feature>
-<!--
+ <!--
<ComponentRef Id='ProgramMenuDir' />
-->
</Feature>
diff --git a/packaging/wix/version.py b/packaging/wix/version.py index 46968c90c..dc5e06de9 100644 --- a/packaging/wix/version.py +++ b/packaging/wix/version.py @@ -1,20 +1,59 @@ #!/usr/bin/python
import os
+import struct
version = ''
+versionstr = ''
+architecture = ''
+
+def is64bitArchitecture(filename):
+ ''' test if a executable is of x64 format @see http://stackoverflow.com/questions/1001404/check-if-unmanaged-dll-is-32-bit-or-64-bit/1002672#1002672
+ @see http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx
+ //offset to PE header is always at 0x3C
+ //PE header starts with "PE\0\0" = 0x50 0x45 0x00 0x00
+ //followed by 2-byte machine type field (see document above for enum)
+ '''
+ with open(filename, 'rb') as cofffile:
+ cofffile.seek(0x3c)
+ peOffset = struct.unpack('H', cofffile.read(2))[0]
+ cofffile.seek(peOffset)
+ peHead = struct.unpack('I', cofffile.read(4))[0]
+ if peHead != 0x00004550: # "PE\0\0", little-endian
+ # throw new Exception("Can't find PE header")
+ pass
+ machineType = struct.unpack('H', cofffile.read(2))[0]
+ if machineType in (0x8664, 0x200):
+ return True
+ return False
+
+if is64bitArchitecture('..\..\inkscape\inkscape.exe'):
+ architecture = '-x64'
+else:
+ architecture = ''
# retrieve the version information from the inkscape.rc file
# VALUE "ProductVersion", "0.48+devel"
with open('..\..\src\inkscape.rc', 'r') as rc:
+ isversioninfo = False
+
for line in rc.readlines():
if 'productversion' in line.lower() and 'value' in line.lower():
items = line.split()
- version = items[2]
- version = version.replace('"', '')
- version = version.replace("'", "")
+ versionstr = items[2]
+ versionstr = versionstr.replace('"', '')
+ versionstr = versionstr.replace("'", "")
# version = version.replace("+", "_")
- print version
+ print versionstr + architecture
+ if 'versioninfo' in line.lower():
+ isversioninfo = True
+ if 'begin' in line.lower():
+ isversioninfo = False
+ if isversioninfo and 'productversion' in line.lower():
+ items = line.split()
+ ''' the second element contains now version info in the form major,minor,fix,build'''
+ veritems = items[1].split(',')
+ version = veritems[0] + '.' + veritems[1]
with open('version.wxi', 'w') as wxi:
@@ -22,8 +61,16 @@ with open('version.wxi', 'w') as wxi: wxi.write("<!-- do not edit, this file is created by version.py tool any changes will be lost -->\n")
wxi.write("<Include>\n")
wxi.write("<?define ProductVersion='" + version + "' ?>\n")
- wxi.write("<?define FullProductName='Inkscape " + version + "' ?>\n")
+ wxi.write("<?define FullProductName='Inkscape " + versionstr + "' ?>\n")
+ if 'x64' in architecture:
+ wxi.write("<?define ProgramFilesFolder='ProgramFiles64Folder' ?>\n")
+ wxi.write("<?define Win64='yes' ?>\n")
+ wxi.write("<?define InstallerVersion='200' ?>\n")
+ wxi.write("<?define Platform='x64' ?>\n")
+ else:
+ wxi.write("<?define ProgramFilesFolder='ProgramFilesFolder' ?>\n")
+ wxi.write("<?define Win64='no' ?>\n")
+ wxi.write("<?define InstallerVersion='100' ?>\n")
+ wxi.write("<?define Platform='x86' ?>\n")
wxi.write("</Include>\n")
-
-
diff --git a/packaging/wix/wixenv.bat b/packaging/wix/wixenv.bat index 5f1f7e90c..c798a9ce1 100644 --- a/packaging/wix/wixenv.bat +++ b/packaging/wix/wixenv.bat @@ -5,12 +5,12 @@ ver | findstr /i "6\.1\." > nul IF %ERRORLEVEL% EQU 0 goto win7
@rem all other cases
-IF "%WIX_PATH%"=="" set WIX_PATH=C:\Programme\WiX Toolset v3.7\bin
+IF "%WIX_PATH%"=="" set WIX_PATH=C:\Programme\WiX Toolset v3.8\bin
IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs
goto setpath
:win7
-IF "%WIX_PATH%"=="" set WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.7\bin
+IF "%WIX_PATH%"=="" set WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.8\bin
IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs
:setpath
|
