]> git.lizzy.rs Git - rust.git/blob - src/etc/installer/msi/rust.wxs
Add an unstable FileTypeExt extension trait for Windows
[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                     <!-- tool-rls-start -->
174                     <Directory Id="Rls" Name="." />
175                     <Directory Id="Analysis" Name="." />
176                     <!-- tool-rls-end -->
177                 </Directory>
178             </Directory>
179
180             <!-- Record our install location -->
181             <Component Id="InstallDir" Guid="*">
182                 <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)"
183                                Type="string"
184                                Name="InstallDir"
185                                Value="[INSTALLDIR]" />
186             </Component>
187
188             <!-- Add $/bin to PATH -->
189             <Component Id="PathEnvPerMachine" Guid="*">
190                 <Condition>ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Condition>
191                 <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="PathEnvPerMachine" Type="string" Value="1" KeyPath="yes" />
192                 <!-- [INSTALLDIR] contains trailing backslash -->
193                 <Environment Id="PathPerMachine" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="last" Action="set" System="yes" />
194             </Component>
195             <Component Id="PathEnvPerUser" Guid="*">
196                 <Condition>ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Condition>
197                 <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="PathEnvPerUser" Type="string" Value="1" KeyPath="yes" />
198                 <Environment Id="PathPerUser" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="last" Action="set" System="no" />
199             </Component>
200
201             <!-- Start Menu shortcuts -->
202             <Directory Id="ProgramMenuFolder">
203                 <Directory Id="ApplicationProgramsFolder" Name="Rust">
204                     <Component Id="RustShellShortcut" Guid="*">
205                         <Shortcut Id="RustShell"
206                                   Name="$(var.ProductName) Shell"
207                                   Description="Opens Command Prompt with Rust tools directory added to the PATH"
208                                   Target="[SHORTCUTTARGET]"
209                                   Arguments="/K path [INSTALLDIR]bin;%PATH%"
210                                   WorkingDirectory="SHORTCUTWKDIR">
211                             <Icon Id="rust2.ico" SourceFile="rust-logo.ico" />
212                         </Shortcut>
213                         <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustShell" Type="integer" Value="1" KeyPath="yes" />
214                         <RemoveFolder Id="ApplicationProgramsFolder1" On="uninstall" />
215                     </Component>
216                     <Component Id="DocIndexShortcut" Guid="*">
217                         <Shortcut Id="RustDocs"
218                                   Name="$(var.ProductName) Documentation"
219                                   Description="Opens Rust HTML documentation in the default browser"
220                                   Target="[INSTALLDIR]share\doc\rust\html\index.html" />
221                         <RegistryValue Root="HKMU" Key="$(var.BaseRegKey)" Name="RustDocs" Type="integer" Value="1" KeyPath="yes" />
222                         <RemoveFolder Id="ApplicationProgramsFolder2" On="uninstall" />
223                     </Component>
224                 </Directory>
225             </Directory>
226
227         </Directory>
228
229         <Feature Id="Rustc"
230                  Title="Rust compiler and standard crates"
231                  Display="1"
232                  Level="1"
233                  Absent="disallow"
234                  AllowAdvertise="no">
235                  <ComponentGroupRef Id="RustcGroup" />
236                  <ComponentRef Id="RustShellShortcut" />
237                  <ComponentRef Id="InstallDir" />
238         </Feature>
239         <Feature Id="Std"
240                  Title="The Rust standard library"
241                  Display="2"
242                  Level="1"
243                  AllowAdvertise="no">
244                  <ComponentGroupRef Id="StdGroup" />
245         </Feature>
246         <Feature Id="Cargo"
247                  Title="Cargo, the Rust package manager"
248                  Display="3"
249                  Level="1"
250                  AllowAdvertise="no">
251                  <ComponentGroupRef Id="CargoGroup" />
252         </Feature>
253         <?if $(env.CFG_MINGW)="1" ?>
254             <Feature Id="Gcc"
255                      Title="Linker and platform libraries"
256                      Description="If you choose to not install this component, you will require an external MinGW installation in order to create executables and libraries."
257                      Display="4"
258                      Level="1"
259                      AllowAdvertise="no">
260                      <ComponentGroupRef Id="GccGroup" />
261             </Feature>
262         <?endif?>
263         <Feature Id="Docs"
264                  Title="HTML documentation"
265                  Display="5"
266                  Level="1"
267                  AllowAdvertise="no">
268                  <ComponentGroupRef Id="DocsGroup" />
269                  <ComponentRef Id="DocIndexShortcut" />
270         </Feature>
271         <Feature Id="Path"
272                  Title="Add to PATH"
273                  Description="Add Rust to PATH environment variable"
274                  Display="6"
275                  Level="1"
276                  AllowAdvertise="no">
277                  <ComponentRef Id="PathEnvPerMachine" />
278                  <ComponentRef Id="PathEnvPerUser" />
279         </Feature>
280         <!-- tool-rls-start -->
281         <Feature Id="RLS"
282                  Title="RLS, the Rust Language Server"
283                  Display="7"
284                  Level="2"
285                  AllowAdvertise="no">
286                  <ComponentGroupRef Id="RlsGroup" />
287                  <ComponentGroupRef Id="AnalysisGroup" />
288         </Feature>
289         <!-- tool-rls-end -->
290
291         <UIRef Id="RustUI" />
292     </Product>
293 </Wix>