Skip to content

Commit 850e658

Browse files
committed
build: Windows installer using Wix Toolset v4
The new stgit.wxs file is an xml file compiled by the `wix` executable into a Windows MSI installer. The installer uses a variation on WixUI_FeatureTree for its user interface. The install can be performed unattended using msiexec.exe, or use the fairly standard looking UI otherwise.
1 parent 44d37e4 commit 850e658

File tree

7 files changed

+292
-0
lines changed

7 files changed

+292
-0
lines changed

contrib/wix/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/stgit-*.msi
2+
/stgit-*.wixpdb

contrib/wix/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CARGO ?= cargo --locked
2+
RM ?= rm -f
3+
4+
STGIT_VERSION := $(shell $(CARGO) metadata --format-version=1 --no-deps | \
5+
grep -Eo '"version":"[^"]+"' | \
6+
sed -Ee 's/"version":"([^"]+)"/\1/g')
7+
8+
msi: stgit.wxs release-build
9+
wix build -arch x64 -src $< -ext WixToolset.UI.wixext -out stgit-$(STGIT_VERSION).msi -define StGitVersion=$(STGIT_VERSION) -bindpath ..\..
10+
11+
release-build:
12+
$(MAKE) -C ../.. STG_PROFILE=release build completion
13+
14+
.PHONY: release-build
15+
16+
17+
clean:
18+
$(RM) stgit-*.msi
19+
$(RM) stgit-*.wixpdb
20+
21+
.PHONY: clean

