Skip to content

Commit e71947d

Browse files
committed
Use candle's -arch option to select build platform
According to docs, using Package/@platform "is discouraged". The -arch option also provides the default bitness for components, making the Component/@win64 attribute unnecessary in single-architecture packages.
1 parent 2df3461 commit e71947d

File tree

3 files changed

+48
-60
lines changed

3 files changed

+48
-60
lines changed

installer/buildInstallers.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function buildInstaller([string]$CPUTYPE)
269269
Write-Host ".`nBuilding psqlODBC/$SUBLOC merge module..."
270270
$BINBASE = GetObjbase ".."
271271
$INSTBASE = GetObjbase ".\$CPUTYPE" "installer\$CPUTYPE"
272-
candle -nologo $libpqRelArgs "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dLIBPQBINDIR=$LIBPQBINDIR" "-dLIBPQMSVCDLL=$LIBPQMSVCDLL" "-dLIBPQMSVCSYS=$LIBPQMSVCSYS" "-dPODBCMSVCDLL=$PODBCMSVCDLL" "-dPODBCMSVPDLL=$PODBCMSVPDLL" "-dPODBCMSVCSYS=$PODBCMSVCSYS" "-dPODBCMSVPSYS=$PODBCMSVPSYS" "-dNoPDB=$NoPDB" "-dBINBASE=$BINBASE" -o $INSTBASE\psqlodbcm.wixobj psqlodbcm_cpu.wxs
272+
candle -nologo -arch $CPUTYPE $libpqRelArgs "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dLIBPQBINDIR=$LIBPQBINDIR" "-dLIBPQMSVCDLL=$LIBPQMSVCDLL" "-dLIBPQMSVCSYS=$LIBPQMSVCSYS" "-dPODBCMSVCDLL=$PODBCMSVCDLL" "-dPODBCMSVPDLL=$PODBCMSVPDLL" "-dPODBCMSVCSYS=$PODBCMSVCSYS" "-dPODBCMSVPSYS=$PODBCMSVPSYS" "-dNoPDB=$NoPDB" "-dBINBASE=$BINBASE" -o $INSTBASE\psqlodbcm.wixobj psqlodbcm_cpu.wxs
273273
if ($LASTEXITCODE -ne 0) {
274274
throw "Failed to build merge module"
275275
}
@@ -282,7 +282,7 @@ function buildInstaller([string]$CPUTYPE)
282282

283283
Write-Host ".`nBuilding psqlODBC installer database..."
284284

285-
candle -nologo "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dINSTBASE=$INSTBASE" -o $INSTBASE\psqlodbc.wixobj psqlodbc_cpu.wxs
285+
candle -nologo -arch $CPUTYPE "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dINSTBASE=$INSTBASE" -o $INSTBASE\psqlodbc.wixobj psqlodbc_cpu.wxs
286286
if ($LASTEXITCODE -ne 0) {
287287
throw "Failed to build installer database"
288288
}

installer/psqlodbc_cpu.wxs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
33

