summaryrefslogtreecommitdiffstats
path: root/build/wix/mixxx.wxs
blob: 6931b591ac6b7249f3c2a3bd059c5972920fed92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <!--
    Need some Wix resources ? See
    https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/
    https://www.firegiant.com/wix/tutorial/getting-started/
    https://msdn.microsoft.com/en-us/library/aa368269%28VS.85%29.aspx
    http://weblogs.sqlteam.com/mladenp/archive/2010/02/23/WiX-3-Tutorial-Generating-filedirectory-fragments-with-Heat.exe.aspx
    https://bitbucket.org/scons/scons/wiki/WiX_Tool
    http://blogs.technet.com/b/alexshev/archive/2008/02/10/from-msi-to-wix.aspx
    http://stackoverflow.com/questions/15305718/removing-unwanted-nodes-from-wxs-file-by-applying-xslt-tranfsormation/15306740#15306740
  -->

  <!--
    ====================================================================================
    Includes
  -->

  <?include ProductID.wxi ?>

  <!--
    ====================================================================================
    Defines & Variables
  -->

  <!-- Full version number to display -->
  <?define VersionNumber="!(bind.FileVersion.mixxxExe)" ?>

  <!--
  Upgrade code HAS to be the same for all updates.
  Once you've chosen it don't change it.
  !!! DO NOT REUSE IN ANY OTHER PROJECT !!!
  -->
  <?define UpgradeCode="921DC99C-4DCF-478D-B950-50685CB9E6BE" ?>

  <!-- The URL for add/remove programs -->
  <?define InfoURL="http://mixxx.org/" ?>

  <!-- 32-bit / 64-bit variables -->
  <?if $(var.Platform) = x64 ?>
    <?define Win64 = "yes" ?>
    <?define arch = "64" ?>
    <?define notarch = "32" ?>
    <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
    <?define baseBuildDir = "..\.." ?>
  <?else ?>
    <?define Win64 = "no" ?>
    <?define arch = "32" ?>
    <?define notarch = "64" ?>
    <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
    <?define baseBuildDir = "..\.." ?>
  <?endif ?>

  <?define SourceDir="$(var.baseBuildDir)\dist$(var.arch)"?>

  <!--
    ====================================================================================
    Package start
  -->

  <!-- The upgrade code must never change as long as the product lives! -->
  <!-- Product IDs must be autogenerated (*) or else major upgrades will not work -->
  <Product Id="$(var.ProductID)"
           Name="!(loc.ApplicationName)"
           Language="!(loc.Language)"
           Version="$(var.VersionNumber)"
           Manufacturer="!(loc.ManufacturerFullName)"
           UpgradeCode="$(var.UpgradeCode)" >

    <!-- Package IDs are valid for a single package version only - they are autogenerated by WiX -->
    <!-- Let's require Windows Installer 4.0 (included in Vista) -->
    <!-- And ALWAYS install per machine!!! -->
    <Package Id="*"
             Keywords="Installer"
             InstallerVersion="200"
             Compressed="yes"
             InstallScope="perMachine"
             Description="!(loc.ProductDescription)"
             Manufacturer="!(loc.ManufacturerFullName)"
             Comments="!(loc.Comments) $(var.VersionNumber)"
             Platform="$(var.Platform)" />

    <!-- Define icons (ID should not be longer than 18 chars and must end with ".exe") -->
    <Icon Id="Icon.exe" SourceFile="$(var.baseBuildDir)\res\images\ic_mixxx.ico" />
    <Icon Id="Manual.ico" SourceFile="images\manual.ico" />

    <!-- Set properties for add/remove programs -->
    <Property Id="ARPPRODUCTICON" Value="Icon.exe" />
    <Property Id="ARPHELPLINK" Value="$(var.InfoURL)" />
    <!-- Property Id="ARPNOREPAIR" Value="yes" Secure="yes" / -->      <!-- Remove repair -->
    <!-- Property Id="ARPNOMODIFY" Value="yes" Secure="yes" / -->      <!-- Remove modify -->

    <!-- Upgrade logic -->
    <!-- AllowSameVersionUpgrades -> Always upgrade, never allow two versions to be installed next to each other -->
    <!-- AllowSameVersionUpgrades causes ICE61 which must be ignored -->
    <MajorUpgrade DowngradeErrorMessage="!(loc.NewerInstalled)" AllowSameVersionUpgrades="yes" />

    <!--
      ====================================================================================
      Set Properties
    -->

    <!-- True if VC redistributables are installed -->
    <Property Id="VCREDISTINSTALLED">
      <?if $(var.Platform) = x86 ?>
        <RegistrySearch Id="VCRedistInstalledSearch"
                        Root="HKLM"
                        Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86"
                        Name="Installed"
                        Type="raw"
                        Win64="no" />
      <?else?>
        <RegistrySearch Id="VCRedistInstalledSearch"
                        Root="HKLM"
                        Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64"
                        Name="Installed"
                        Type="raw"
                        Win64="yes" />
      <?endif?>
    </Property>

    <!-- This will search if mixxx is already installed in another bitWidth -->
    <Property Id="OTHERBITWIDTHINSTALLED">
      <RegistrySearch Id="BitWidthInstalledSearch"
                      Root="HKLM"
                      Key="SOFTWARE\!(loc.ApplicationName)"
                      Name="installed$(var.notarch)"
                      Type="raw"
                      Win64="no" />
    </Property>

    <!-- Look for old mixxx installation <= 2.0 -->
    <Property Id="OLDERINSTALLEXISTS">
      <?if $(var.Platform) = x86 ?>
        <DirectorySearch Id="CheckFileDir" Path="[ProgramFilesFolder]\Mixxx">
          <FileSearch Id="CheckFile" Name="UninstallMixxx.exe" />
        </DirectorySearch>
      <?else?>
        <DirectorySearch Id="CheckFileDir" Path="[ProgramFiles64Folder]\Mixxx">
          <FileSearch Id="CheckFile" Name="UninstallMixxx.exe" />
        </DirectorySearch>
      <?endif?>
    </Property>

    <!-- This is the main installer sequence run when the product is actually installed -->
    <InstallExecuteSequence>

      <!-- Determine the install location after the install path has been validated by the installer -->
      <Custom Action="SetARPINSTALLLOCATION" After="InstallValidate" />

    </InstallExecuteSequence>

    <!--
      ====================================================================================
      Custom Actions
    -->

    <!-- Set up ARPINSTALLLOCATION property (http://blogs.technet.com/b/alexshev/archive/2008/02/09/from-msi-to-wix-part-2.aspx) -->
    <CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />

    <!-- Display XP warning -->
    <CustomAction Id="DisplayXPWarning" Script="vbscript">
      <![CDATA[
      Dim rec
      Set rec = Session.Installer.CreateRecord(1)
      rec.StringData(0) = "!(loc.XPWarning)"
      Session.Message &H02000030,rec
      ]]>
    </CustomAction>

    <!-- Display x86 version warning on 64 bits OS -->
    <CustomAction Id="Displayx86VersionWarning" Script="vbscript">
      <![CDATA[
      Dim rec
      Set rec = Session.Installer.CreateRecord(1)
      rec.StringData(0) = "!(loc.x86VersionWarning)"
      Session.Message &H02000030,rec
      ]]>
    </CustomAction>

    <!-- Display warning when installing another Mixxx bitwidth is already installed -->
    <?if $(var.Platform) = x86 ?>
    <CustomAction Id="DisplayBitWidthMismatchWarning" Script="vbscript">
      <![CDATA[
      Dim rec
      Set rec = Session.Installer.CreateRecord(1)
      rec.StringData(0) = "!(loc.bitWidthMismatch32)"
      Session.Message &H02000030,rec
      ]]>
    </CustomAction>
    <?else?>
    <!-- Display warning when installing another Mixxx bitwidth is already installed -->
    <CustomAction Id="DisplayBitWidthMismatchWarning" Script="vbscript">
      <![CDATA[
      Dim rec
      Set rec = Session.Installer.CreateRecord(1)
      rec.StringData(0) = "!(loc.bitWidthMismatch64)"
      Session.Message &H02000030,rec
      ]]>
    </CustomAction>
    <?endif?>

    <!-- License agreement -->
    <WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />

    <!--
      Launch conditions

      1. Check minimum OS version (601  = Windows 7)
         If not, the installation is aborted.
         By doing the (Installed OR ...) property means that this condition will only be evaluated if the app is being installed and not on uninstall or changing

        Note: Under a Product element, a condition becomes a LaunchCondition entry.

        When time will come to remove XP support, simply change 501 to 600 for vista or 601 for seven
        https://msdn.microsoft.com/en-us/library/aa370556%28v=vs.85%29.aspx
    -->

    <!-- minimum OS version check disabled for now because we do not want to enforce installing mixxx on older systems.
         Anyway, we display a warning message when installing on XP and below -->
    <Condition Message="!(loc.OS2Old)">
       <![CDATA[Installed OR (VersionNT >= 601)]]>
    </Condition>


    <!--
      2. Check OS bitness
         Unfortunately 32-bit MSI packages cannot write to 64-bit ProgramFiles directory. That is the only reason we need separate MSIs for 32-bit and 64-bit.
    -->
    <?if $(var.Platform) = x64 ?>
       <Condition Message="!(loc.x86VersionRequired)">
          <![CDATA[VersionNT64]]>
       </Condition>
    <?endif?>

    <!-- Commenting this out to allow installing 32bits Mixxx on a 64bits system. Is there a use-case for that ?
    <?if $(var.Platform) = x86 ?>
       <Condition Message="!(loc.x64VersionRequired)">
          <![CDATA[NOT VersionNT64]]>
       </Condition>
    <?endif?>
    -->

    <!-- Commenting this out to allow installing both 32bits and 64bits Mixxx on a 64bits system. Is there a use-case for that ?
    <?if $(var.Platform) = x86 ?>
    <Condition Message="!(loc.bitWidthMismatch32)">
      NOT OTHERBITWIDTHINSTALLED
    </Condition>
    <?else?>
    <Condition Message="!(loc.bitWidthMismatch64)">
      NOT OTHERBITWIDTHINSTALLED
    </Condition>
    <?endif?>
    -->

    <Condition Message="!(loc.OlderVersionFound)">NOT OLDERINSTALLEXISTS</Condition>

    <!--
      avoid installing if VC redistributables are not isntalled
      (usually not the case because they are installed before this MSI by the bootstrapper)
    -->
    <Condition Message="!(loc.VCredistNotFound)">VCREDISTINSTALLED</Condition>

    <!--
       Launch conditions end
    -->

    <!--
      ====================================================================================
      Start to build directory structure
    -->

    <!-- We do not have more than one medium (Floppy, CD, ...). Everything in one file. -->
    <Media Id="1" Cabinet="mixxx.cab" EmbedCab="yes" DiskPrompt='Mixxx install source #1' />
    <Property Id='DiskPrompt' Value="!(loc.ApplicationName) $(var.VersionNumber) Installation [1]" />

    <!-- Outermost folder (kind of virtual). Fixed entry. -->
    <Directory Id="TARGETDIR" Name="SourceDir">

      <Component Id="mixxxRegistry" Guid="*" Win64="no">
        <RegistryValue Root="HKLM" Key="SOFTWARE\!(loc.ApplicationName)" Type="string" Value='' KeyPath="yes" />
        <RegistryValue Root="HKLM" Key="SOFTWARE\!(loc.ApplicationName)" Name="installed" Type="integer" Value="1" />
        <RegistryValue Root="HKLM" Key="SOFTWARE\!(loc.ApplicationName)" Name="installed$(var.arch)" Type="integer" Value="1" />
      </Component>

      <!-- We start building our directory structure here -->
      <!-- "ProgramFilesFolder" is a variable containing the absolute path. -->
      <!-- For a list of folder variables, see: http://msdn.microsoft.com/en-us/library/aa372057%28VS.85%29.aspx -->
      <Directory Id="$(var.PlatformProgramFilesFolder)">

        <!-- All folders from here on are relative to their parent. -->

        <Directory Id="INSTALLDIR" Name="!(loc.ApplicationName)" FileSource="$(var.SourceDir)\">

          <!-- Define components, the building blocks of MSIs. -->
          <!-- Rule: A component should only contain items that belong together so strongly that they always need to be installed or removed together. -->
          <!-- If this means a single file, then your components will contain a single file each. This is not only normal but exactly what you're -->
          <!-- to do. Don't be afraid, Windows Installer can efficiently handle thousands of components or more, if needed. -->

          <!-- Main program file -->
          <Component Id="mixxx.exe_comp" Guid="*" Win64="$(var.Win64)">
            <File Source="$(var.SourceDir)\mixxx.exe" Id="mixxxExe" KeyPath="yes" DefaultLanguage="1033">
              <Shortcut Id="startmenuShortCut" Directory="ProgramMenuFolder" Name="!(loc.ApplicationName)"
                        WorkingDirectory='INSTALLDIR' Advertise="yes" Icon="Icon.exe" />
            </File>
            <RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\mixxx.exe" Value="[!mixxxExe]" Type="string" />
          </Component>

          <Component Id="LICENSE_comp" Guid="*" Win64="$(var.Win64)">
            <File Source="$(var.baseBuildDir)\LICENSE" Id="LicenceFile" KeyPath="yes" />
          </Component>

          <Component Id="COPYING_comp" Guid="*" Win64="$(var.Win64)">
            <File Source="$(var.baseBuildDir)\COPYING" Id="CopyingFile" KeyPath="yes" />
          </Component>

          <Component Id="README_comp" Guid="*" Win64="$(var.Win64)">
            <File Source="$(var.baseBuildDir)\README" Id="ReadmeFile" KeyPath="yes" />
          </Component>

          <!-- The Manual -->
          <Component Id="manual_comp" Guid="*" Win64="$(var.Win64)">
            <File Source="$(var.baseBuildDir)\Mixxx-Manual.pdf" Name='Mixxx-Manual.pdf' Id="manual_pdf" KeyPath="yes" />
          </Component>

          <?if $(var.Imageformats) = "yes" ?>
            <!-- QT's imageformats helper DLL. Files defined in imageformats.wxs generated by heat -->
            <Directory Id="imageformatsDir" Name="imageformats" />
          <?endif?>

          <!-- fonts. Files defined in fonts.wxs generated by heat -->
          <Directory Id="fontsDir" Name="fonts" />

          <!-- keyboard. Files defined in keyboard.wxs generated by heat -->
          <Directory Id="keyboardDir" Name="keyboard" />

          <!-- controller mappings. Files defined in controllers.wxs generated by heat -->
          <Directory Id="controllersDir" Name="controllers" />

          <!-- skins. Files defined in skins.wxs generated by heat -->
          <Directory Id="skinsDir" Name="skins" />

          <!-- translations. Files defined in translations.wxs generated by heat -->
          <Directory Id="translationsDir" Name="translations" />

        </Directory>
      </Directory>

      <!-- The windows program menu folder for our main shortcut -->
      <Directory Id="ProgramMenuFolder" Name="Programs" />

      <!-- The desktop folder, for desktop shortcut -->
      <Directory Id="DesktopFolder" Name="Desktop">
        <Component Id="DesktopShortcutComp" Guid="*">
          <Shortcut Id="desktopShortcut"
                    Name="!(loc.ApplicationName)"
                    Target="[!mixxxExe]"
                    WorkingDirectory="INSTALLDIR"/>
            <RemoveFolder Id="DesktopFolder" On="uninstall"/>
            <RegistryValue
                Root="HKCU"
                Key="Software\!(loc.ApplicationName)"
                Name="DesktopShortcut"
                Type="integer"
                Value="1"
                KeyPath="yes"/>
        </Component>
      </Directory>
    </Directory>

    <!--
       End of directory structure
       ====================================================================================
    -->

    <!-- Features define which parts of the application can be installed in a custom installation -->

    <!-- A feature block for the main (GUI) program and all its dependencies -->
    <Feature Id="MainProgram"
             Title="!(loc.FeatureMainProgramTitle)"
             Description="!(loc.FeatureMainProgramDescription)"
             AllowAdvertise='no'
             Absent='disallow'
             InstallDefault='local'
             Level="1"
             Display="expand">
      <ComponentRef Id='mixxx.exe_comp' />
      <ComponentRef Id='mixxxRegistry' />
      <ComponentGroupRef Id='mainDLLCompGroup' />
      <ComponentRef Id='LICENSE_comp' />
      <ComponentRef Id='COPYING_comp' />
      <ComponentRef Id='README_comp' />
      <?if $(var.Imageformats) = "yes" ?>
        <ComponentGroupRef Id='imageformatsComp' />
      <?endif?>
      <ComponentGroupRef Id='fontsComp' />
      <ComponentGroupRef Id='keyboardComp' />
      <ComponentGroupRef Id='controllersComp' />
      <ComponentGroupRef Id='skinsComp' />

      <?if $(var.PDB) = "yes" ?>
        <Feature Id="PDBFeature"
               Title="!(loc.FeaturePDBTitle)"
               Description="!(loc.FeaturePDBDescription)"
               AllowAdvertise='no'
               InstallDefault='local'
               Level="1">
          <ComponentGroupRef Id='mainPDBCompGroup' />
        </Feature>
      <?endif?>

      <Feature Id="DesktopShortcutFeature"
               Title="!(loc.FeatureDesktopShortcutTitle)"
               Description="!(loc.FeatureDesktopShortcutDescription)"
               AllowAdvertise='no'
               InstallDefault='local'
               Level="3">
        <ComponentRef Id="DesktopShortcutComp" />
      </Feature>

    </Feature>

    <!-- A feature block for translations -->
    <Feature Id="Translations"
             Title="!(loc.FeatureTranslationsTitle)"
             Description="!(loc.FeatureTranslationsDescription)"
             AllowAdvertise='no'
             InstallDefault='local'
             Level="1">
      <ComponentGroupRef Id='translationsComp' />
    </Feature>

    <!-- A feature block for the PDF manual -->
    <Feature Id="Manual"
             Title="!(loc.FeatureManualTitle)"
             Description="!(loc.FeatureManualDescription)"
             AllowAdvertise='no'
             InstallDefault='local'
             Level="1">
      <ComponentRef Id='manual_comp' />
    </Feature>

    <!-- Define the installer UI -->
    <UIRef Id="WixUI_FeatureTree" />
    <UIRef Id="WixUI_ErrorProgressText" />
    <WixVariable Id="WixUIBannerBmp" Value="images\banner.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="images\dialog.bmp" />

    <UI Id="MyWixUI_FeatureTree">
      <UIRef Id="WixUI_FeatureTree" />
      <UIRef Id="WixUI_ErrorProgressText" />

      <Publish Dialog="WelcomeDlg" Control="Next" Event="DoAction" Value="DisplayXPWarning"><![CDATA[VersionNT <= 501]]></Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="DoAction" Value="Displayx86VersionWarning">
          <?if $(var.Platform) = x86 ?> <!-- 32 bits PACKAGE -->
               <![CDATA[VersionNT64]]> <!-- true on 64 bits OS -->
          <?else?>
               <!-- Always false because we install a 64 bit package -->
               <![CDATA[3 = 2]]>
          <?endif?>
      </Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="DoAction" Value="DisplayBitWidthMismatchWarning">OTHERBITWIDTHINSTALLED</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>

    </UI>

  </Product>
</Wix>