contrib/wix/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# StGit Windows MSI
2+
3+
This directory contains files supporting the build of an MSI
4+
installer for Windows environments.
5+
6+
The MSI is built using the [WiX Toolset](https://wixtoolset.org/)
7+
version 4.0.0.
8+
9+
The WiX Toolset may be installed with the following command:
10+
11+
```
12+
dotnet tool install --global wix --version 4.0.0
13+
```
14+
15+
The installer also requires the WixUI extension, which can be
16+
installed with:
17+
18+
```
19+
wix extension add -g WixToolset.UI.wixext
20+
```
21+
22+
To build the StGit msi installer, run:
23+
24+
```
25+
make -C contrib/wix
26+
```

contrib/wix/banner.bmp

83.9 KB
Binary file not shown.

contrib/wix/dialog.bmp

451 KB
Binary file not shown.

contrib/wix/gpl-2.0.rtf

Lines changed: 94 additions & 0 deletions
Large diffs are not rendered by default.

contrib/wix/stgit.wxs

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<Wix
2+
xmlns="http://wixtoolset.org/schemas/v4/wxs"
3+
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"
4+
>
5+
6+
<Package
7+
Name="Stacked Git"
8+
Version="$(StGitVersion)"
9+
Manufacturer="Stacked Git Project"
10+
Scope="perMachine"
11+
UpgradeCode="8816B18C-9578-48C0-8604-39785D99654D"
12+
>
13+
14+
<Media Id="1" Cabinet="stgit" EmbedCab="yes" />
15+
16+
<Feature Id="StGitBase" Title="Stacked Git" Level="1">
17+
<Component Id="StGitExe" Directory="APPBINDIR">
18+
<File Source="target\release\stg.exe" KeyPath="yes" Checksum="yes" />
19+
</Component>
20+
<Component
21+
Id="RequiredDocs"
22+
Directory="APPLICATIONFOLDER"
23+
Guid="77FFFA6A-C4EA-4AB6-9C43-C1943A357581"
24+
>
25+
<File Source="README.md" />
26+
<File Source="COPYING" />
27+
</Component>
28+
</Feature>
29+
30+
<Feature Id="SetPath" Title="Add StGit to PATH" Level="1">
31+
<Component
32+
Id="SetStGitPath"
33+
Directory="APPBINDIR"
34+
Guid="D136C879-F475-4934-B912-B0B968D205EB"
35+
>
36+
<Environment
37+
Name="PATH"
38+
Action="set"
39+
Part="last"
40+
Permanent="no"
41+
System="yes"
42+
Value="[APPBINDIR]"
43+
/>
44+
</Component>
45+
</Feature>
46+
47+
<Feature Id="ShellCompletions" Title="Shell Completions" Level="1">
48+
<Component
49+
Id="CompletionScripts"
50+
Directory="COMPLETIONSDIR"
51+
Guid="D76DCCB1-59F9-47AB-B9A3-21EE6373E8C7"
52+
>
53+
<File Source="completion\stg.fish" />
54+
<File Source="completion\stgit.bash" />
55+
<File Source="completion\stgit.zsh" />
56+
</Component>
57+
</Feature>
58+
59+
<ui:WixUI Id="FeatureTree_ViewLicense" />
60+
61+
<!-- <WixVariable Id="WixUILicenseRtf" Value="contrib\wix\gpl-2.0.rtf" /> -->
62+
<WixVariable Id="WixUIDialogBmp" Value="contrib\wix\dialog.bmp" />
63+
<WixVariable Id="WixUIBannerBmp" Value="contrib\wix\banner.bmp" />
64+
65+
</Package>
66+
67+
<Fragment>
68+
<StandardDirectory Id="ProgramFiles64Folder">
69+
<Directory Id="APPLICATIONFOLDER" Name="StGit">
70+
<Directory Id="APPBINDIR" Name="bin" />
71+
<Directory Id="COMPLETIONSDIR" Name="completion" />
72+
</Directory>
73+
</StandardDirectory>
74+
</Fragment>
75+
76+
<?foreach WIXUIARCH in X86;X64;A64 ?>
77+
<Fragment>
78+
<UI Id="FeatureTree_ViewLicense_$(WIXUIARCH)">
79+
<Publish Dialog="ViewLicenseDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
80+
</UI>
81+
82+
<UIRef Id="FeatureTree_ViewLicense" />
83+
</Fragment>
84+
<?endforeach?>
85+
86+
<!-- Like WixUI_FeatureTree, but the license text is shown without the agreement checkbox. -->
87+
<Fragment>
88+
<UI Id="file FeatureTree_ViewLicense">
89+
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
90+
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
91+
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
92+
93+
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
94+
95+
<DialogRef Id="ErrorDlg" />
96+
<DialogRef Id="FatalError" />
97+
<DialogRef Id="FilesInUse" />
98+
<DialogRef Id="MsiRMFilesInUse" />
99+
<DialogRef Id="PrepareDlg" />
100+
<DialogRef Id="ProgressDlg" />
101+
<DialogRef Id="ResumeDlg" />
102+
<DialogRef Id="UserExit" />
103+
104+
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
105+
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="ViewLicenseDlg" Condition="NOT Installed" />
106+
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="Installed AND PATCH" />
107+
<Publish Dialog="ViewLicenseDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" />
108+
<Publish Dialog="ViewLicenseDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg" />
109+
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1" Condition="Installed" />
110+
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="ViewLicenseDlg" Order="2" Condition="NOT Installed" />
111+
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" />
112+
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1" Condition="NOT Installed OR WixUI_InstallMode = &quot;Change&quot;" />
113+
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2" Condition="Installed AND NOT PATCH" />
114+
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3" Condition="Installed AND PATCH" />
115+
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" />
116+
<Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg" />
117+
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg" />
118+
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg" />
119+
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg" />
120+
</UI>
121+
122+
<UIRef Id="WixUI_Common" />
123+
</Fragment>
124+
125+
<!-- License dialog that just shows the license file w/o agreement checkbox. -->
126+
<Fragment>
127+
<UI>
128+
<Dialog Id="ViewLicenseDlg" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)">
129+
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
130+
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
131+
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
132+
<Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgDescription)" />
133+
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgTitle)" />
134+
<Control Id="Print" Type="PushButton" X="112" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)" />
135+
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
136+
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
137+
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg" Condition="!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1" />
138+
</Control>
139+
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
140+
<Publish Event="SpawnDialog" Value="CancelDlg" />
141+
</Control>
142+
<Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="158" Sunken="yes" TabSkip="no">
143+
<Text SourceFile="contrib\wix\gpl-2.0.rtf" />
144+
</Control>
145+
</Dialog>
146+
</UI>
147+
</Fragment>
148+
149+
</Wix>

0 commit comments

Comments
 (0)