diff options
| author | Adib Taraben <theadib@gmail.com> | 2012-11-15 22:12:16 +0000 |
|---|---|---|
| committer | theAdib <theadib@gmail.com> | 2012-11-15 22:12:16 +0000 |
| commit | 3c5295dca37c5355b7a4a448f711c9ab14185252 (patch) | |
| tree | b9cbdca73aa8f3485cdafc8aba6929e6b81a10d4 /packaging | |
| parent | cppcheck: Simple fixes for src/ui/dialog (diff) | |
| download | inkscape-3c5295dca37c5355b7a4a448f711c9ab14185252.tar.gz inkscape-3c5295dca37c5355b7a4a448f711c9ab14185252.zip | |
add wix scripts to nuild win32 .msi package
(bzr r11875)
Diffstat (limited to 'packaging')
| -rw-r--r-- | packaging/wix/README | 19 | ||||
| -rw-r--r-- | packaging/wix/files.py | 86 | ||||
| -rw-r--r-- | packaging/wix/inkscape.wxs | 77 | ||||
| -rw-r--r-- | packaging/wix/install.bat | 30 | ||||
| -rw-r--r-- | packaging/wix/next_uuid.py | 10 | ||||
| -rw-r--r-- | packaging/wix/wixenv.bat | 4 |
6 files changed, 226 insertions, 0 deletions
diff --git a/packaging/wix/README b/packaging/wix/README new file mode 100644 index 000000000..5f1118d7e --- /dev/null +++ b/packaging/wix/README @@ -0,0 +1,19 @@ +howto create windows msi installer + +you need: +1. windows installer XML installed and callable from your path + get it from http://wixtoolset.org/ + the installer is tested using version 3.6 +2. python installed and callable from your path + the installer is tested using version 2.7 + +build the installer +1. build inkscape +2. set environment variables + wixenv.bat +2. create installer using batch + install.bat + +when completed there should be inkscape.msi in your path + + diff --git a/packaging/wix/files.py b/packaging/wix/files.py new file mode 100644 index 000000000..7cddcc6a9 --- /dev/null +++ b/packaging/wix/files.py @@ -0,0 +1,86 @@ +#!/usr/bin/python + + +# list files in directory +import os +import uuid + +directory_ids = {} +file_ids = {} + +def indent(level): + indentstring = '' + for i in range(level): + indentstring += ' ' + return indentstring + +def directory(root, breadcrumb, level): + """ + list all files and directory recursivly + create the file_ids dictionary to be used in ComponentGroup references + """ + global file_ids + global directory_ids + # first list files within directory + files = [ f for f in os.listdir(root) if os.path.isfile(os.path.join(root,f)) ] + for file in files: + 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 + 1)+ "<File Id='file" + _id + "' Name='" + file + "' DiskId='1' Source='" + file_key + "' KeyPath='yes' />\n") + wxs.write(indent(level)+ "</Component>\n") + # then all directories + + dirs = [ f for f in os.listdir(root) if os.path.isdir(os.path.join(root,f)) ] + for dir in dirs: + directory_key = breadcrumb + '__' + dir + if not directory_key in directory_ids.keys(): + directory_ids[directory_key] = 'dir_%06d' % (len(directory_ids.keys()) + 1) + wxs.write(indent(level) + "<Directory Id='" + directory_ids[directory_key] + "' Name='" + dir + "'>\n") + directory(os.path.join(root, dir), directory_key, level + 1) + wxs.write(indent(level) + "</Directory>\n") + + +def ComponentGroup(name, condition, level): + """ + add componentgroup that contain all items from file_ids that match condition + remove the matched elements from file_ids + """ + global file_ids + keys = [k for k in file_ids.keys() if condition in k] + wxs.write(indent(level) + "<ComponentGroup Id='" + name + "'>\n") + for component in keys: + wxs.write(indent(level + 1) + "<ComponentRef Id='" + file_ids[component] + "' />\n") + wxs.write(indent(level) + "</ComponentGroup>\n") + for key in keys: + del file_ids[key] + +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) + "<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(4) + "<Directory Id='INSTALLDIR' Name='Inkscape'>\n") + print "start parsing ..\..\inkscape" + directory('..\..\inkscape', 'inkscape', 5) + print "found %d files" % len(file_ids.keys()) + wxs.write(indent(4) + "</Directory>\n") + 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(3) + "</Directory>\n") + wxs.write(indent(3) + "<Directory Id='DesktopFolder' Name='Desktop' />\n") + wxs.write(indent(2) + "</Directory>\n") + ComponentGroup("Examples", 'inkscape\\share\\examples', 2) + ComponentGroup("Tutorials", 'inkscape\\share\\tutorials\\', 2) + ComponentGroup("Translations", '\\locale\\', 2) + ComponentGroup("AllOther", '', 2) + wxs.write(indent(1) + "</Fragment>\n") + wxs.write("</Wix>\n") + + + diff --git a/packaging/wix/inkscape.wxs b/packaging/wix/inkscape.wxs new file mode 100644 index 000000000..823c54d99 --- /dev/null +++ b/packaging/wix/inkscape.wxs @@ -0,0 +1,77 @@ +<?xml version='1.0' encoding='windows-1252'?>
+<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Product Name='Inkscape 0.48' Id='81922150-317e-4bb0-a31d-ff1c14f707c5' UpgradeCode='4d5fedaa-84a0-48be-bd2a-08246398361a' Language='1033' Codepage='1252' Version='1.7.0' 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' />
+
+ <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
+ <Property Id='DiskPrompt' Value="inkscape 0.48 Installation [1]" />
+
+ <Property Id='ALLUSERS' Value="2" />
+
+ <DirectoryRef Id="ApplicationProgramsFolder">
+ <Component Id="ApplicationShortcut" Guid="37de8ea4-e83a-4e40-8f9c-c6066b78d935">
+ <Shortcut Id="ApplicationStartMenuShortcut"
+ Name="Inkscape 0.48.3"
+ Description="Inkscape Vector Graphics Application"
+ Target="[INSTALLDIR]inkscape.exe"
+ WorkingDirectory="INSTALLDIR"/>
+ <util:InternetShortcut Id="OnlineDocumentationShortcut"
+ Name="Inkscape Homepage"
+ Target="http://www.inkscape.org/"/>
+ <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
+ <RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
+ </Component>
+ </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="inkscape.exe" IconIndex="0" />
+ <RemoveFolder Id="DesktopFolder" On="uninstall"/>
+ <RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplicationName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
+ </Component>
+ </DirectoryRef>
+
+
+
+ <Feature Id='Complete' Title='inkscape 0.48' 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>
+-->
+ <Feature Id='MainProgram' Level='1' Title='inkscape Application' Description='the inkscape Application' Absent="disallow" AllowAdvertise='no'>
+ <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='Examples' Level='1' Title='Examples' Description='examples as svg' AllowAdvertise='no'>
+ <ComponentGroupRef Id='Examples' />
+ </Feature>
+
+ <Feature Id='Translations' Level='1' Title='Translations' Description='translations' AllowAdvertise='no'>
+ <ComponentGroupRef Id='Translations' />
+ </Feature>
+
+ <Feature Id='Tutorials' Level='1' Title='Tutorials' Description='tutorials as svg' AllowAdvertise='no'>
+ <ComponentGroupRef Id='Tutorials' />
+ </Feature>
+<!--
+ <ComponentRef Id='ProgramMenuDir' />
+-->
+ </Feature>
+ <WixVariable Id="WixUILicenseRtf" Value="..\..\inkscape\COPYING" />
+ <UIRef Id="WixUI_Mondo" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+
+ <Icon Id="inkscape.exe" SourceFile="..\..\inkscape\inkscape.exe" />
+
+ </Product>
+</Wix>
diff --git a/packaging/wix/install.bat b/packaging/wix/install.bat new file mode 100644 index 000000000..14596113c --- /dev/null +++ b/packaging/wix/install.bat @@ -0,0 +1,30 @@ +@echo set environment parameter ...
+rem call wixenv.bat
+
+@echo todo implement custom icon and artwork
+@echo todo insert files from ../source/release
+
+@echo call wix compiler ...
+candle inkscape.wxs -ext WiXUtilExtension
+@if NOT %ERRORLEVEL% == 0 goto theend
+
+candle files.wxs
+@if NOT %ERRORLEVEL% == 0 goto theend
+
+@echo call wix linker ...
+light -ext WixUIExtension -ext WiXUtilExtension inkscape.wixobj files.wixobj -o inkscape.msi
+@if NOT %ERRORLEVEL% == 0 goto theend
+
+@echo the installer is now created
+goto theend
+
+@echo install ...
+msiexec /i inkscape.msi /l*v inkscape.log
+
+pause the program is now installed. press any key to run uninstaller ...
+@echo deinstall ...
+msiexec /x inkscape.msi
+
+@echo ... finished
+
+:theend
diff --git a/packaging/wix/next_uuid.py b/packaging/wix/next_uuid.py new file mode 100644 index 000000000..6ed20b506 --- /dev/null +++ b/packaging/wix/next_uuid.py @@ -0,0 +1,10 @@ +import uuid
+
+"""
+a helper script to simply generate some new UUID
+"""
+
+out = open('next_uuid.txt', 'wt')
+for i in xrange(10):
+ out.write(str(uuid.uuid4()) + '\n')
+
diff --git a/packaging/wix/wixenv.bat b/packaging/wix/wixenv.bat new file mode 100644 index 000000000..85db740df --- /dev/null +++ b/packaging/wix/wixenv.bat @@ -0,0 +1,4 @@ +@echo Setting environment variables for creating msi installer
+IF "%DEVLIBS_PATH%"=="" set DEVLIBS_PATH=c:\devlibs
+IF "%WIX_PATH%"=="" set WIX_PATH=C:\Programme\WiX Toolset v3.6\bin
+set PATH=%DEVLIBS_PATH%\python;%WIX_PATH%;%PATH%
|
