]> git.lizzy.rs Git - rust.git/blob - src/etc/installer/msi/rust.wxs
258291cbb72e1e2d9ab4b8dabf78ee8e8d5698df
[rust.git] / src / etc / installer / msi / rust.wxs
1 <?xml version="1.0"?>
2 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3
4     <?if $(sys.BUILDARCH)="x64" ?>
5         <?define ArchSuffix=" 64-bit" ?>
6     <?else?>
7         <?define ArchSuffix="" ?>
8     <?endif?>
9
10     <?if $(env.CFG_CHANNEL)="stable" ?>
11         <?define ProductName="Rust $(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR) ($(env.CFG_ABI)$(var.ArchSuffix))" ?>
12     <?else?>
13         <?define ProductName="Rust $(env.CFG_CHANNEL) $(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR) ($(env.CFG_ABI)$(var.ArchSuffix))" ?>
14     <?endif?>
15
16     <?define BaseRegKey="Software\[Manufacturer]\Rust $(env.CFG_CHANNEL) ($(env.CFG_ABI)$(var.ArchSuffix))\$(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR)" ?>
17
18     <!-- Upgrade code should be different for each platform -->
19     <?if $(sys.BUILDARCH)="x64" ?>
20         <?if $(env.CFG_ABI)="GNU" ?>
21             <!-- UpgradeCode shoud stay the same for all MSI versions in channel -->
22             <?if $(env.CFG_CHANNEL)="stable" ?>
23                 <?define UpgradeCode="B440B077-F8D1-4730-8E1D-D6D37702B4CE" ?>
24             <?elseif $(env.CFG_CHANNEL)="beta" ?>
25                 <?define UpgradeCode="7205CEDC-CDA6-4B62-8E4E-4D19EC5D88FC" ?>
26             <?elseif $(env.CFG_CHANNEL)="nightly" ?>
27                 <?define UpgradeCode="622497D9-E0B1-448E-838A-4A33D0C5F82C" ?>
28             <?elseif $(env.CFG_CHANNEL)="dev" ?>
29                 <?define UpgradeCode="7D32FD99-BB26-45CF-935D-1B0593BBDDBE" ?>
30             <?endif ?>
31         <?elseif $(env.CFG_ABI)="MSVC" ?>
32             <?if $(env.CFG_CHANNEL)="stable" ?>
33                 <?define UpgradeCode="123039F9-68E3-44F1-AC9F-C78ADD4D0723" ?>
34             <?elseif $(env.CFG_CHANNEL)="beta" ?>
35                 <?define UpgradeCode="ABC640B9-2AB5-4270-9A0D-E54E502A1CCA" ?>
36             <?elseif $(env.CFG_CHANNEL)="nightly" ?>
37                 <?define UpgradeCode="56263F12-4AA1-4FE1-AFAE-572915C4FA3E" ?>
38             <?elseif $(env.CFG_CHANNEL)="dev" ?>
39                 <?define UpgradeCode="231A9544-7E39-4A60-A069-0EB3CA4BAB2E" ?>
40             <?endif ?>
41         <?endif ?>
42         <?define PlatformProgramFilesFolder="ProgramFiles64Folder" ?>
43     <?elseif $(sys.BUILDARCH)="x86" ?>
44         <?if $(env.CFG_ABI)="GNU" ?>
45             <?if $(env.CFG_CHANNEL)="stable" ?>
46                 <?define UpgradeCode="1C7CADA5-D117-43F8-A356-DF15F9FBEFF6" ?>
47             <?elseif $(env.CFG_CHANNEL)="beta" ?>
48                 <?define UpgradeCode="5229EAC1-AB7C-4A62-9881-6FAD2DE7D0F9" ?>
49             <?elseif $(env.CFG_CHANNEL)="nightly" ?>
50                 <?define UpgradeCode="B94FF1C2-2C7B-4859-A08B-546815516FDA" ?>
51             <?elseif $(env.CFG_CHANNEL)="dev" ?>
52                 <?define UpgradeCode="7E6D1349-2773-4792-B8CD-EA2685D86A99" ?>
53             <?endif ?>
54         <?elseif $(env.CFG_ABI)="MSVC" ?>
55             <?if $(env.CFG_CHANNEL)="stable" ?>
56                 <?define UpgradeCode="5805719C-45E9-4CF6-9CE7-1E8B57F3C243" ?>
57             <?elseif $(env.CFG_CHANNEL)="beta" ?>
58                 <?define UpgradeCode="BC0731C1-BED1-424C-BE99-3589C35C84DE" ?>
59             <?elseif $(env.CFG_CHANNEL)="nightly" ?>
60                 <?define UpgradeCode="FF193BBC-E73B-4FBD-ADE0-12F3CFC84145" ?>
61             <?elseif $(env.CFG_CHANNEL)="dev" ?>
62                 <?define UpgradeCode="87DFC303-6492-4E9B-911E-56EAD56C5E58" ?>
63             <?endif ?>
64         <?endif ?>
65         <?define PlatformProgramFilesFolder="ProgramFilesFolder" ?>
66     <?else ?>
67         <?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
68     <?endif ?>
69
70     <Product Id="*"
71         Name="$(var.ProductName)"
72         Language="1033"
73         Version="$(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR).$(env.CFG_VER_PATCH).$(env.CFG_VER_BUILD)"
74         UpgradeCode="$(var.UpgradeCode)"
75         Manufacturer="The Rust Project Developers">
76         <Package
77             Comments="Rust is a systems programming language that runs blazingly fast, prevents almost all crashes, and eliminates data races."
78             InstallerVersion="200"
79             InstallPrivileges="elevated"
80             Compressed="yes" />
81
82         <Icon Id="rust.ico" SourceFile="rust-logo.ico" />
83         <Property Id="ApplicationFolderName" Value="Rust $(env.CFG_CHANNEL) $(env.CFG_ABI) $(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR)" />
84         <Property Id="WixAppFolder" Value="WixPerMachineFolder" />
85         <Property Id="ARPPRODUCTICON" Value="rust.ico" />
86         <Property Id="ARPURLINFOABOUT" Value="https://www.rust-lang.org/" />
87         <Property Id="ARPCOMMENTS" Value="$(env.CFG_RELEASE_INFO)" />
88         <!-- This is a dual-mode package. http://msdn.microsoft.com/en-us/library/windows/desktop/dd408068.aspx -->
89         <Property Id="ALLUSERS" Value="2" Secure="yes" />
90         <Property Id="MSIINSTALLPERUSER" Secure="yes" />
91         <!-- The actual install location (initialized below) -->
92         <Property Id="INSTALLDIR" Secure="yes" />
93
94         <!-- Detect path(s) of a previous installation. -->
95         <Property Id="INSTALLDIR_USER">
96             <RegistrySearch Id="InstallDir_User" Type="raw" Root="HKCU" Key="$(var.BaseRegKey)" Name="InstallDir" />
97         </Property>
98         <Property Id="INSTALLDIR_MACHINE">
99             <RegistrySearch Id="InstallDir_Mach" Type="raw" Root="HKLM" Key="$(var.BaseRegKey)" Name="InstallDir" />
100         </Property>
101
102         <!-- Set ALLUSERS to match the previous installation mode, otherwise FindRelatedProducts will ignore
103              the previous installation. If both INSTALLDIR_USER and INSTALLDIR_MACHINE are set, prefer the former. -->
104         <SetProperty Sequence="first" Before="FindRelatedProducts"
105             Id="ALLUSERS" Value="{}">INSTALLDIR_USER</SetProperty>
106
107         <!-- Set default values if RegSearch found nothing, or if we not upgrading -->
108         <SetProperty Sequence="both" Before="SetINSTALLDIR1"
109             Id="INSTALLDIR_USER" Value="[LocalAppDataFolder]Programs\[ApplicationFolderName]">NOT INSTALLDIR_USER</SetProperty>
110         <SetProperty Sequence="both" Before="SetINSTALLDIR1"
111             Id="INSTALLDIR_MACHINE" Value="[$(var.PlatformProgramFilesFolder)][ApplicationFolderName]">NOT INSTALLDIR_MACHINE</SetProperty>
112
113         <!-- Choose the default install location according to ALLUSERS (unless set from the command line) -->
114         <SetProperty Sequence="both" Action="SetINSTALLDIR1" Before="SetINSTALLDIR2"
115             Id="INSTALLDIR" Value="[INSTALLDIR_USER]">NOT INSTALLDIR AND NOT ALLUSERS</SetProperty>
116         <SetProperty Sequence="both" Action="SetINSTALLDIR2" Before="CostFinalize"
117             Id="INSTALLDIR" Value="[INSTALLDIR_MACHINE]">NOT INSTALLDIR AND ALLUSERS</SetProperty>
118
119         <SetProperty Sequence="ui" Before="CostFinalize"
120             Id="WixAppFolder" Value="WixPerUserFolder">NOT ALLUSERS</SetProperty>
121
122         <!-- UI sets ALLUSERS per user selection; progagate this choice to MSIINSTALLPERUSER before executing installation actions -->
123         <SetProperty Sequence="ui" Before="ExecuteAction"
124             Id="MSIINSTALLPERUSER" Value="1">NOT ALLUSERS</SetProperty>
125
126         <!-- Update ARPINSTALLLOCATION to match INSTALLDIR -->
127         <SetProperty Sequence="execute" Before="CostFinalize"
128             Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
129
130         <!-- Path of cmd.exe for the shortcut -->
131         <Property Id="SHORTCUTTARGET" Value="%windir%\System32\cmd.exe" />
132         <!-- Microsoft Installer will resolve any Enviroment Variables in the working directory at install time -->
133         <Property Id="SHORTCUTWKDIR" Value="%SystemDrive%\" />
134
135         <InstallUISequence>
136             <FindRelatedProducts After="AppSearch" />
137         </InstallUISequence>
138         <InstallExecuteSequence>
139             <FindRelatedProducts After="AppSearch" />
140             <RemoveExistingProducts Before="InstallInitialize" />
141         </InstallExecuteSequence>
142
143         <Upgrade Id="$(var.UpgradeCode)">
144             <UpgradeVersion
145                 Minimum="$(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR).0"
146                 Maximum="$(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR).65535"
147                 IncludeMinimum="yes"
148                 IncludeMaximum="yes"
149                 MigrateFeatures="yes"
150                 Property="UPGRADE_DETECTED"
151                 />
152         </Upgrade>
153
154         <!-- Specifies a single cab file to be embedded in the installer's .msi. -->
155         <MediaTemplate EmbedCab="yes" CompressionLevel="high" />
156
157         <!-- Send a WM_SETTINGCHANGE message to tell processes like explorer to update their
158              environments so any new command prompts get the updated %PATH% -->
159         <CustomActionRef Id="WixBroadcastEnvironmentChange" />
160
161         <!-- Installation directory and files are defined in Files.wxs -->
162         <Directory Id="TARGETDIR" Name="SourceDir">
163             <Directory Id="$(var.PlatformProgramFilesFolder)">
164                 <Directory Id="INSTALLDIR" Name="Rust">
165                     <!-- Root directories for every feature should have different IDs for correct work of heat.exe -->
166                     <Directory Id="Rustc" Name="." />
167                     <?if $(env.CFG_MINGW)="1" ?>
168                         <Directory Id="Gcc" Name="." />
169                     <?endif?>
170                     <Directory Id="Docs" Name="." />
171                     <Directory Id="Cargo" Name="." />
172                     <Directory Id="Std" Name="." />
173                     <Directory Id="Rls" Name="." />
174                     <Directory Id="Analysis" Name="." />
175                 </Directory>
176             </Directory>
177
178             <!-- Record our install location -->
179             <Component Id="InstallDir" Guid="*">
180                 <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)"
181                                Type="string"
182                                Name="InstallDir"
183                                Value="[INSTALLDIR]" />
184             </Component>
185
186             <!-- Add $/bin to PATH -->
187             <Component Id="PathEnvPerMachine" Guid="*">
188                 <Condition>ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Condition>
189                 <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="PathEnvPerMachine" Type="string" Value="1" KeyPath="yes" />
190                 <!-- [INSTALLDIR] contains trailing backslash -->
191                 <Environment Id="PathPerMachine" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="last" Action="set" System="yes" />
192             </Component>
193             <Component Id="PathEnvPerUser" Guid="*">
194                 <Condition>ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Condition>
195                 <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="PathEnvPerUser" Type="string" Value="1" KeyPath="yes" />
196                 <Environment Id="PathPerUser" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="last" Action="set" System="no" />
197             </Component>
198
199             <!-- Start Menu shortcuts -->
200             <Directory Id="ProgramMenuFolder">
201                 <Directory Id="ApplicationProgramsFolder" Name="Rust">
202                     <Component Id="RustShellShortcut" Guid="*">
203                         <Shortcut Id="RustShell"
204                                   Name="$(var.ProductName) Shell"
205                                   Description="Opens Command Prompt with Rust tools directory added to the PATH"
206                                   Target="[SHORTCUTTARGET]"
207                                   Arguments="/K path [INSTALLDIR]bin;%PATH%"
208                                   WorkingDirectory="SHORTCUTWKDIR">
209                             <Icon Id="rust2.ico" SourceFile="rust-logo.ico" />
210                         </Shortcut>
211                         <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustShell" Type="integer" Value="1" KeyPath="yes" />
212                         <RemoveFolder Id="ApplicationProgramsFolder1" On="uninstall" />
213                     </Component>
214                     <Component Id="DocIndexShortcut" Guid="*">
215                         <Shortcut Id="RustDocs"
216                                   Name="$(var.ProductName) Documentation"
217                                   Description="Opens Rust HTML documentation in the default browser"
218                                   Target="[INSTALLDIR]share\doc\rust\html\index.html" />
219                         <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustDocs" Type="integer" Value="1" KeyPath="yes" />
220                         <RemoveFolder Id="ApplicationProgramsFolder2" On="uninstall" />
221                     </Component>
222                 </Directory>
223             </Directory>
224
225         </Directory>
226
227         <Feature Id="Rustc"
228                  Title="Rust compiler and standard crates"
229                  Display="1"
230                  Level="1"
231                  Absent="disallow"
232                  AllowAdvertise="no">
233                  <ComponentGroupRef Id="RustcGroup" />
234                  <ComponentRef Id="RustShellShortcut" />
235                  <ComponentRef Id="InstallDir" />
236         </Feature>
237         <Feature Id="Std"
238                  Title="The Rust standard library"
239                  Display="2"
240                  Level="1"
241                  AllowAdvertise="no">
242                  <ComponentGroupRef Id="StdGroup" />
243         </Feature>
244         <Feature Id="Cargo"
245                  Title="Cargo, the Rust package manager"
246                  Display="3"
247                  Level="1"
248                  AllowAdvertise="no">
249                  <ComponentGroupRef Id="CargoGroup" />
250         </Feature>
251         <?if $(env.CFG_MINGW)="1" ?>
252             <Feature Id="Gcc"
253                      Title="Linker and platform libraries"
254                      Description="If you choose to not install this component, you will require an external MinGW installation in order to create executables and libraries."
255                      Display="4"
256                      Level="1"
257                      AllowAdvertise="no">
258                      <ComponentGroupRef Id="GccGroup" />
259             </Feature>
260         <?endif?>
261         <Feature Id="Docs"
262                  Title="HTML documentation"
263                  Display="5"
264                  Level="1"
265                  AllowAdvertise="no">
266                  <ComponentGroupRef Id="DocsGroup" />
267                  <ComponentRef Id="DocIndexShortcut" />
268         </Feature>
269         <Feature Id="Path"
270                  Title="Add to PATH"
271                  Description="Add Rust to PATH environment variable"
272                  Display="6"
273                  Level="1"
274                  AllowAdvertise="no">
275                  <ComponentRef Id="PathEnvPerMachine" />
276                  <ComponentRef Id="PathEnvPerUser" />
277         </Feature>
278         <Feature Id="RLS"
279                  Title="RLS, the Rust Language Server"
280                  Display="7"
281                  Level="2"
282                  AllowAdvertise="no">
283                  <ComponentGroupRef Id="RlsGroup" />
284                  <ComponentGroupRef Id="AnalysisGroup" />
285         </Feature>
286
287         <UIRef Id="RustUI" />
288     </Product>
289 </Wix>