OXYGENHUB
◆ main openmsx / build / package-windows / openmsx.wxs
11.8 KiB · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
<?xml version="1.0"?>
2
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
3
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
4
5
  <!-- Some useful local variables -->
6
  <?define ProductVersion=$(env.OPENMSX_VERSION) ?>
7
  <?define LastNonMSIProductVersion=0.6.0.0 ?>
8
  <?define MinInstallerVersion=200 ?>
9
  <?if $(sys.BUILDARCH)=x86 ?>
10
    <?define ProductName=!(loc.openMSX) ?>
11
    <?define ProgramFilesFolderNative=ProgramFilesFolder ?>
12
    <?define UpgradeCode=9e38eab5-7a1c-4b43-ae24-c2152a4018f1 ?>
13
  <?else?>
14
    <?define ProductName=!(loc.openMSX) (64-bit) ?>
15
    <?define ProgramFilesFolderNative=ProgramFiles64Folder ?>
16
    <?define UpgradeCode=c7bd4b4d-1307-4a0d-b3f8-69744c7e5801 ?>
17
  <?endif?>
18
19
  <!-- To keep things simple, our installer considers each new release
20
       a major upgrade, so we change the Product Id on every build -->
21
  <Product Id="*"
22
           UpgradeCode="$(var.UpgradeCode)"
23
           Name="$(var.ProductName)"
24
           Language="!(loc.LANG)"
25
           Version="$(var.ProductVersion)"
26
           Manufacturer="!(loc.openMSX)">
27
28
    <!-- Package Ids change on every build by definition -->
29
    <Package Id="*"
30
             Platform="$(sys.BUILDARCH)"
31
             Description="$(var.ProductName)"
32
             InstallerVersion="$(var.MinInstallerVersion)"
33
             Compressed="yes" />
34
35
    <!-- Icon used in the control panel -->
36
    <Icon Id="openMSXIcon" SourceFile="$(env.OPENMSX_ICON_PATH)"/>
37
38
    <!-- Populate useful control panel fields -->
39
    <?include ControlPanel.wxi ?>
40
41
    <!--
42
      Upgrade handling
43
      -->
44
45
    <Upgrade Id="$(var.UpgradeCode)">
46
      <UpgradeVersion Minimum="$(var.ProductVersion)"
47
                  IncludeMinimum="no"
48
                  OnlyDetect="yes"
49
                  Language="!(loc.LANG)"
50
                  Property="NEWPRODUCTFOUND" />
51
      <UpgradeVersion Minimum="$(var.LastNonMSIProductVersion)"
52
                      Maximum="$(var.ProductVersion)"
53
                      Property="PREVIOUSVERSIONSINSTALLED"
54
                      IncludeMinimum="no"
55
                      IncludeMaximum="yes" />
56
    </Upgrade>
57
58
    <InstallExecuteSequence>
59
      <!-- Prevent downgrades -->
60
      <Custom Action="PreventDowngrades"
61
              After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
62
      <!-- Remove the previous product /before/ installing the new one -->
63
      <RemoveExistingProducts After="InstallValidate">PREVIOUSVERSIONSINSTALLED</RemoveExistingProducts>
64
    </InstallExecuteSequence>
65
66
    <CustomAction Id="PreventDowngrades"
67
                  Error="!(loc.NewerVersionError)" />
68
69
    <!-- We only support Windows 2000 and above -->
70
    <Condition Message="!(loc.OldWindowsError)">
71
      <![CDATA[VersionNT >= 500]]>
72
    </Condition>
73
74
    <!-- Compress installation files in an embedded cab file -->
75
    <Media Id="1" Cabinet="openmsx.cab" EmbedCab="yes" CompressionLevel="high" />
76
77
    <!-- The default installation directory is under [ProgramFilesFolder] or [ProgramFiles64Folder] -->
78
    <Directory Id="TARGETDIR" Name="SourceDir">
79
      <Directory Id="$(var.ProgramFilesFolderNative)">
80
        <Directory Id="OPENMSXINSTALLDIR" Name="openMSX">
81
          <!-- This dummy component has one purpose: to remove the annoying 'run from the network' option on the root feature 
82
               Apparently features without components have that option enabled. Shrug. -->
83
          <Component Id="DummyComponent" Guid="1ce98c66-b014-4d3f-b926-b08f65a7f3f3">
84
            <CreateFolder />
85
          </Component>
86
        </Directory>
87
      </Directory>
88
      <Directory Id="ProgramMenuFolder">
89
        <Directory Id="openMSXStartMenuDir" Name="openMSX"/>
90
      </Directory>