4-
<!-- Default to x86 platform -->
5-
<?ifndef var.Platform ?>
6-
<?define Platform = "x86" ?>
7-
<?else?>
8-
<?if $(var.Platform) != x64 and $(var.Platform) != x86 ?>
9-
<?error Invalid Platform variable ?>
10-
<?endif?>
11-
<?endif?>
12-
13-
<?ifndef var.INSTBASE ?>
14-
<?define INSTBASE = $(var.Platform) ?>
15-
<?endif?>
16-
17-
<?if $(var.Platform) = x64 ?>
4+
<?if $(sys.BUILDARCH) = x64 ?>
5+
<?define Platform = "x64" ?>
186
<?define PKGNAME = "psqlODBC_x64" ?>
197
<?define BIT64 = "yes" ?>
208
<?define PGFOLDER = "ProgramFiles64Folder" ?>
@@ -24,7 +12,8 @@
2412
<?define CIDSMD = "{E6410EE8-96DC-4d84-8D07-94F8093BF3EF}" ?>
2513
<?define UPGCOD = "BBD29DF5-89F6-4b8b-BDC9-C3EA3A4AFDBB" ?>
2614
<?define ALLUSERS = "1" ?>
27-
<?else?>
15+
<?elseif $(sys.BUILDARCH) = x86 ?>
16+
<?define Platform = "x86" ?>
2817
<?define PKGNAME = "psqlODBC" ?>
2918
<?define BIT64 = "no" ?>
3019
<?define PGFOLDER = "ProgramFilesFolder" ?>
@@ -34,6 +23,12 @@
3423
<?define CIDSMD = "{22288E09-B3B6-4181-907F-676099C20125}" ?>
3524
<?define UPGCOD = "24BCA538-75A2-4a7f-B236-C99EFC2145DE" ?>
3625
<?define ALLUSERS = "1" ?>
26+
<?else?> <!-- sys.BUILDARCH -->
27+
<?error Invalid build architecture ?>
28+
<?endif?>
29+
30+
<?ifndef var.INSTBASE ?>
31+
<?define INSTBASE = $(var.Platform) ?>
3732
<?endif?>
3833

3934
<?define MERGEM = "$(var.INSTBASE)\psqlodbc_$(var.Platform).msm" ?>
@@ -55,7 +50,6 @@
5550
Comments="PostgreSQL ODBC Driver"
5651
Manufacturer="PostgreSQL Global Development Group"
5752
InstallerVersion="300"
58-
Platform="$(var.Platform)"
5953
Languages="1033"
6054
Compressed="yes"
6155
SummaryCodepage="1252" />
@@ -67,13 +61,13 @@
6761
<Directory Id="BASEDIR" Name="psqlODBC">
6862
<Directory Id="SUBLOC" Name="$(var.SUBLOC)">
6963
<Directory Id="BINDIR" Name="bin">
70-
<Component Id="registration" Guid="$(var.CIDREG)" Win64="$(var.BIT64)">
64+
<Component Id="registration" Guid="$(var.CIDREG)">
7165
<RegistryValue KeyPath="yes" Type="string" Root="HKLM" Key="Software\$(var.PKGNAME)" Name="Version" Value="$(var.VERSION)" />
7266
</Component>
7367
<Merge Id="psqlodbcm" DiskId="1" Language="1033" SourceFile="$(var.MERGEM)" />
7468
</Directory>
7569
<Directory Id="DOCSDIR" Name="docs">
76-
<Component Id="docs" Guid="$(var.CIDDOC)" Win64="$(var.BIT64)">
70+
<Component Id="docs" Guid="$(var.CIDDOC)">
7771
<File Id="docs.README.txt" Name="README.txt" DiskId="1" Source="../docs/README.txt" KeyPath="yes" />
7872
<File Id="docs.config.html" Name="config.html" DiskId="1" Source="../docs/config.html" />
7973
<File Id="docs.config_opt.html" Name="config-opt.html" DiskId="1" Source="../docs/config-opt.html" />
@@ -91,7 +85,7 @@
9185
</Directory>
9286
<Directory Id="ProgramMenuFolder" Name="." SourceName="Programs">
9387
<Directory Id="SMDir" Name="$(var.PKGNAME)">
94-
<Component Id="smdir" Guid="$(var.CIDSMD)" Win64="$(var.BIT64)">
88+
<Component Id="smdir" Guid="$(var.CIDSMD)">
9589
<RegistryValue KeyPath="yes" Type="string" Root="HKCU" Key="Software\$(var.PKGNAME)\SMDir Created" Value="y" />
9690
<RemoveFolder Id="SMDir" On="uninstall" />
9791
</Component>

installer/psqlodbcm_cpu.wxs

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
33

4-
<!-- Default to x86 platform -->
5-
<?ifndef var.Platform ?>
6-
<?define Platform = "x86" ?>
7-
<?else?>
8-
<?if $(var.Platform) != x64 and $(var.Platform) != x86 ?>
9-
<?error Invalid Platform variable ?>
10-
<?endif?>
11-
<?endif?>
12-
134
<?ifndef var.BINBASE ?>
145
<?define BINBASE = ".." ?>
156
<?endif?>
167

