Skip to content
This repository was archived by the owner on Jun 17, 2022. It is now read-only.

Commit 7d5f127

Browse files
jay0leeagoode
authored andcommitted
generalize build-msi.sh for 32/64 builds (#408)
* generalize build-msi.sh for 32/64 builds * Rename windows-connector.wxs to windows-connector-x64.wxs * Create windows-connector-x86.wxs
1 parent 11d2968 commit 7d5f127

File tree

3 files changed

+184
-2
lines changed

3 files changed

+184
-2
lines changed

wix/build-msi.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ fi
66
export CONNECTOR_VERSION=$1
77
LDFLAGS="github.com/google/cloud-print-connector/lib.BuildDate=$CONNECTOR_VERSION"
88
CONNECTOR_DIR=$GOPATH/src/github.com/google/cloud-print-connector
9-
MSI_FILE="$CONNECTOR_DIR/wix/windows-connector-$CONNECTOR_VERSION.msi"
9+
10+
arch=$(arch)
11+
if [[ "$arch" == "i686" ]]; then
12+
wixarch="x86"
13+
elif [[ "$arch" == "x86_64" ]]; then
14+
wixarch="x64"
15+
fi
16+
17+
MSI_FILE="$CONNECTOR_DIR/wix/windows-connector-$CONNECTOR_VERSION-$arch.msi"
1018

1119
echo "Running go get..."
1220
go get -ldflags -X="$LDFLAGS" -v github.com/google/cloud-print-connector/...
@@ -25,7 +33,7 @@ if [[ $rc != 0 ]]; then
2533
fi
2634

2735
echo "Running WIX candle.exe..."
28-
"$WIX/bin/candle.exe" -arch x64 "$CONNECTOR_DIR/wix/windows-connector.wxs" \
36+
"$WIX/bin/candle.exe" -arch $wixarch "$CONNECTOR_DIR/wix/windows-connector-$wixarch.wxs" \
2937
"$CONNECTOR_DIR/wix/dependencies.wxs"
3038
rc=$?
3139
if [[ $rc != 0 ]]; then
File renamed without changes.

wix/windows-connector-x86.wxs

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3+
<Product
4+
Id="*"
5+
Name="Google Cloud Print Windows Connector"
6+
Language="1033"
7+
Version="$(env.CONNECTOR_VERSION)"
8+
Manufacturer="Google, Inc."
9+
UpgradeCode="15C3FD61-B03C-4C04-A56D-CD8424C99D7F">
10+
<Package
11+
InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
12+
13+
<MajorUpgrade
14+
DowngradeErrorMessage=
15+
"A newer version of [ProductName] is already installed."
16+
Schedule="afterInstallExecute" />
17+
<MediaTemplate EmbedCab="yes" />
18+
19+
<!-- Variable used by WIX at build time to find the built files -->
20+
<?if $(env.GOPATH) ?>
21+
<WixVariable Id="SourceDir" Overridable="yes" Value="$(env.GOPATH)\bin"/>
22+
<?else?>
23+
<WixVariable Id="SourceDir" Overridable="yes" Value="C:\go32\bin"/>
24+
<?endif?>
25+
<!-- Variable used by WIX at build time to locate the dependency dlls -->
26+
<WixVariable
27+
Id="DependencyDir"
28+
Overridable="yes"
29+
Value="C:\msys32\mingw32\bin"/>
30+
31+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
32+
<WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />
33+
<UIRef Id="WixUI_InstallDir" />
34+
35+
<Feature
36+
Id="connector"
37+
Title="Google Cloud Print Windows Connector"
38+
Level="1">
39+
<ComponentGroupRef Id="ProductComponents" />
40+
<ComponentGroupRef Id="Dependencies" />
41+
<ComponentRef Id="ConfigFile" />
42+
</Feature>
43+
</Product>
44+
45+
<Fragment>
46+
<Directory Id="TARGETDIR" Name="SourceDir">
47+
<Directory Id="ProgramFilesFolder">
48+
<Directory Id="GoogleFolder" Name="Google">
49+
<Directory Id="INSTALLFOLDER" Name="Cloud Print Connector" />
50+
</Directory>
51+
</Directory>
52+
<Directory Id="TempFolder" />
53+
<Directory Id="CommonAppDataFolder">
54+
<Directory Id="GoogleDataFolder" Name="Google">
55+
<Directory Id="CloudPrintDataFolder" Name="Cloud Print Connector" />
56+
</Directory>
57+
</Directory>
58+
</Directory>
59+
</Fragment>
60+
61+
<Fragment>
62+
<!-- Group of components that are our main application items -->
63+
<ComponentGroup
64+
Id="ProductComponents"
65+
Directory="INSTALLFOLDER"
66+
Source="!(wix.SourceDir)">
67+
<Component Id="Connector_exe">
68+
<File Name="gcp-windows-connector.exe" KeyPath="yes" />
69+
<ServiceInstall
70+
Name="Cloud Print Connector"
71+
Description="Shares printers with Google Cloud Print"
72+
Start="auto"
73+
Type="ownProcess"
74+
ErrorControl="normal"
75+
Vital="yes"
76+
Arguments='--config-filename="[CloudPrintDataFolder]gcp-windows-connector.config.json"'>
77+
<ServiceDependency Id="Spooler" />
78+
<ServiceDependency Id="Tcpip" />
79+
</ServiceInstall>
80+
<ServiceControl
81+
Id="StopService"
82+
Name="Cloud Print Connector"
83+
Remove="uninstall"
84+
Stop="uninstall" />
85+
</Component>
86+
<Component Id="Connector_exe_start" Guid="" KeyPath="yes">
87+
<ServiceControl
88+
Id="StartService"
89+
Name="Cloud Print Connector"
90+
Start="install" />
91+
<Condition>STARTSERVICE="YES"</Condition>
92+
</Component>
93+
<Component Id="Connector_Util_exe">
94+
<File Id="ConnectorUtil" Name="gcp-connector-util.exe" KeyPath="yes" />
95+
</Component>
96+
</ComponentGroup>
97+
<Component Id="ConfigFile" Guid="19aa4f1c-3fd8-4fd6-abba-865d1e62ec42"
98+
Directory="CloudPrintDataFolder">
99+
<CreateFolder />
100+
<RemoveFolder Id="RemoveCloudPrintDataFolder" On="uninstall" />
101+
<RemoveFolder Id="RemoveGoogleDataFolder" On="uninstall"
102+
Directory="GoogleDataFolder" />
103+
<CopyFile
104+
Id="ConfigFile"
105+
Delete="yes"
106+
DestinationDirectory="CloudPrintDataFolder"
107+
DestinationName="gcp-windows-connector.config.json"
108+
SourceProperty="CONFIGFILEPATH" />
109+
<RemoveFile
110+
Id="ConfigFile"
111+
Directory="CloudPrintDataFolder"
112+
Name="gcp-windows-connector.config.json"
113+
On="uninstall" />
114+
</Component>
115+
<Property Id="CONFIGFILE" Secure="yes" />
116+
<SetProperty
117+
Id="CONFIGFILEPATH"
118+
Action="SetConfigFileDefault"
119+
After="LaunchConditions"
120+
Sequence="first"
121+
Value="[TempFolder]gcp-windows-connector.config.json">
122+
NOT CONFIGFILE
123+
</SetProperty>
124+
<SetProperty
125+
Id="CONFIGFILEPATH"
126+
Action="SetConfigFileCustom"
127+
After="LaunchConditions"
128+
Sequence="first"
129+
Value="[CONFIGFILE]">
130+
CONFIGFILE
131+
</SetProperty>
132+
</Fragment>
133+
134+
<Fragment>
135+
<InstallUISequence>
136+
<ExecuteAction />
137+
<Show Dialog="WelcomeDlg" Before="ManualInit" />
138+
<Show Dialog="ProgressDlg" After="ManualInit" />
139+
<Custom Action="ManualInit" Before="ExecuteAction">
140+
NOT CONFIGFILE and NOT Installed and NOT WIX_UPGRADE_DETECTED and RUNINIT="YES"
141+
</Custom>
142+
</InstallUISequence>
143+
144+
<InstallExecuteSequence>
145+
<RemoveFiles />
146+
<Custom Action="DeletePrinters" Before="RemoveFiles">
147+
DELETEPRINTERS="YES" AND $ConfigFile=2
148+
</Custom>
149+
</InstallExecuteSequence>
150+
151+
<Property Id="DELETEPRINTERS" Value="YES" Secure="yes" />
152+
<Property Id="INITPARAMS" Secure="yes" Hidden="yes" />
153+
<Property Id="RUNINIT" Secure="yes" Value="YES" />
154+
<Property Id="STARTSERVICE" Secure="yes" Value="YES" />
155+
156+
<CustomAction
157+
Id="ManualInit"
158+
BinaryKey="ConnectorUtil"
159+
Execute="immediate"
160+
Return="check"
161+
ExeCommand="init [INITPARAMS]" />
162+
163+
<CustomAction
164+
Id="DeletePrinters"
165+
FileKey="ConnectorUtil"
166+
Execute="deferred"
167+
Return="ignore"
168+
ExeCommand='--config-filename="[CloudPrintDataFolder]gcp-windows-connector.config.json" delete-all-gcp-printers' />
169+
170+
<Binary
171+
Id="ConnectorUtil"
172+
SourceFile="!(wix.SourceDir)\gcp-connector-util.exe" />
173+
</Fragment>
174+
</Wix>

0 commit comments

Comments
 (0)