91
      <Directory Id="SystemFolder" />
92
    </Directory>
93
94
    <!--
95
      User interface
96
      -->
97
98
    <!-- Use the WixUI_FeatureTree UI in order to customize features and installation directory -->
99
    <Property Id="WIXUI_INSTALLDIR" Value="OPENMSXINSTALLDIR" />
100
    <UIRef Id="WixUI_FeatureTree" />
101
    <!-- Remove the license agreement dialog, which sits between WelcomeDlg and CustomizeDlg -->
102
    <UI>
103
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">1</Publish>
104
      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">NOT Installed</Publish>
105
    </UI>
106
    <!-- We have no license agreement at the moment. This is how we'd reference one -->
107
    <!-->WixVariable Id="WixUILicenseRtf" Value="license1033.rtf" /-->
108
    <!-- Installer Graphics -->
109
    <WixVariable Id="WixUIDialogBmp" Value="$(env.OPENMSX_PACKAGE_WINDOWS_PATH)/images/SideBanner.jpg" />
110
    <WixVariable Id="WixUIBannerBmp" Value="$(env.OPENMSX_PACKAGE_WINDOWS_PATH)/images/TopBanner.jpg" />
111
112
    <!-- Add text to the final dialog; the custom action is needed to use the OPENMSXINSTALLDIR property -->
113
    <CustomAction Id="CA_Set_WIXUI_EXITDIALOGOPTIONALTEXT" Property="WIXUI_EXITDIALOGOPTIONALTEXT" 
114
                  Value="To emulate real MSX systems (besides the free C-BIOS machines), put the system ROMs here: [PersonalFolder]openMSX\share\systemroms Copy MSX software referred to from replays or savestates you get from your friends to [PersonalFolder]openMSX\share\software. (For all users, use [OPENMSXINSTALLDIR]share as admin instead.)" />
115
    <InstallUISequence>
116
      <Custom Action="CA_Set_WIXUI_EXITDIALOGOPTIONALTEXT" After="ExecuteAction" />
117
    </InstallUISequence>
118
119
    <!--
120
      Start Menu shortcuts
121
      -->
122
    
123
    <DirectoryRef Id="openMSXStartMenuDir">
124
      <Component Id="openMSXShortcuts" Guid="*">
125
126
        <!-- Shortcut to openmsx.exe  -->
127
        <Shortcut Id="openMSXExeShortcut"
128
                  Name="!(loc.openMSX)"
129
                  Description="!(loc.TagLine)"
130
                  Target="[OPENMSXINSTALLDIR]openmsx.exe"
131
                  WorkingDirectory="OPENMSXINSTALLDIR" />
132
        
133
        <!-- Shortcut to openMSX manual -->
134
        <Shortcut Id="openMSXManualShortcut"
135
                  Name="!(loc.openMSXManual)"
136
                  Description="!(loc.openMSXManual)"
137
                  Target="[OPENMSXINSTALLDIR]doc\manual\index.html"
138
                  WorkingDirectory="OPENMSXINSTALLDIR" />
139
140
        <!-- Shortcut to openMSX website -->
141
        <util:InternetShortcut Id="openMSXWebSiteShortcut"
142
                               Name="!(loc.openMSXWebSite)"
143
                               Target="http://openmsx.org/" />
144
145
        <!-- Shortcut to uninstall - do we really need this? 
146
             Note that [SystemFolder64] is always the native system folder -->
147
        <Shortcut Id="UninstallProduct"
148
                  Name="!(loc.UninstallopenMSX)"
149
                  Description="!(loc.UninstallopenMSX)"
150
                  Target="[System64Folder]msiexec.exe"
151
                  Arguments="/x [ProductCode]" />
152
153
        <!-- This is needed to fix two errors:
154
             ICE38: Component openMSXShortcuts installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file.
155
             ICE43: Component openMSXShortcuts has non-advertised shortcuts. It should use a registry key under HKCU as its KeyPath, not a file. -->
156
        <RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="Installed" Type="integer" Value="1" KeyPath="yes"/>
157
158
        <!-- This is needed to prevent the following error:
159
             ICE64: The directory openMSXStartMenuDir is in the user profile but is not listed in the RemoveFile table. -->
160
        <RemoveFolder Id="openMSXStartMenuDir" On="uninstall" />
161
      </Component>
162
163
      <!-- Use a hardcoded guid here to work around what appears to be a WiX bug 
164
           Otherwise, we get ICE08: Component: CatapultShortcuts has a duplicate GUID: {69F885AD-19F6-5D4D-89DC-E05C05A3D761} -->
