Skip to content

Commit e473229

Browse files
committed
Added MSI package build system.
1 parent 00f6982 commit e473229

File tree

6 files changed

+263
-0
lines changed

6 files changed

+263
-0
lines changed

.hgignore

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ diff
1212
*.pyc
1313
*.log
1414
*.mo
15+
*.msm
16+
*.wixobj
17+
*.wixpdb
18+
*.msi
19+
*.pdb
20+
installer/files/*
1521
user-config.py
1622
build
1723
tags

installer/Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
VERSION_FULL=$(shell python -c 'import getversion; getversion.getversion("full")')
3+
VERSION=$(shell python -c 'import getversion; getversion.getversion("ms")')
4+
MSI=gpick_$(VERSION_FULL)
5+
6+
HEAT_SRCS=gpick_files.xstl gtk_files.xstl
7+
SRCS=gpick.wxs $(HEAT_SRCS:.xstl=.wxs)
8+
OBJS=$(SRCS:.wxs=.wixobj)
9+
CANDLE=candle.exe
10+
LIGHT=light.exe
11+
HEAT=heat.exe
12+
13+
HEAT_FLAGS=-ag -dr INSTALLDIR -suid -srd -var var.FilePath
14+
FLAGS=-dFilePath=files -dVersionFull=$(VERSION_FULL) -dVersion=$(VERSION)
15+
LIGHT_FLAGS=-ext WixUtilExtension -ext WixUIExtension $(FLAGS)
16+
CANDLE_FLAGS=$(FLAGS)
17+
18+
DEPFILES= files/Gpick.exe
19+
20+
.SUFFIXES: .wxs .wixobj .xstl
21+
22+
all: $(MSI).msi
23+
24+
$(MSI).msi: $(OBJS) $(DEPFILES) $(HEAT_SRCS)
25+
$(LIGHT) -nologo $(LIGHT_FLAGS) -out $@ $(OBJS)
26+
27+
.xstl.wxs:
28+
$(HEAT) dir "files" -nologo $(HEAT_FLAGS) -cg C.Files.$(<:.xstl=) -t $< -out $@
29+
30+
.wxs.wixobj:
31+
$(CANDLE) -nologo $(CANDLE_FLAGS) -out $@ $^
32+
33+
clean:
34+
$(RM) $(MSI).msi $(OBJS)
35+
36+
install: $(MSI).msi
37+
$(RM) install.log
38+
msiexec -i $(MSI).msi -l*v install.log
39+
40+
uninstall:
41+
msiexec -x $(MSI).msi
42+

installer/getversion.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os,sys,re
2+
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
3+
sys.path.insert(0,parentdir)
4+
import version
5+
6+
def getversion(style):
7+
if style == "full":
8+
print version.GPICK_BUILD_VERSION
9+
else:
10+
result = re.match(r"^(\d+\.\d+\.\d+)(.*)$", version.GPICK_BUILD_VERSION)
11+
if result:
12+
print result.group(1)
13+
else:
14+
print "invalid_version"

installer/gpick.wxs

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
3+
<?define ProductName = "Gpick" ?>
4+
<?define Description = "Gpick - advanced color picker" ?>
5+
<?define Manufacturer = "Albertas Vyšniauskas" ?>
6+
<?define Platform = "x86" ?>
7+
8+
<!-- Platform specific variables -->
9+
<?if $(var.Platform) = x64 ?>
10+
<?define Win64 = "yes" ?>
11+
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
12+
<?else ?>
13+
<?define Win64 = "no" ?>
14+
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
15+
<?endif ?>
16+
17+
<Product Name='$(var.ProductName) $(var.VersionFull)' Id='*' UpgradeCode='4392F4E5-609F-455B-9F50-45BD536CAF9E' Language='1033' Codepage='1252' Version='$(var.Version)' Manufacturer='$(var.Manufacturer)'>
18+
<Package Id='*' Keywords='Installer' Description="$(var.ProductName) $(var.VersionFull) Installer" Comments='$(var.Description)' Manufacturer='$(var.Manufacturer)' InstallerVersion='405' Languages='1033' Compressed='yes' SummaryCodepage='1252' InstallPrivileges='elevated' Platform='$(var.Platform)' InstallScope='perMachine' />
19+
20+
<Condition Message="You need to be an administrator to install this product.">
21+
Privileged
22+
</Condition>
23+
24+
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
25+
26+
<DirectoryRef Id="TARGETDIR">
27+
<Merge Id="VCRedist" SourceFile="Microsoft_VC110_CRT_x86.msm" DiskId="1" Language="0"/>
28+
</DirectoryRef>
29+
30+
<Feature Id="VCRedist" Title="Visual C++ 11.0 Runtime" AllowAdvertise="no" Display="hidden" Level="1">
31+
<MergeRef Id="VCRedist"/>
32+
</Feature>
33+
34+
<Media Id='1' Cabinet='Data1.cab' EmbedCab='yes' DiskPrompt='Disk #1' />
35+
<Property Id='DiskPrompt' Value="$(var.ProductName) $(var.VersionFull) Installation [1]" />
36+
37+
<UIRef Id="WixUI_FeatureTreeNoLicense" />
38+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
39+
40+
<Feature Id='Ft.Gpick' Title='Gpick' AllowAdvertise="no" Absent="disallow" Description='The complete package.' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
41+
<Feature Id='Ft.ProgramFiles' Title='Program files' AllowAdvertise="no" Absent="disallow" Description='Program files.' Display='expand' Level='1'>
42+
<ComponentRef Id='C.Gpick.exe' />
43+
<ComponentRef Id='C.AssociateGPAFile' />
44+
<ComponentRef Id='C.Gpick.ico' />
45+
<ComponentRef Id='C.GpickRegInstallDir' />
46+
<ComponentGroupRef Id='C.Files.gpick_files' />
47+
</Feature>
48+
<Feature Id='Ft.GtkLibraries' Title='GTK+ libraries' AllowAdvertise="no" Description='GTK+ libraries required to run Gpick.' Display='expand' Level='1'>
49+
<ComponentGroupRef Id='C.Files.gtk_files' />
50+
</Feature>
51+
<Feature Id='Ft.ProgramShortcuts' Title='Program shortcuts' AllowAdvertise="no" Description='Shortcuts in the start menu.' Display='expand' Level='1'>
52+
<ComponentRef Id='C.ApplicationShortcut' />
53+
</Feature>
54+
<Feature Id='Ft.DesktopShortcuts' Title='Desktop shortcut' AllowAdvertise="no" Description='Shortcut to Gpick in the desktop.' Display='expand' Level='1'>
55+
<ComponentRef Id='C.ApplicationDesktopShortcut' />
56+
</Feature>
57+
<ComponentRef Id='C.Empty' />
58+
</Feature>
59+
60+
<Property Id="INSTALLDIR">
61+
<RegistrySearch Id='GpickRegistryCurrentUser' Type='raw' Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Name='InstallDir' />
62+
<RegistrySearch Id='GpickRegistryLocalMachine' Type='raw' Root='HKLM' Key='Software\[Manufacturer]\[ProductName]' Name='InstallDir' />
63+
</Property>
64+
65+
<Icon Id="GpickIcon" SourceFile="$(var.FilePath)/gpick.ico" />
66+
67+
<Directory Id='TARGETDIR' Name='SourceDir'>
68+
<Directory Id="ProgramMenuFolder">
69+
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)" />
70+
</Directory>
71+
72+
<Directory Id='$(var.PlatformProgramFilesFolder)'>
73+
<Directory Id='INSTALLDIR' Name='$(var.ProductName)' />
74+
</Directory>
75+
76+
<Directory Id="DesktopFolder" />
77+
</Directory>
78+
79+
<DirectoryRef Id="INSTALLDIR">
80+
<Component Id="C.Empty" Guid='*'>
81+
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="Empty" Type="integer" Value="1" KeyPath="yes"/>
82+
</Component>
83+
84+
<Component Id='C.Gpick.exe' Guid='*'>
85+
<File Id='F.Gpick.exe' Name='Gpick.exe' DiskId='1' Source='$(var.FilePath)/gpick.exe' KeyPath='yes' />
86+
</Component>
87+
88+
<Component Id='C.Gpick.ico' Guid='*'>
89+
<File Id='F.Gpick.ico' Name='Gpick.ico' DiskId='1' Source='$(var.FilePath)/gpick.ico' KeyPath='yes' />
90+
</Component>
91+
92+
<Component Id='C.AssociateGPAFile' Guid='E220FB1E-1198-4CE0-B292-551569EDAC35'>
93+
<ProgId Id='Gpick.gpafile' Description='Gpick palette file' Icon='F.Gpick.ico'>
94+
<Extension Id='gpa' ContentType='application/gpick'>
95+
<Verb Id='open' Command='Open' TargetFile='F.Gpick.exe' Argument='"%1"' />
96+
</Extension>
97+
</ProgId>
98+
<RegistryValue Root="HKLM" Key="Software\[Manufacturer]\[ProductName]" Name="AssociateGPAFile" Type="integer" Value="1" KeyPath="yes"/>
99+
</Component>
100+
101+
<Component Id='C.GpickRegInstallDir' Guid='*'>
102+
<RegistryKey Id='GpickRegInstallDir' Root='HKLM' Key='Software\[Manufacturer]\[ProductName]' ForceDeleteOnUninstall='yes'>
103+
<RegistryValue Type='string' Name='InstallDir' Value='[INSTALLDIR]' />
104+
</RegistryKey>
105+
</Component>
106+
</DirectoryRef>
107+
108+
<DirectoryRef Id="DesktopFolder">
109+
<Component Id="C.ApplicationDesktopShortcut" Guid="89CADEA8-2BD0-4A22-BCDB-C7E709490578">
110+
<Shortcut Id="desktopGpick" Name="$(var.ProductName)" Description="Start Gpick" Target="[INSTALLDIR]Gpick.exe" WorkingDirectory='INSTALLDIR' Icon="GpickIcon" />
111+
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="DesktopFolder" Type="integer" Value="1" KeyPath="yes"/>
112+
</Component>
113+
</DirectoryRef>
114+
115+
<DirectoryRef Id="ApplicationProgramsFolder">
116+
<Component Id="C.ApplicationShortcut" Guid="4FCED9B2-B2A3-4CA9-B3F3-A55649D775DE">
117+
<Shortcut Id="startmenuGpick" Name="$(var.ProductName)" Description="Start Gpick" Target="[INSTALLDIR]Gpick.exe" WorkingDirectory='INSTALLDIR' Icon="GpickIcon" />
118+
<Shortcut Id="uninstallGpick" Name="Uninstall" Description="Uninstalls Gpick" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]"/>
119+
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="ApplicationShortcut" Type="integer" Value="1" KeyPath="yes"/>
120+
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
121+
</Component>
122+
</DirectoryRef>
123+
</Product>
124+
125+
<Fragment>
126+
<UI Id="WixUI_FeatureTreeNoLicense">
127+
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
128+
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
129+
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
130+
131+
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
132+
<Property Id="WixUI_Mode" Value="FeatureTree" />
133+
134+
<DialogRef Id="ErrorDlg" />
135+
<DialogRef Id="FatalError" />
136+
<DialogRef Id="FilesInUse" />
137+
<DialogRef Id="MsiRMFilesInUse" />
138+
<DialogRef Id="PrepareDlg" />
139+
<DialogRef Id="ProgressDlg" />
140+
<DialogRef Id="ResumeDlg" />
141+
<DialogRef Id="UserExit" />
142+
143+
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
144+
145+
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">NOT Installed</Publish>
146+
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
147+
148+
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">Installed</Publish>
149+
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">NOT Installed</Publish>
150+
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
151+
152+
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
153+
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
154+
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish>
155+
156+
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
157+
158+
<Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
159+
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
160+
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
161+
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
162+
</UI>
163+
164+
<UIRef Id="WixUI_Common" />
165+
</Fragment>
166+
167+
168+
<Fragment>
169+
<Property Id="ARPCOMMENTS" Value="$(var.Description)" />
170+
<Property Id="ARPPRODUCTICON" Value="GpickIcon" />
171+
<Property Id="ARPURLINFOABOUT" Value="http://gpick.googlecode.com/" />
172+
<Property Id="ARPHELPLINK" Value="http://gpick.googlecode.com/" />
173+
<CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
174+
<InstallExecuteSequence>
175+
<Custom Action="SetARPINSTALLLOCATION" After="InstallValidate" />
176+
</InstallExecuteSequence>
177+
</Fragment>
178+
179+
</Wix>

installer/gpick_files.xstl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
2+
<xsl:output method="xml" indent="yes" />
3+
<xsl:strip-space elements="*"/>
4+
<xsl:template match="@*|node()">
5+
<xsl:copy>
6+
<xsl:apply-templates select="@*|node()"/>
7+
</xsl:copy>
8+
</xsl:template>
9+
<xsl:template match='wix:Wix/wix:Fragment/wix:ComponentGroup/wix:Component[(@Id and @Directory) and not (@Id = "lua5.2.dll" or @Id = "expat2.1.dll" or @Directory = "gpick")]' />
10+
<xsl:template match='wix:Wix/wix:Fragment[wix:DirectoryRef/wix:Directory[@Id and not (@Id = "gpick")]]' />
11+
</xsl:stylesheet>

installer/gtk_files.xstl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
2+
<xsl:output method="xml" indent="yes" />
3+
<xsl:strip-space elements="*"/>
4+
<xsl:template match="@*|node()">
5+
<xsl:copy>
6+
<xsl:apply-templates select="@*|node()"/>
7+
</xsl:copy>
8+
</xsl:template>
9+
<xsl:template match='wix:Wix/wix:Fragment/wix:ComponentGroup/wix:Component[(@Id and @Directory) and (@Id = "gpick.exe" or @Id = "gpick.ico" or @Id = "lua5.2.dll" or @Id = "expat2.1.dll" or @Directory = "gpick")]' />
10+
<xsl:template match='wix:Wix/wix:Fragment[wix:DirectoryRef/wix:Directory[@Id and (@Id = "gpick")]]' />
11+
</xsl:stylesheet>

0 commit comments

Comments
 (0)