diff contrib/wix/mercurial.wxs @ 13042:bd9bc4123920 stable

wix: add support for x64 native MSI packages
author Steve Borho <steve@borho.org>
date Fri, 26 Nov 2010 17:40:13 -0600
parents 79388a8325dc
children db1433e4bf5f
line wrap: on
line diff
--- a/contrib/wix/mercurial.wxs	Fri Nov 26 16:18:19 2010 -0600
+++ b/contrib/wix/mercurial.wxs	Fri Nov 26 17:40:13 2010 -0600
@@ -7,15 +7,16 @@
   GNU General Public License version 2 or any later version. -->
 
   <?include guids.wxi ?>
+  <?include defines.wxi ?>
 
   <?if $(var.Platform) = "x64" ?>
-    <?define IsX64 = yes ?>
+    <?define PFolder = ProgramFiles64Folder ?>
   <?else?>
-    <?define IsX64 = no ?>
+    <?define PFolder = ProgramFilesFolder ?>
   <?endif?>
 
   <Product Id='*'
-    Name='Mercurial $(var.Version)' 
+    Name='Mercurial $(var.Version) ($(var.Platform))' 
     UpgradeCode='$(var.ProductUpgradeCode)'
     Language='1033' Codepage='1252' Version='$(var.Version)'
     Manufacturer='Matt Mackall and others'>
@@ -24,6 +25,7 @@
       Keywords='Installer'
       Description="Mercurial distributed SCM (version $(var.Version))"
       Comments='$(var.Comments)'
+      Platform='$(var.Platform)'
       Manufacturer='Matt Mackall and others'
       InstallerVersion='300' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
 
@@ -31,8 +33,14 @@
            CompressionLevel='high' />
     <Property Id='DiskPrompt' Value="Mercurial $(var.Version) Installation [1]" />
 
-    <Condition Message='Mercurial requires Windows XP or higher'
-      >VersionNT >= 501</Condition>
+    <?if $(var.Platform) = "x86" ?>
+      <Condition Message = "This x86 installer may not be used on a x64 platform">
+          NOT VersionNT64
+      </Condition>
+    <?endif?>
+    <Condition Message='Mercurial MSI installers require Windows XP or higher'>
+        VersionNT >= 501
+    </Condition>
 
     <Property Id="INSTALLDIR">
       <ComponentSearch Id='SearchForMainExecutableComponent'
@@ -54,35 +62,35 @@
     <Property Id='LicenseAccepted'>1</Property>
 
     <Directory Id='TARGETDIR' Name='SourceDir'>
-      <Directory Id='ProgramFilesFolder' Name='PFiles'>
+      <Directory Id='$(var.PFolder)' Name='PFiles'>
         <Directory Id='INSTALLDIR' Name='Mercurial'>
-          <Component Id='MainExecutable' Guid='$(var.ComponentMainExecutableGUID)'>
+          <Component Id='MainExecutable' Guid='$(var.ComponentMainExecutableGUID)' Win64='$(var.IsX64)'>
             <File Id='hgEXE' Name='hg.exe' Source='dist\hg.exe' KeyPath='yes' />
             <Environment Id="Environment" Name="PATH" Part="last" System="yes"
                          Permanent="no" Value="[INSTALLDIR]bin" Action="set" />
           </Component>
-          <Component Id='ReadMe' Guid='$(var.ReadMe.guid)'>
+          <Component Id='ReadMe' Guid='$(var.ReadMe.guid)' Win64='$(var.IsX64)'>
               <File Id='ReadMe' Name='ReadMe.html' Source='contrib\win32\ReadMe.html'
                     KeyPath='yes'/>
           </Component>
-          <Component Id='COPYING' Guid='$(var.COPYING.guid)'>
+          <Component Id='COPYING' Guid='$(var.COPYING.guid)' Win64='$(var.IsX64)'>
             <File Id='COPYING' Name='COPYING.rtf' Source='contrib\wix\COPYING.rtf'
                   KeyPath='yes'/>
           </Component>
 
           <Directory Id='HGRCD' Name='hgrc.d'>
-            <Component Id='mercurial.rc' Guid='$(var.mercurial.rc.guid)'>
+            <Component Id='mercurial.rc' Guid='$(var.mercurial.rc.guid)' Win64='$(var.IsX64)'>
               <File Id='mercurial.rc' Name='Mercurial.rc' Source='contrib\win32\mercurial.ini'
                     ReadOnly='yes' KeyPath='yes'/>
             </Component>
-            <Component Id='mergetools.rc' Guid='$(var.mergetools.rc.guid)'>
+            <Component Id='mergetools.rc' Guid='$(var.mergetools.rc.guid)' Win64='$(var.IsX64)'>
               <File Id='mergetools.rc' Name='MergeTools.rc' Source='contrib\mergetools.hgrc'
                     ReadOnly='yes' KeyPath='yes'/>
             </Component>
           </Directory>
 
           <Directory Id='binFolder' Name='bin'>
-            <Component Id='HgCmd' Guid='$(var.hgcmd.guid)'>
+            <Component Id='HgCmd' Guid='$(var.hgcmd.guid)' Win64='$(var.IsX64)'>
                 <File Id='Hg.Cmd' Name='hg.cmd' KeyPath='yes' Source='contrib\wix\hg.cmd' />
             </Component>
           </Directory>
@@ -91,7 +99,7 @@
 
       <Directory Id="ProgramMenuFolder" Name="Programs">
         <Directory Id="ProgramMenuDir" Name="Mercurial $(var.Version)">
-          <Component Id="ProgramMenuDir" Guid="$(var.ProgramMenuDir.guid)">
+          <Component Id="ProgramMenuDir" Guid="$(var.ProgramMenuDir.guid)" Win64='$(var.IsX64)'>
             <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
             <RegistryValue Root='HKCU' Key='Software\Mercurial\InstallDir' Type='string'
                            Value='[INSTALLDIR]' KeyPath='yes' />
@@ -101,10 +109,17 @@
         </Directory>
       </Directory>
 
-      <Merge Id='VCRuntime' DiskId='1' Language='1033'
-             SourceFile='$(var.VCRedistSrcDir)\microsoft.vcxx.crt.x86_msm.msm' />
-      <Merge Id='VCRuntimePolicy' DiskId='1' Language='1033'
-             SourceFile='$(var.VCRedistSrcDir)\policy.x.xx.microsoft.vcxx.crt.x86_msm.msm' />
+      <?if $(var.Platform) = "x86" ?>
+        <Merge Id='VCRuntime' DiskId='1' Language='1033'
+              SourceFile='$(var.VCRedistSrcDir)\microsoft.vcxx.crt.x86_msm.msm' />
+        <Merge Id='VCRuntimePolicy' DiskId='1' Language='1033'
+              SourceFile='$(var.VCRedistSrcDir)\policy.x.xx.microsoft.vcxx.crt.x86_msm.msm' />
+      <?else?>
+        <Merge Id='VCRuntime' DiskId='1' Language='1033'
+              SourceFile='$(var.VCRedistSrcDir)\microsoft.vcxx.crt.x64_msm.msm' />
+        <Merge Id='VCRuntimePolicy' DiskId='1' Language='1033'
+              SourceFile='$(var.VCRedistSrcDir)\policy.x.xx.microsoft.vcxx.crt.x64_msm.msm' />
+      <?endif?>
     </Directory>
 
     <Feature Id='Complete' Title='Mercurial' Description='The complete package'