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

Commit

Permalink
generalize build-msi.sh for 32/64 builds (#408)
Browse files Browse the repository at this point in the history
* generalize build-msi.sh for 32/64 builds

* Rename windows-connector.wxs to windows-connector-x64.wxs

* Create windows-connector-x86.wxs
  • Loading branch information
jay0lee authored and agoode committed Apr 3, 2018
1 parent 11d2968 commit 7d5f127
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 2 deletions.
12 changes: 10 additions & 2 deletions wix/build-msi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ fi
export CONNECTOR_VERSION=$1
LDFLAGS="github.com/google/cloud-print-connector/lib.BuildDate=$CONNECTOR_VERSION"
CONNECTOR_DIR=$GOPATH/src/github.com/google/cloud-print-connector
MSI_FILE="$CONNECTOR_DIR/wix/windows-connector-$CONNECTOR_VERSION.msi"

arch=$(arch)
if [[ "$arch" == "i686" ]]; then
wixarch="x86"
elif [[ "$arch" == "x86_64" ]]; then
wixarch="x64"
fi

MSI_FILE="$CONNECTOR_DIR/wix/windows-connector-$CONNECTOR_VERSION-$arch.msi"

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

echo "Running WIX candle.exe..."
"$WIX/bin/candle.exe" -arch x64 "$CONNECTOR_DIR/wix/windows-connector.wxs" \
"$WIX/bin/candle.exe" -arch $wixarch "$CONNECTOR_DIR/wix/windows-connector-$wixarch.wxs" \
"$CONNECTOR_DIR/wix/dependencies.wxs"
rc=$?
if [[ $rc != 0 ]]; then
Expand Down
File renamed without changes.
174 changes: 174 additions & 0 deletions wix/windows-connector-x86.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="*"
Name="Google Cloud Print Windows Connector"
Language="1033"
Version="$(env.CONNECTOR_VERSION)"
Manufacturer="Google, Inc."
UpgradeCode="15C3FD61-B03C-4C04-A56D-CD8424C99D7F">
<Package
InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

<MajorUpgrade
DowngradeErrorMessage=
"A newer version of [ProductName] is already installed."
Schedule="afterInstallExecute" />
<MediaTemplate EmbedCab="yes" />

<!-- Variable used by WIX at build time to find the built files -->
<?if $(env.GOPATH) ?>
<WixVariable Id="SourceDir" Overridable="yes" Value="$(env.GOPATH)\bin"/>
<?else?>
<WixVariable Id="SourceDir" Overridable="yes" Value="C:\go32\bin"/>
<?endif?>
<!-- Variable used by WIX at build time to locate the dependency dlls -->
<WixVariable
Id="DependencyDir"
Overridable="yes"
Value="C:\msys32\mingw32\bin"/>

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />
<UIRef Id="WixUI_InstallDir" />

<Feature
Id="connector"
Title="Google Cloud Print Windows Connector"
Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="Dependencies" />
<ComponentRef Id="ConfigFile" />
</Feature>
</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="GoogleFolder" Name="Google">
<Directory Id="INSTALLFOLDER" Name="Cloud Print Connector" />
</Directory>
</Directory>
<Directory Id="TempFolder" />
<Directory Id="CommonAppDataFolder">
<Directory Id="GoogleDataFolder" Name="Google">
<Directory Id="CloudPrintDataFolder" Name="Cloud Print Connector" />
</Directory>
</Directory>
</Directory>
</Fragment>

<Fragment>
<!-- Group of components that are our main application items -->
<ComponentGroup
Id="ProductComponents"
Directory="INSTALLFOLDER"
Source="!(wix.SourceDir)">
<Component Id="Connector_exe">
<File Name="gcp-windows-connector.exe" KeyPath="yes" />
<ServiceInstall
Name="Cloud Print Connector"
Description="Shares printers with Google Cloud Print"
Start="auto"
Type="ownProcess"
ErrorControl="normal"
Vital="yes"
Arguments='--config-filename="[CloudPrintDataFolder]gcp-windows-connector.config.json"'>
<ServiceDependency Id="Spooler" />
<ServiceDependency Id="Tcpip" />
</ServiceInstall>
<ServiceControl
Id="StopService"
Name="Cloud Print Connector"
Remove="uninstall"
Stop="uninstall" />
</Component>
<Component Id="Connector_exe_start" Guid="" KeyPath="yes">
<ServiceControl
Id="StartService"
Name="Cloud Print Connector"
Start="install" />
<Condition>STARTSERVICE="YES"</Condition>
</Component>
<Component Id="Connector_Util_exe">
<File Id="ConnectorUtil" Name="gcp-connector-util.exe" KeyPath="yes" />
</Component>
</ComponentGroup>
<Component Id="ConfigFile" Guid="19aa4f1c-3fd8-4fd6-abba-865d1e62ec42"
Directory="CloudPrintDataFolder">
<CreateFolder />
<RemoveFolder Id="RemoveCloudPrintDataFolder" On="uninstall" />
<RemoveFolder Id="RemoveGoogleDataFolder" On="uninstall"
Directory="GoogleDataFolder" />
<CopyFile
Id="ConfigFile"
Delete="yes"
DestinationDirectory="CloudPrintDataFolder"
DestinationName="gcp-windows-connector.config.json"
SourceProperty="CONFIGFILEPATH" />
<RemoveFile
Id="ConfigFile"
Directory="CloudPrintDataFolder"
Name="gcp-windows-connector.config.json"
On="uninstall" />
</Component>
<Property Id="CONFIGFILE" Secure="yes" />
<SetProperty
Id="CONFIGFILEPATH"
Action="SetConfigFileDefault"
After="LaunchConditions"
Sequence="first"
Value="[TempFolder]gcp-windows-connector.config.json">
NOT CONFIGFILE
</SetProperty>
<SetProperty
Id="CONFIGFILEPATH"
Action="SetConfigFileCustom"
After="LaunchConditions"
Sequence="first"
Value="[CONFIGFILE]">
CONFIGFILE
</SetProperty>
</Fragment>

<Fragment>
<InstallUISequence>
<ExecuteAction />
<Show Dialog="WelcomeDlg" Before="ManualInit" />
<Show Dialog="ProgressDlg" After="ManualInit" />
<Custom Action="ManualInit" Before="ExecuteAction">
NOT CONFIGFILE and NOT Installed and NOT WIX_UPGRADE_DETECTED and RUNINIT="YES"
</Custom>
</InstallUISequence>

<InstallExecuteSequence>
<RemoveFiles />
<Custom Action="DeletePrinters" Before="RemoveFiles">
DELETEPRINTERS="YES" AND $ConfigFile=2
</Custom>
</InstallExecuteSequence>

<Property Id="DELETEPRINTERS" Value="YES" Secure="yes" />
<Property Id="INITPARAMS" Secure="yes" Hidden="yes" />
<Property Id="RUNINIT" Secure="yes" Value="YES" />
<Property Id="STARTSERVICE" Secure="yes" Value="YES" />

<CustomAction
Id="ManualInit"
BinaryKey="ConnectorUtil"
Execute="immediate"
Return="check"
ExeCommand="init [INITPARAMS]" />

<CustomAction
Id="DeletePrinters"
FileKey="ConnectorUtil"
Execute="deferred"
Return="ignore"
ExeCommand='--config-filename="[CloudPrintDataFolder]gcp-windows-connector.config.json" delete-all-gcp-printers' />

<Binary
Id="ConnectorUtil"
SourceFile="!(wix.SourceDir)\gcp-connector-util.exe" />
</Fragment>
</Wix>

0 comments on commit 7d5f127

Please sign in to comment.