Show More
@@ -135,9 +135,13 b'' | |||||
135 | <UIRef Id="WixUI_FeatureTree" /> |
|
135 | <UIRef Id="WixUI_FeatureTree" /> | |
136 | <UIRef Id="WixUI_ErrorProgressText" /> |
|
136 | <UIRef Id="WixUI_ErrorProgressText" /> | |
137 |
|
137 | |||
|
138 | <?ifdef PyOxidizer?> | |||
|
139 | <WixVariable Id="WixUILicenseRtf" Value="COPYING.rtf" /> | |||
|
140 | <Icon Id="hgIcon.ico" SourceFile="mercurial.ico" /> | |||
|
141 | <?else?> | |||
138 | <WixVariable Id="WixUILicenseRtf" Value="contrib\packaging\wix\COPYING.rtf" /> |
|
142 | <WixVariable Id="WixUILicenseRtf" Value="contrib\packaging\wix\COPYING.rtf" /> | |
139 |
|
||||
140 | <Icon Id="hgIcon.ico" SourceFile="contrib/win32/mercurial.ico" /> |
|
143 | <Icon Id="hgIcon.ico" SourceFile="contrib/win32/mercurial.ico" /> | |
|
144 | <?endif?> | |||
141 |
|
145 | |||
142 | <Upgrade Id='$(var.ProductUpgradeCode)'> |
|
146 | <Upgrade Id='$(var.ProductUpgradeCode)'> | |
143 | <UpgradeVersion |
|
147 | <UpgradeVersion |
@@ -1,5 +1,20 b'' | |||||
|
1 | # The following variables can be passed in as parameters: | |||
|
2 | # | |||
|
3 | # VERSION | |||
|
4 | # Version string of program being produced. | |||
|
5 | # | |||
|
6 | # MSI_NAME | |||
|
7 | # Root name of MSI installer. | |||
|
8 | # | |||
|
9 | # EXTRA_MSI_FEATURES | |||
|
10 | # ; delimited string of extra features to advertise in the built MSA. | |||
|
11 | ||||
1 | ROOT = CWD + "/../.." |
|
12 | ROOT = CWD + "/../.." | |
2 |
|
13 | |||
|
14 | VERSION = VARS.get("VERSION", "5.8") | |||
|
15 | MSI_NAME = VARS.get("MSI_NAME", "mercurial") | |||
|
16 | EXTRA_MSI_FEATURES = VARS.get("EXTRA_MSI_FEATURES") | |||
|
17 | ||||
3 | IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE |
|
18 | IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE | |
4 |
|
19 | |||
5 | # Code to run in Python interpreter. |
|
20 | # Code to run in Python interpreter. | |
@@ -80,8 +95,144 b' def make_manifest(dist, exe):' | |||||
80 |
|
95 | |||
81 | return m |
|
96 | return m | |
82 |
|
97 | |||
|
98 | ||||
|
99 | # This adjusts the InstallManifest produced from exe generation to provide | |||
|
100 | # additional files found in a Windows install layout. | |||
|
101 | def make_windows_install_layout(manifest): | |||
|
102 | # Copy various files to new install locations. This can go away once | |||
|
103 | # we're using the importlib resource reader. | |||
|
104 | RECURSIVE_COPIES = { | |||
|
105 | "lib/mercurial/locale/": "locale/", | |||
|
106 | "lib/mercurial/templates/": "templates/", | |||
|
107 | } | |||
|
108 | for (search, replace) in RECURSIVE_COPIES.items(): | |||
|
109 | for path in manifest.paths(): | |||
|
110 | if path.startswith(search): | |||
|
111 | new_path = path.replace(search, replace) | |||
|
112 | print("copy %s to %s" % (path, new_path)) | |||
|
113 | file = manifest.get_file(path) | |||
|
114 | manifest.add_file(file, path = new_path) | |||
|
115 | ||||
|
116 | # Similar to above, but with filename pattern matching. | |||
|
117 | # lib/mercurial/helptext/**/*.txt -> helptext/ | |||
|
118 | # lib/mercurial/defaultrc/*.rc -> defaultrc/ | |||
|
119 | for path in manifest.paths(): | |||
|
120 | if path.startswith("lib/mercurial/helptext/") and path.endswith(".txt"): | |||
|
121 | new_path = path[len("lib/mercurial/"):] | |||
|
122 | elif path.startswith("lib/mercurial/defaultrc/") and path.endswith(".rc"): | |||
|
123 | new_path = path[len("lib/mercurial/"):] | |||
|
124 | else: | |||
|
125 | continue | |||
|
126 | ||||
|
127 | print("copying %s to %s" % (path, new_path)) | |||
|
128 | manifest.add_file(manifest.get_file(path), path = new_path) | |||
|
129 | ||||
|
130 | # We also install a handful of additional files. | |||
|
131 | EXTRA_CONTRIB_FILES = [ | |||
|
132 | "bash_completion", | |||
|
133 | "hgweb.fcgi", | |||
|
134 | "hgweb.wsgi", | |||
|
135 | "logo-droplets.svg", | |||
|
136 | "mercurial.el", | |||
|
137 | "mq.el", | |||
|
138 | "tcsh_completion", | |||
|
139 | "tcsh_completion_build.sh", | |||
|
140 | "xml.rnc", | |||
|
141 | "zsh_completion", | |||
|
142 | ] | |||
|
143 | ||||
|
144 | for f in EXTRA_CONTRIB_FILES: | |||
|
145 | manifest.add_file(FileContent(path = ROOT + "/contrib/" + f), directory = "contrib") | |||
|
146 | ||||
|
147 | # Individual files with full source to destination path mapping. | |||
|
148 | EXTRA_FILES = { | |||
|
149 | "contrib/hgk": "contrib/hgk.tcl", | |||
|
150 | "contrib/win32/postinstall.txt": "ReleaseNotes.txt", | |||
|
151 | "contrib/win32/ReadMe.html": "ReadMe.html", | |||
|
152 | "doc/style.css": "doc/style.css", | |||
|
153 | "COPYING": "Copying.txt", | |||
|
154 | } | |||
|
155 | ||||
|
156 | for source, dest in EXTRA_FILES.items(): | |||
|
157 | print("adding extra file %s" % dest) | |||
|
158 | manifest.add_file(FileContent(path = ROOT + "/" + source), path = dest) | |||
|
159 | ||||
|
160 | # And finally some wildcard matches. | |||
|
161 | manifest.add_manifest(glob( | |||
|
162 | include = [ROOT + "/contrib/vim/*"], | |||
|
163 | strip_prefix = ROOT + "/" | |||
|
164 | )) | |||
|
165 | manifest.add_manifest(glob( | |||
|
166 | include = [ROOT + "/doc/*.html"], | |||
|
167 | strip_prefix = ROOT + "/" | |||
|
168 | )) | |||
|
169 | ||||
|
170 | # But we don't ship hg-ssh on Windows, so exclude its documentation. | |||
|
171 | manifest.remove("doc/hg-ssh.8.html") | |||
|
172 | ||||
|
173 | return manifest | |||
|
174 | ||||
|
175 | ||||
|
176 | def make_msi(manifest): | |||
|
177 | manifest = make_windows_install_layout(manifest) | |||
|
178 | ||||
|
179 | if "x86_64" in BUILD_TARGET_TRIPLE: | |||
|
180 | platform = "x64" | |||
|
181 | else: | |||
|
182 | platform = "x86" | |||
|
183 | ||||
|
184 | manifest.add_file( | |||
|
185 | FileContent(path = ROOT + "/contrib/packaging/wix/COPYING.rtf"), | |||
|
186 | path = "COPYING.rtf", | |||
|
187 | ) | |||
|
188 | manifest.remove("Copying.txt") | |||
|
189 | manifest.add_file( | |||
|
190 | FileContent(path = ROOT + "/contrib/win32/mercurial.ini"), | |||
|
191 | path = "defaultrc/mercurial.rc", | |||
|
192 | ) | |||
|
193 | manifest.add_file( | |||
|
194 | FileContent(filename = "editor.rc", content = "[ui]\neditor = notepad\n"), | |||
|
195 | path = "defaultrc/editor.rc", | |||
|
196 | ) | |||
|
197 | ||||
|
198 | wix = WiXInstaller("hg", "%s-%s.msi" % (MSI_NAME, VERSION)) | |||
|
199 | ||||
|
200 | # Materialize files in the manifest to the install layout. | |||
|
201 | wix.add_install_files(manifest) | |||
|
202 | ||||
|
203 | # From mercurial.wxs. | |||
|
204 | wix.install_files_root_directory_id = "INSTALLDIR" | |||
|
205 | ||||
|
206 | # Pull in our custom .wxs files. | |||
|
207 | defines = { | |||
|
208 | "PyOxidizer": "1", | |||
|
209 | "Platform": platform, | |||
|
210 | "Version": VERSION, | |||
|
211 | "Comments": "Installs Mercurial version %s" % VERSION, | |||
|
212 | "PythonVersion": "3", | |||
|
213 | "MercurialHasLib": "1", | |||
|
214 | } | |||
|
215 | ||||
|
216 | if EXTRA_MSI_FEATURES: | |||
|
217 | defines["MercurialExtraFeatures"] = EXTRA_MSI_FEATURES | |||
|
218 | ||||
|
219 | wix.add_wxs_file( | |||
|
220 | ROOT + "/contrib/packaging/wix/mercurial.wxs", | |||
|
221 | preprocessor_parameters=defines, | |||
|
222 | ) | |||
|
223 | ||||
|
224 | # Our .wxs references to other files. Pull those into the build environment. | |||
|
225 | for f in ("defines.wxi", "guids.wxi", "COPYING.rtf"): | |||
|
226 | wix.add_build_file(f, ROOT + "/contrib/packaging/wix/" + f) | |||
|
227 | ||||
|
228 | wix.add_build_file("mercurial.ico", ROOT + "/contrib/win32/mercurial.ico") | |||
|
229 | ||||
|
230 | return wix | |||
|
231 | ||||
|
232 | ||||
83 | register_target("distribution", make_distribution) |
|
233 | register_target("distribution", make_distribution) | |
84 | register_target("exe", make_exe, depends = ["distribution"]) |
|
234 | register_target("exe", make_exe, depends = ["distribution"]) | |
85 | register_target("app", make_manifest, depends = ["distribution", "exe"], default = True) |
|
235 | register_target("app", make_manifest, depends = ["distribution", "exe"], default = True) | |
|
236 | register_target("msi", make_msi, depends = ["app"]) | |||
86 |
|
237 | |||
87 | resolve_targets() |
|
238 | resolve_targets() |
General Comments 0
You need to be logged in to leave comments.
Login now