165
      <Component Id="CatapultShortcuts" Guid="5ad9c567-56a1-4d61-9edc-5504f2ae673e">
166
167
        <!-- Shortcut to catapult.exe -->
168
        <Shortcut Id="CatapultExeShortcut"
169
                    Name="!(loc.Catapult)"
170
                    Description="!(loc.CatapultDescription)"
171
                    Target="[OPENMSXINSTALLDIR]Catapult\bin\catapult.exe"
172
                    WorkingDirectory="OPENMSXINSTALLDIR" />
173
        
174
        <!-- Shortcut to Catapult manual -->
175
        <Shortcut Id="CatapultManualShortcut"
176
                  Name="!(loc.CatapultManual)"
177
                  Description="!(loc.CatapultManual)"
178
                  Target="[OPENMSXINSTALLDIR]Catapult\doc\manual\index.html"
179
                  WorkingDirectory="OPENMSXINSTALLDIR" />
180
181
        <RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="Installed" Type="integer" Value="1" KeyPath="yes"/>
182
      </Component>
183
184
    </DirectoryRef>
185
    
186
    <!-- 
187
      Registry entries 
188
    -->
189
190
    <!-- Use a hardcoded guid to work around CNDL0230 -->
191
    <Component Id="ZMBVRegistryValues" Guid="52db293d-8b1e-4598-9c9a-c71ed3a5ecb9" KeyPath="yes" Win64="no" Directory="SystemFolder">
192
      <RegistryValue Id="Drivers32"
193
                     Name="VIDC.ZMBV"
194
                     Value="zmbv.dll"
195
                     Type="string"
196
                     Root="HKLM"
197
                     Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32"
198
                     Action="write" />
199
200
      <RegistryValue Id="drivers.desc"
201
                     Name="zmbv.dll"
202
                     Value="!(loc.ZMBVVideoCodecDesc)"
203
                     Type="string"
204
                     Root="HKLM"
205
                     Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc"
206
                     Action="write" />
207
    </Component>
208
209
    <!--
210
      Features
211
      -->
212
213
    <!-- openMSX is composed of three features:
214
         1) The required Core Emulator
215
         2) The optional Catapult UI
216
         3) The optional ZMBV codec
217
         Each feature consists of several components: largely files and shortcuts
218
         The individual file list for feature is dynamically generated 
219
         via file harvesting scripts, whose output is references as 
220
         component groups. -->
221
    <Feature Id="openMSX"
222
             Title="!(loc.openMSX)"
223
             Description="!(loc.TagLine)"
224
             Level="1"
225
             Absent="disallow"
226
             Display="expand"
227
             AllowAdvertise="no"
228
             ConfigurableDirectory="OPENMSXINSTALLDIR">
229
230
      <ComponentRef Id="DummyComponent" />
231
232
      <Feature Id="openMSXCore"
233
               Title="!(loc.CoreEmulator)"
234
               Description="Command line MSX emulator"
235
               Level="1"
236
               Absent="disallow"
237
               AllowAdvertise="no">
238
239
        <ComponentGroupRef Id="openMSXExe" />
240
        <ComponentGroupRef Id="openMSXDoc" />
241
        <ComponentGroupRef Id="openMSXShare" />
242
        <ComponentGroupRef Id="openMSXIcon" />
243
        <ComponentRef Id="openMSXShortcuts" />
244
      </Feature>
245
246
      <Feature Id="Catapult"
247
               Title="!(loc.CatapultUI)"
248
               Description="!(loc.CatapultDescription)"
249
               Level="1"
250
               Absent="allow"
251
               AllowAdvertise="no">
252
        <ComponentGroupRef Id="CatapultBin" />
253
        <ComponentGroupRef Id="CatapultDoc" />
254
        <ComponentGroupRef Id="CatapultBitmaps" />
255
        <ComponentGroupRef Id="CatapultDialogs" />
256
        <ComponentGroupRef Id="CatapultIcons" />
257
        <ComponentGroupRef Id="CatapultReadme" />
258
        <ComponentRef Id="CatapultShortcuts" />
259
      </Feature>
260
261
      <Feature Id="ZMBVCodec"
262
               Title="!(loc.ZMBVVideoCodec)"
263
               Description="!(loc.ZMBVVideoCodecDescription)"
264
               Level="2"
265
               Absent="allow"
266
               AllowAdvertise="no">
267
        <ComponentGroupRef Id="ZMBVCodec" />
268
        <ComponentGroupRef Id="ZMBVFiles" />
269
        <ComponentRef Id="ZMBVRegistryValues" />
270
      </Feature>
271
272
    </Feature>
273
274
  </Product>
275
</Wix>