17-
<?if $(var.Platform) = x64 ?>
18-
<?define ModuleName = "psqlODBC_$(var.Platform)" ?>
8+
<?if $(sys.BUILDARCH) = x64 ?>
9+
<?define Platform = "x64" ?>
10+
<?define ModuleName = "psqlODBC_x64" ?>
1911
<?define BIT64 = "yes" ?>
2012
<?define ANSIFOLDER = "x64_ANSI_Release" ?>
2113
<?define UNICODEFOLDER = "x64_Unicode_Release" ?>
@@ -26,7 +18,8 @@
2618
<?else?>
2719
<?define SysFolder = "$(env.SystemRoot)\sysnative" ?>
2820
<?endif?>
29-
<?else?>
21+
<?elseif $(sys.BUILDARCH) = x86 ?>
22+
<?define Platform = "x86" ?>
3023
<?define ModuleName = "psqlODBC" ?>
3124
<?define BIT64 = "no" ?>
3225
<?define ANSIFOLDER = "x86_ANSI_Release" ?>
@@ -38,6 +31,8 @@
3831
<?else?>
3932
<?define SysFolder = "$(env.SystemRoot)\system32" ?>
4033
<?endif?>
34+
<?else?> <!-- sys.BUILDARCH -->
35+
<?error Invalid build architecture ?>
4136
<?endif?>
4237

4338
<Module
@@ -51,7 +46,6 @@
5146
Keywords="PostgreSQL, ODBC"
5247
Manufacturer="PostgreSQL Global Development Group"
5348
InstallerVersion="$(var.InstallerVersion)"
54-
Platform="$(var.Platform)"
5549
Languages="1033"
5650
SummaryCodepage="1252" />
5751

@@ -71,7 +65,7 @@
7165
-->
7266
<Directory Id="BINDIR" Name="." ComponentGuidGenerationSeed="495CEE94-BDB9-4309-9544-D98783259CD8">
7367
<!-- PostgreSQL -->
74-
<Component Id="psqlodbc.psqlodbc30a.dll" Win64="$(var.BIT64)">
68+
<Component Id="psqlodbc.psqlodbc30a.dll">
7569
<File Name="psqlodbc30a.dll" Source="$(var.BINBASE)\$(var.ANSIFOLDER)\psqlodbc30a.dll">
7670
<ODBCDriver Id="Psqlodbc_9.0_Driver_ANSI" Name="PostgreSQL ANSI($(var.Platform))">
7771
<Property Id="CPTimeout" Value="60"/>
@@ -81,18 +75,18 @@
8175
</ODBCDriver>
8276
</File>
8377
</Component>
84-
<Component Id="psqlodbc.pgenlista.dll" Win64="$(var.BIT64)">
78+
<Component Id="psqlodbc.pgenlista.dll">
8579
<File Name="pgenlista.dll" Source="$(var.BINBASE)\$(var.ANSIFOLDER)\pgenlista.dll" />
8680
</Component>
8781
<?if $(var.NoPDB) != True ?>
88-
<Component Id="psqlodbc.psqlodbc30a.pdb" Win64="$(var.BIT64)">
82+
<Component Id="psqlodbc.psqlodbc30a.pdb">
8983
<File Name="psqlodbc30a.pdb" Source="$(var.BINBASE)\$(var.ANSIFOLDER)\psqlodbc30a.pdb" />
9084
</Component>
91-
<Component Id="psqlodbc.pgenlista.pdb" Win64="$(var.BIT64)">
85+
<Component Id="psqlodbc.pgenlista.pdb">
9286
<File Name="pgenlista.pdb" Source="$(var.BINBASE)\$(var.ANSIFOLDER)\pgenlista.pdb" />
9387
</Component>
9488
<?endif?>
95-
<Component Id="psqlodbc.psqlodbc35w.dll" Win64="$(var.BIT64)">
89+
<Component Id="psqlodbc.psqlodbc35w.dll">
9690
<File Name="psqlodbc35w.dll" Source="$(var.BINBASE)\$(var.UNICODEFOLDER)\psqlodbc35w.dll">
9791
<ODBCDriver Id="Psqlodbc_9.0_Driver" Name="PostgreSQL Unicode($(var.Platform))">
9892
<Property Id="CPTimeout" Value="60"/>
@@ -102,101 +96,101 @@
10296
</ODBCDriver>
10397
</File>
10498
</Component>
105-
<Component Id="psqlodbc.pgenlist.dll" Win64="$(var.BIT64)">
99+
<Component Id="psqlodbc.pgenlist.dll">
106100
<File Name="pgenlist.dll" Source="$(var.BINBASE)\$(var.UNICODEFOLDER)\pgenlist.dll" />
107101
</Component>
108102
<?if $(var.NoPDB) != True ?>
109-
<Component Id="psqlodbc.psqlodbc35w.pdb" Win64="$(var.BIT64)">
103+
<Component Id="psqlodbc.psqlodbc35w.pdb">
110104
<File Name="psqlodbc35w.pdb" Source="$(var.BINBASE)\$(var.UNICODEFOLDER)\psqlodbc35w.pdb" />
111105
</Component>
112-
<Component Id="psqlodbc.pgenlist.pdb" Win64="$(var.BIT64)">
106+
<Component Id="psqlodbc.pgenlist.pdb">
113107
<File Name="pgenlist.pdb" Source="$(var.BINBASE)\$(var.UNICODEFOLDER)\pgenlist.pdb" />
114108
</Component>
115109
<?endif?>
116110

