Skip to content

Commit f92b946

Browse files
committed
Add makefile target to create windows msi installer for crc
We use wixtools to create the msi, this commit adds boilerplate wxs files for the crc msi installer and some branding resources like banner and ico The resulting msi installs crc in the Program Files/CodeReady Containers
1 parent 49b7508 commit f92b946

11 files changed

Lines changed: 458 additions & 2 deletions

File tree

Makefile

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ HOST_BUILD_DIR=$(BUILD_DIR)/$(GOOS)-$(GOARCH)
2828
GOPATH ?= $(shell go env GOPATH)
2929
ORG := github.com/code-ready
3030
REPOPATH ?= $(ORG)/crc
31+
PACKAGE_DIR := packaging/$(GOOS)
3132

3233
SOURCES := $(shell git ls-files *.go ":^vendor")
3334

@@ -145,8 +146,12 @@ clean_macos_package:
145146
rm -f packaging/darwin/scripts/postinstall
146147
rm -rf packaging/root/
147148

149+
clean_windows_msi:
150+
rm -rf packaging/windows/msi
151+
rm -f $(HOST_BUILD_DIR)/split
152+
148153
.PHONY: clean ## Remove all build artifacts
149-
clean: clean_docs clean_macos_package
154+
clean: clean_docs clean_macos_package clean_windows_msi
150155
rm -f $(GENERATED_RPM_FILES)
151156
rm -rf $(BUILD_DIR)
152157
rm -f $(GOPATH)/bin/crc
@@ -296,3 +301,34 @@ $(GOPATH)/bin/gomod2rpmdeps:
296301
@sed -e 's/__VERSION__/'$(CRC_VERSION)'/g' \
297302
-e 's/__OPENSHIFT_VERSION__/'$(BUNDLE_VERSION)'/g' \
298303
$< >$@
304+
305+
$(HOST_BUILD_DIR)/split: packaging/windows/split.go
306+
go build -o $(HOST_BUILD_DIR)/split packaging/windows/split.go
307+
308+
.PHONY: msidir
309+
msidir: CRC_EXE = crc.exe
310+
msidir: clean $(HOST_BUILD_DIR)/crc-embedder $(HOST_BUILD_DIR)/split $(BUILD_DIR)/windows-amd64/crc.exe check_bundledir $(PACKAGE_DIR)/product.wxs
311+
mkdir -p $(PACKAGE_DIR)/msi
312+
$(HOST_BUILD_DIR)/crc-embedder embed --goos windows --log-level debug --bundle-dir $(BUNDLE_DIR) $(BUILD_DIR)/windows-amd64/crc.exe
313+
cp $(HOST_BUILD_DIR)/crc.exe $(PACKAGE_DIR)/msi/$(CRC_EXE)
314+
ifeq ($(MOCK_BUNDLE),true)
315+
mv $(PACKAGE_DIR)/msi/$(CRC_EXE) $(PACKAGE_DIR)/msi/$(CRC_EXE).0
316+
touch $(PACKAGE_DIR)/msi/$(CRC_EXE).1 $(PACKAGE_DIR)/msi/$(CRC_EXE).2
317+
else
318+
$(HOST_BUILD_DIR)/split $(PACKAGE_DIR)/msi/$(CRC_EXE)
319+
rm $(PACKAGE_DIR)/msi/$(CRC_EXE)
320+
endif
321+
cp -r $(PACKAGE_DIR)/Resources $(PACKAGE_DIR)/msi/
322+
cp $(PACKAGE_DIR)/*.wxs $(PACKAGE_DIR)/msi
323+
rm $(PACKAGE_DIR)/product.wxs
324+
325+
$(BUILD_DIR)/windows-amd64/crc-windows-amd64.msi: msidir
326+
candle.exe -arch x64 -o $(PACKAGE_DIR)/msi/ $(PACKAGE_DIR)/msi/*.wxs
327+
cd $(PACKAGE_DIR)/msi && light.exe -ext WixUIExtension -ext WixUtilExtension -sacl -spdb -sice:ICE61 -out ../../../$@ *.wixobj
328+
329+
CABS_MSI = "cab1.cab,cab2.cab,cab3.cab,crc-windows-amd64.msi"
330+
$(BUILD_DIR)/windows-amd64/crc-installer.zip: $(BUILD_DIR)/windows-amd64/crc-windows-amd64.msi
331+
rm -f $(HOST_BUILD_DIR)/crc.exe
332+
rm -f $(HOST_BUILD_DIR)/crc-embedder
333+
rm -f $(HOST_BUILD_DIR)/split
334+
pwsh -NoProfile -Command "cd $(HOST_BUILD_DIR); Compress-Archive -LiteralPath $(CABS_MSI) -DestinationPath crc-installer.zip"

appveyor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ stack: go 1.14
66
before_test:
77
- choco install mingw
88
- choco install make
9+
- choco install wixtoolset
10+
- set PATH=%PATH%;"C:\Program Files (x86)\WiX Toolset v3.11\bin"
11+
- refreshenv
12+
- make MOCK_BUNDLE=true BUNDLE_DIR=./ out/windows-amd64/crc-installer.zip
913
- make cross
1014
test_script:
1115
- make test

packaging/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ root/
44
/darwin/Resources/LICENSE.txt
55
/darwin/Resources/welcome.html
66
/darwin/scripts/postinstall
7-
/VERSION
7+
/VERSION
8+
/windows/msi/
9+
packaging/windows/product.wxs
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
4+
<Fragment>
5+
<UI>
6+
<Dialog Id="LicenseAgreementDlg_HK" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)">
7+
<Control Id="LicenseAcceptedCheckBox" Type="CheckBox" X="20" Y="207" Width="330" Height="18" CheckBoxValue="1" Property="LicenseAccepted"
8+
Text="!(loc.LicenseAgreementDlgLicenseAcceptedCheckBox)" />
9+
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
10+
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
11+
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
12+
<Condition Action="disable"><![CDATA[LicenseAccepted <> "1"]]></Condition>
13+
<Condition Action="enable">LicenseAccepted = "1"</Condition>
14+
</Control>
15+
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
16+
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
17+
</Control>
18+
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
19+
<Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no">
20+
21+
22+
<Text SourceFile="./Resources/LICENSE.rtf" />
23+
24+
25+
</Control>
26+
<Control Id="Print" Type="PushButton" X="112" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)">
27+
<Publish Event="DoAction" Value="WixUIPrintEula">1</Publish>
28+
</Control>
29+
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
30+
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
31+
<Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgDescription)" />
32+
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgTitle)" />
33+
</Dialog>
34+
</UI>
35+
</Fragment>
36+
</Wix>
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
{\rtf1\ansi
2+
3+
\line Apache License
4+
\line Version 2.0, January 2004
5+
\line http://www.apache.org/licenses/
6+
\line
7+
\line TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8+
\line
9+
\line 1. Definitions.
10+
\line
11+
\line "License" shall mean the terms and conditions for use, reproduction,
12+
\line and distribution as defined by Sections 1 through 9 of this document.
13+
\line
14+
\line "Licensor" shall mean the copyright owner or entity authorized by
15+
\line the copyright owner that is granting the License.
16+
\line
17+
\line "Legal Entity" shall mean the union of the acting entity and all
18+
\line other entities that control, are controlled by, or are under common
19+
\line control with that entity. For the purposes of this definition,
20+
\line "control" means (i) the power, direct or indirect, to cause the
21+
\line direction or management of such entity, whether by contract or
22+
\line otherwise, or (ii) ownership of fifty percent (50%) or more of the
23+
\line outstanding shares, or (iii) beneficial ownership of such entity.
24+
\line
25+
\line "You" (or "Your") shall mean an individual or Legal Entity
26+
\line exercising permissions granted by this License.
27+
\line
28+
\line "Source" form shall mean the preferred form for making modifications,
29+
\line including but not limited to software source code, documentation
30+
\line source, and configuration files.
31+
\line
32+
\line "Object" form shall mean any form resulting from mechanical
33+
\line transformation or translation of a Source form, including but
34+
\line not limited to compiled object code, generated documentation,
35+
\line and conversions to other media types.
36+
\line
37+
\line "Work" shall mean the work of authorship, whether in Source or
38+
\line Object form, made available under the License, as indicated by a
39+
\line copyright notice that is included in or attached to the work
40+
\line (an example is provided in the Appendix below).
41+
\line
42+
\line "Derivative Works" shall mean any work, whether in Source or Object
43+
\line form, that is based on (or derived from) the Work and for which the
44+
\line editorial revisions, annotations, elaborations, or other modifications
45+
\line represent, as a whole, an original work of authorship. For the purposes
46+
\line of this License, Derivative Works shall not include works that remain
47+
\line separable from, or merely link (or bind by name) to the interfaces of,
48+
\line the Work and Derivative Works thereof.
49+
\line
50+
\line "Contribution" shall mean any work of authorship, including
51+
\line the original version of the Work and any modifications or additions
52+
\line to that Work or Derivative Works thereof, that is intentionally
53+
\line submitted to Licensor for inclusion in the Work by the copyright owner
54+
\line or by an individual or Legal Entity authorized to submit on behalf of
55+
\line the copyright owner. For the purposes of this definition, "submitted"
56+
\line means any form of electronic, verbal, or written communication sent
57+
\line to the Licensor or its representatives, including but not limited to
58+
\line communication on electronic mailing lists, source code control systems,
59+
\line and issue tracking systems that are managed by, or on behalf of, the
60+
\line Licensor for the purpose of discussing and improving the Work, but
61+
\line excluding communication that is conspicuously marked or otherwise
62+
\line designated in writing by the copyright owner as "Not a Contribution."
63+
\line
64+
\line "Contributor" shall mean Licensor and any individual or Legal Entity
65+
\line on behalf of whom a Contribution has been received by Licensor and
66+
\line subsequently incorporated within the Work.
67+
\line
68+
\line 2. Grant of Copyright License. Subject to the terms and conditions of
69+
\line this License, each Contributor hereby grants to You a perpetual,
70+
\line worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71+
\line copyright license to reproduce, prepare Derivative Works of,
72+
\line publicly display, publicly perform, sublicense, and distribute the
73+
\line Work and such Derivative Works in Source or Object form.
74+
\line
75+
\line 3. Grant of Patent License. Subject to the terms and conditions of
76+
\line this License, each Contributor hereby grants to You a perpetual,
77+
\line worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78+
\line (except as stated in this section) patent license to make, have made,
79+
\line use, offer to sell, sell, import, and otherwise transfer the Work,
80+
\line where such license applies only to those patent claims licensable
81+
\line by such Contributor that are necessarily infringed by their
82+
\line Contribution(s) alone or by combination of their Contribution(s)
83+
\line with the Work to which such Contribution(s) was submitted. If You
84+
\line institute patent litigation against any entity (including a
85+
\line cross-claim or counterclaim in a lawsuit) alleging that the Work
86+
\line or a Contribution incorporated within the Work constitutes direct
87+
\line or contributory patent infringement, then any patent licenses
88+
\line granted to You under this License for that Work shall terminate
89+
\line as of the date such litigation is filed.
90+
\line
91+
\line 4. Redistribution. You may reproduce and distribute copies of the
92+
\line Work or Derivative Works thereof in any medium, with or without
93+
\line modifications, and in Source or Object form, provided that You
94+
\line meet the following conditions:
95+
\line
96+
\line (a) You must give any other recipients of the Work or
97+
\line Derivative Works a copy of this License; and
98+
\line
99+
\line (b) You must cause any modified files to carry prominent notices
100+
\line stating that You changed the files; and
101+
\line
102+
\line (c) You must retain, in the Source form of any Derivative Works
103+
\line that You distribute, all copyright, patent, trademark, and
104+
\line attribution notices from the Source form of the Work,
105+
\line excluding those notices that do not pertain to any part of
106+
\line the Derivative Works; and
107+
\line
108+
\line (d) If the Work includes a "NOTICE" text file as part of its
109+
\line distribution, then any Derivative Works that You distribute must
110+
\line include a readable copy of the attribution notices contained
111+
\line within such NOTICE file, excluding those notices that do not
112+
\line pertain to any part of the Derivative Works, in at least one
113+
\line of the following places: within a NOTICE text file distributed
114+
\line as part of the Derivative Works; within the Source form or
115+
\line documentation, if provided along with the Derivative Works; or,
116+
\line within a display generated by the Derivative Works, if and
117+
\line wherever such third-party notices normally appear. The contents
118+
\line of the NOTICE file are for informational purposes only and
119+
\line do not modify the License. You may add Your own attribution
120+
\line notices within Derivative Works that You distribute, alongside
121+
\line or as an addendum to the NOTICE text from the Work, provided
122+
\line that such additional attribution notices cannot be construed
123+
\line as modifying the License.
124+
\line
125+
\line You may add Your own copyright statement to Your modifications and
126+
\line may provide additional or different license terms and conditions
127+
\line for use, reproduction, or distribution of Your modifications, or
128+
\line for any such Derivative Works as a whole, provided Your use,
129+
\line reproduction, and distribution of the Work otherwise complies with
130+
\line the conditions stated in this License.
131+
\line
132+
\line 5. Submission of Contributions. Unless You explicitly state otherwise,
133+
\line any Contribution intentionally submitted for inclusion in the Work
134+
\line by You to the Licensor shall be under the terms and conditions of
135+
\line this License, without any additional terms or conditions.
136+
\line Notwithstanding the above, nothing herein shall supersede or modify
137+
\line the terms of any separate license agreement you may have executed
138+
\line with Licensor regarding such Contributions.
139+
\line
140+
\line 6. Trademarks. This License does not grant permission to use the trade
141+
\line names, trademarks, service marks, or product names of the Licensor,
142+
\line except as required for reasonable and customary use in describing the
143+
\line origin of the Work and reproducing the content of the NOTICE file.
144+
\line
145+
\line 7. Disclaimer of Warranty. Unless required by applicable law or
146+
\line agreed to in writing, Licensor provides the Work (and each
147+
\line Contributor provides its Contributions) on an "AS IS" BASIS,
148+
\line WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149+
\line implied, including, without limitation, any warranties or conditions
150+
\line of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151+
\line PARTICULAR PURPOSE. You are solely responsible for determining the
152+
\line appropriateness of using or redistributing the Work and assume any
153+
\line risks associated with Your exercise of permissions under this License.
154+
\line
155+
\line 8. Limitation of Liability. In no event and under no legal theory,
156+
\line whether in tort (including negligence), contract, or otherwise,
157+
\line unless required by applicable law (such as deliberate and grossly
158+
\line negligent acts) or agreed to in writing, shall any Contributor be
159+
\line liable to You for damages, including any direct, indirect, special,
160+
\line incidental, or consequential damages of any character arising as a
161+
\line result of this License or out of the use or inability to use the
162+
\line Work (including but not limited to damages for loss of goodwill,
163+
\line work stoppage, computer failure or malfunction, or any and all
164+
\line other commercial damages or losses), even if such Contributor
165+
\line has been advised of the possibility of such damages.
166+
\line
167+
\line 9. Accepting Warranty or Additional Liability. While redistributing
168+
\line the Work or Derivative Works thereof, You may choose to offer,
169+
\line and charge a fee for, acceptance of support, warranty, indemnity,
170+
\line or other liability obligations and/or rights consistent with this
171+
\line License. However, in accepting such obligations, You may act only
172+
\line on Your own behalf and on Your sole responsibility, not on behalf
173+
\line of any other Contributor, and only if You agree to indemnify,
174+
\line defend, and hold each Contributor harmless for any liability
175+
\line incurred by, or claims asserted against, such Contributor by reason
176+
\line of your accepting any such warranty or additional liability.
177+
\line
178+
\line END OF TERMS AND CONDITIONS
179+
\line
180+
}
7.91 KB
Loading
6.03 KB
Loading
31.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)