diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ca45204..8d3db77 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -275,6 +275,12 @@ jobs: with: arch: x86 + - name: Install WiX + shell: cmd + run: | + dotnet tool install --global wix + wix extension add --global WixToolset.UI.wixext + - name: build psqlodbc standard shell: powershell working-directory: psqlodbc diff --git a/installer/README.txt b/installer/README.txt index 3a1b187..ffaaee4 100644 --- a/installer/README.txt +++ b/installer/README.txt @@ -1,11 +1,15 @@ This directory contains the psqlODBC installer for Windows. To build the -installer, you will need a copy of WiX installed somewhere in your system -path. The installer has been tested with WiX version 3.0.2420 and WiX 3.8 at -the time writing. +installer, you will need a copy of WiX installed. The installer has been +tested with WiX version 5.0.2 at the time of writing. WiX may be downloaded from: - http://wix.codeplex.com/ + http://wixtoolset.org/ + +In addition to the base package, the UI extension is required: + + dotnet tool install --global wix + wix extension add --global WixToolset.UI.wixext HOW TO BUILD diff --git a/installer/buildInstallers.ps1 b/installer/buildInstallers.ps1 index 6373db6..20e15ef 100644 --- a/installer/buildInstallers.ps1 +++ b/installer/buildInstallers.ps1 @@ -256,46 +256,31 @@ function buildInstaller([string]$CPUTYPE) [string []]$libpqRelArgs=@() for ($i=0; $i -lt $maxmem; $i++) { - $libpqRelArgs += ("-dLIBPQMEM$i=" + $libpqmem[$i]) + $libpqRelArgs += "-d", ("LIBPQMEM$i=" + $libpqmem[$i]) } if (-not(Test-Path -Path $CPUTYPE)) { New-Item -ItemType directory -Path $CPUTYPE | Out-Null } - $PRODUCTCODE = [GUID]::NewGuid() - Write-Host "PRODUCTCODE: $PRODUCTCODE" - try { pushd "$scriptPath" Write-Host ".`nBuilding psqlODBC/$SUBLOC merge module..." $BINBASE = GetObjbase ".." $INSTBASE = GetObjbase ".\$CPUTYPE" "installer\$CPUTYPE" - 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 + wix build --nologo -arch $CPUTYPE $libpqRelArgs -d "VERSION=$VERSION" -d "SUBLOC=$SUBLOC" -d "LIBPQBINDIR=$LIBPQBINDIR" -d "LIBPQMSVCDLL=$LIBPQMSVCDLL" -d "LIBPQMSVCSYS=$LIBPQMSVCSYS" -d "PODBCMSVCDLL=$PODBCMSVCDLL" -d "PODBCMSVPDLL=$PODBCMSVPDLL" -d "PODBCMSVCSYS=$PODBCMSVCSYS" -d "PODBCMSVPSYS=$PODBCMSVPSYS" -d "NoPDB=$NoPDB" -d "BINBASE=$BINBASE" -o $INSTBASE\psqlodbc_$CPUTYPE.msm psqlodbcm_cpu.wxs if ($LASTEXITCODE -ne 0) { throw "Failed to build merge module" } - Write-Host ".`nLinking psqlODBC merge module..." - light -sval -nologo -o $INSTBASE\psqlodbc_$CPUTYPE.msm $INSTBASE\psqlodbcm.wixobj - if ($LASTEXITCODE -ne 0) { - throw "Failed to link merge module" - } - Write-Host ".`nBuilding psqlODBC installer database..." - candle -nologo "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dPRODUCTCODE=$PRODUCTCODE" "-dINSTBASE=$INSTBASE" -o $INSTBASE\psqlodbc.wixobj psqlodbc_cpu.wxs + wix build --nologo -arch $CPUTYPE -ext WixToolset.UI.wixext -d "VERSION=$VERSION" -d "SUBLOC=$SUBLOC" -d "INSTBASE=$INSTBASE" -o $INSTBASE\psqlodbc_$CPUTYPE.msi psqlodbc_cpu.wxs if ($LASTEXITCODE -ne 0) { throw "Failed to build installer database" } - Write-Host ".`nLinking psqlODBC installer database..." - light -sval -nologo -ext WixUIExtension -cultures:en-us -o $INSTBASE\psqlodbc_$CPUTYPE.msi $INSTBASE\psqlodbc.wixobj - if ($LASTEXITCODE -ne 0) { - throw "Failed to link installer database" - } - Write-Host ".`nModifying psqlODBC installer database..." cscript modify_msi.vbs $INSTBASE\psqlodbc_$CPUTYPE.msi if ($LASTEXITCODE -ne 0) { diff --git a/installer/modify_msi.vbs b/installer/modify_msi.vbs index c1353fc..8934411 100755 --- a/installer/modify_msi.vbs +++ b/installer/modify_msi.vbs @@ -2,7 +2,7 @@ ' When the dll name of the driver is not of 8.3-format ' the modification of the FileName is needed ' -' This is to work-around a bug in the WiX Toolset, see +' This is to work-around an oversight in Windows Installer, see ' http://wixtoolset.org/issues/1422/ ' ' We remove the short name from the filename field in the File-table @@ -10,45 +10,43 @@ ' speaking, that makes the contents of the table invalid, because a short ' name is mandatory, but Windows Installer seems nevertheless install it ' just fine. -' -option Explicit -Const msiOpenDatabaseModeTransact = 1 +Option Explicit +Const msiOpenDatabaseModeTransact = 1 Const msiViewModifyInsert = 1 Const msiViewModifyUpdate = 2 +Const query = "SELECT * FROM File" -Dim msiPath : msiPath = Wscript.Arguments(0) +Dim installer, database +Dim view, record +Dim pos, filename -Dim installer Set installer = Wscript.CreateObject("WindowsInstaller.Installer") -Dim database -Set database = installer.OpenDatabase(msiPath, msiOpenDatabaseModeTransact) - -Dim query -query = "Select * FROM File" -Dim view +Set database = installer.OpenDatabase(WScript.Arguments(0), _ + msiOpenDatabaseModeTransact) Set view = database.OpenView(query) view.Execute -Dim record + Set record = view.Fetch -Dim gFile, pos -Do While not record Is Nothing -gFile = record.StringData(1) -If Left(gFile, 8) = "psqlodbc" Then - gFile = record.StringData(3) - ' Check if the FileName field is ShortName|LongName - pos = InStr(record.StringData(3), "|") - If pos > 0 Then - ' Omit the ShortName part - gFile = Mid(record.StringData(3), pos + 1) - WScript.echo record.StringData(3) & " -> " & gFile - ' And update the field - record.StringData(3) = gFile +Do While Not record Is Nothing + + filename = record.StringData(3) + pos = InStr(filename, "|psqlodbc") + + If (pos > 0) Then + + ' Remove the ShortName part + filename = Mid(filename, pos + 1) + WScript.echo record.StringData(3) & " -> " & filename + + record.StringData(3) = filename view.Modify msiViewModifyUpdate, record + End If -End If -Set record = view.Fetch + + Set record = view.Fetch + Loop database.Commit diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index b49b92c..60075cf 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -1,107 +1,92 @@ - + - - - - - - - - - - - - - - + + - - - - + + - - - + + + + + + - + - - + Comments="PostgreSQL ODBC Driver" /> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + + + + + + + - + + + + + + + + + - + @@ -113,47 +98,19 @@ - - - - - $(var.ALLUSERS) - + - - - - + + + + - - - - - - - - - - - - - SELFFOUND AND NOT Installed - NEWERFOUND AND NOT Installed - REINSTALLMODE AND NOT Installed - UPGRADEFOUND AND REINSTALLMODE - UPGRADEFOUND AND NOT Installed - - - + + + + \ No newline at end of file diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index 1edbf1e..f2cd82e 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -1,194 +1,144 @@ - - - - - - - - - - + - - + + + - - - + + - - + + - + Codepage="1252" /> - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + \ No newline at end of file