117111
<!-- MSVC Runtime -->
118112
<?if "$(var.PODBCMSVCDLL)" != "" ?>
119-
<Component Id="vcredist.vcruntime.dll.psqlodbc" Win64="$(var.BIT64)">
113+
<Component Id="vcredist.vcruntime.dll.psqlodbc">
120114
<File Source="$(var.PODBCMSVCDLL)" />
121115
</Component>
122116
<?endif?>
123117
<?if "$(var.PODBCMSVPDLL)" != "" ?>
124-
<Component Id="vcredist.msvcp.dll.psqlodbc" Win64="$(var.BIT64)">
118+
<Component Id="vcredist.msvcp.dll.psqlodbc">
125119
<File Source="$(var.PODBCMSVPDLL)" />
126120
</Component>
127121
<?endif?>
128122
<?if "$(var.PODBCMSVCSYS)" != "" ?>
129-
<Component Id="system.vcruntime.dll.psqlodbc" Win64="$(var.BIT64)">
123+
<Component Id="system.vcruntime.dll.psqlodbc">
130124
<File Source="$(var.SysFolder)\$(var.PODBCMSVCSYS)" />
131125
</Component>
132126
<?endif?>
133127
<?if "$(var.PODBCMSVPSYS)" != "" ?>
134-
<Component Id="system.msvcp.dll.psqlodbc" Win64="$(var.BIT64)">
128+
<Component Id="system.msvcp.dll.psqlodbc">
135129
<File Source="$(var.SysFolder)\$(var.PODBCMSVPSYS)" />
136130
</Component>
137131
<?endif?>
138132
<?if "$(var.LIBPQMSVCDLL)" != "" ?>
139-
<Component Id="vcredist.vcruntime.dll.libpq" Win64="$(var.BIT64)">
133+
<Component Id="vcredist.vcruntime.dll.libpq">
140134
<File Source="$(var.LIBPQMSVCDLL)" />
141135
</Component>
142136
<?endif?>
143137
<?if "$(var.LIBPQMSVCSYS)" != "" ?>
144-
<Component Id="system.vcruntime.dll.libpq" Win64="$(var.BIT64)">
138+
<Component Id="system.vcruntime.dll.libpq">
145139
<File Source="$(var.SysFolder)\$(var.LIBPQMSVCSYS)" />
146140
</Component>
147141
<?endif?>
148142

149143
<!-- libpq -->
150-
<Component Id="libpq.libpq.dll" Win64="$(var.BIT64)">
144+
<Component Id="libpq.libpq.dll">
151145
<File Id="libpq.dll" Name="libpq.dll" Source="$(var.LIBPQBINDIR)\libpq.dll" />
152146
</Component>
153147
<?if "$(var.LIBPQMEM0)" != "" ?>
154-
<Component Id="libpq.related0.dll" Win64="$(var.BIT64)">
148+
<Component Id="libpq.related0.dll">
155149
<File Source="$(var.LIBPQMEM0)" />
156150
</Component>
157151
<?endif ?>
158152
<?if "$(var.LIBPQMEM1)" != "" ?>
159-
<Component Id="libpq.related1.dll" Win64="$(var.BIT64)">
153+
<Component Id="libpq.related1.dll">
160154
<File Source="$(var.LIBPQMEM1)" />
161155
</Component>
162156
<?endif ?>
163157
<?if "$(var.LIBPQMEM2)" != "" ?>
164-
<Component Id="libpq.related2.dll" Win64="$(var.BIT64)">
158+
<Component Id="libpq.related2.dll">
165159
<File Source="$(var.LIBPQMEM2)" />
166160
</Component>
167161
<?endif ?>
168162
<?if "$(var.LIBPQMEM3)" != "" ?>
169-
<Component Id="libpq.related3.dll" Win64="$(var.BIT64)">
163+
<Component Id="libpq.related3.dll">
170164
<File Source="$(var.LIBPQMEM3)" />
171165
</Component>
172166
<?endif ?>
173167
<?if "$(var.LIBPQMEM4)" != "" ?>
174-
<Component Id="libpq.related4.dll" Win64="$(var.BIT64)">
168+
<Component Id="libpq.related4.dll">
175169
<File Source="$(var.LIBPQMEM4)" />
176170
</Component>
177171
<?endif ?>
178172
<?if "$(var.LIBPQMEM5)" != "" ?>
179-
<Component Id="libpq.related5.dll" Win64="$(var.BIT64)">
173+
<Component Id="libpq.related5.dll">
180174
<File Source="$(var.LIBPQMEM5)" />
181175
</Component>
182176
<?endif ?>
183177
<?if "$(var.LIBPQMEM6)" != "" ?>
184-
<Component Id="libpq.related6.dll" Win64="$(var.BIT64)">
178+
<Component Id="libpq.related6.dll">
185179
<File Source="$(var.LIBPQMEM6)" />
186180
</Component>
187181
<?endif ?>
188182
<?if "$(var.LIBPQMEM7)" != "" ?>
189-
<Component Id="libpq.related7.dll" Win64="$(var.BIT64)">
183+
<Component Id="libpq.related7.dll">
190184
<File Source="$(var.LIBPQMEM7)" />
191185
</Component>
192186
<?endif ?>
193187
<?if "$(var.LIBPQMEM8)" != "" ?>
194-
<Component Id="libpq.related8.dll" Win64="$(var.BIT64)">
188+
<Component Id="libpq.related8.dll">
195189
<File Source="$(var.LIBPQMEM8)" />
196190
</Component>
197191
<?endif ?>
198192
<?if "$(var.LIBPQMEM9)" != "" ?>
199-
<Component Id="libpq.related9.dll" Win64="$(var.BIT64)">
193+
<Component Id="libpq.related9.dll">
200194
<File Source="$(var.LIBPQMEM9)" />
201195
</Component>
202196
<?endif ?>
@@ -206,7 +200,7 @@
206200
32bit machines. We had better register the XA DLL on
207201
installation.
208202
-->
209-
<Component Id="pgxalib.files" Win64="$(var.BIT64)">
203+
<Component Id="pgxalib.files">
210204
<?if $(var.BIT64) = no ?> <!-- On x64 OS only install from x64 package. -->
211205
<Condition>
212206
<![CDATA[NOT VersionNT64]]>

0 commit comments

Comments
 (0)