It's not good to pass path name of files in system folder to candle.exe because the...
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Mon, 23 Nov 2015 23:09:04 +0000 (08:09 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Tue, 24 Nov 2015 13:43:09 +0000 (22:43 +0900)
installer/buildInstallers.ps1
installer/psqlodbcm_cpu.wxs

index 1fbfda5ab86e3e31c1fd1beb808eeb57016602bb..f51774edba4b78711957ff57331ea042616598d5 100644 (file)
@@ -42,7 +42,8 @@ function findRuntime($runtime_version)
    if ("$pgmvc" -ne "") {
        $dllspecified = "${pgmvc}\${rt_dllname}"
        if (Test-Path -Path $dllspecified) {
-           return $dllspecified
+           $dllspecified
+           return ""
        }
    }
    if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
@@ -52,7 +53,8 @@ function findRuntime($runtime_version)
    }
    $dllinredist = "$pgmvc\Microsoft Visual Studio ${runtime_version}.0\VC\redist\${CPUTYPE}\Microsoft.VC${runtime_version}0.CRT\${rt_dllname}"
    if (Test-Path -Path $dllinredist) {
-       return $dllinredist
+       $dllinredist
+       return ""
    } else {
        $messageSpec = "Please specify Configuration.$CPUTYPE.runtime_folder element of the configuration file where msvc runtime dll $rt_dllname can be found"
        if ($CPUTYPE -eq "x86") {
@@ -75,7 +77,8 @@ function findRuntime($runtime_version)
            throw "${messageSpec}`nneither $dllinredist nor $dllinsystem exists unfortunately"
        }
    }
-   return $dllinsystem
+   ""
+   return $rt_dllname
 }
 
 function buildInstaller($CPUTYPE)
@@ -119,9 +122,12 @@ function buildInstaller($CPUTYPE)
    {
        throw "Unknown CPU type $CPUTYPE";
    }
-   # msvc runtime
-   $MSVCRUNTIMEDLL = ""
-   $LIBPQMSVC = ""
+   # msvc runtime psqlodbc links
+   $PODBCMSVCDLL = ""
+   $PODBCMSVCSYS = ""
+   # msvc runtime libpq links
+   $LIBPQMSVCDLL = ""
+   $LIBPQMSVCSYS = ""
    if (-not $ExcludeRuntime) {
        $toolset = $configInfo.Configuration.BuildResult.PlatformToolset
        if ($toolset -match "^v(\d+)0") {
@@ -129,9 +135,11 @@ function buildInstaller($CPUTYPE)
        } else {
            $runtime_version0 = "10"
        }
-       # where's the dll? 
-       $MSVCRUNTIMEDLL=findRuntime($runtime_version0)
-       # where's the dll? 
+       # where's the msvc runtime dll psqlodbc links? 
+       $dlls=findRuntime($runtime_version0)
+       $PODBCMSVCDLL=$dlls[0]
+       $PODBCMSVCSYS=$dlls[1]
+       # where's the runtime dll libpq links? 
        $msvclist=invoke-expression -command "& `"${dumpbinexe}`" /imports `"$LIBPQBINDIR\libpq.dll`""| select-string -pattern "^\s*msvcr(\d+)0\.dll" | % {$_.matches[0].Groups[1].Value}
        if ($msvclist -ne $Null -and $msvclist.length -gt 0) {
            if ($msvclist.GetType().Name -eq "String") {
@@ -140,7 +148,9 @@ function buildInstaller($CPUTYPE)
                $runtime_version1=$msvclist[0]
            }
            if ($runtime_version1 -ne $runtime_version0) {
-               $LIBPQMSVC=findRuntime($runtime_version1)
+               $dlls=findRuntime($runtime_version1)
+               $LIBPQMSVCDLL=$dlls[0]
+               $LIBPQMSVCSYS=$dlls[1]
                Write-Host "LIBPQ requires msvcr${runtime_version1}0.dll"
            }
        }
@@ -202,7 +212,7 @@ function buildInstaller($CPUTYPE)
 
        Write-Host ".`nBuilding psqlODBC/$SUBLOC merge module..."
 
-       invoke-expression "candle -nologo -dPlatform=$CPUTYPE `"-dVERSION=$VERSION`" -dSUBLOC=$SUBLOC `"-dLIBPQBINDIR=$LIBPQBINDIR`" `"-dLIBPQMSVC=$LIBPQMSVC`" `"-dMSVCRUNTIMEDLL=$MSVCRUNTIMEDLL`" $addpara -o $CPUTYPE\psqlodbcm.wixobj psqlodbcm_cpu.wxs"
+       invoke-expression "candle -nologo -dPlatform=$CPUTYPE `"-dVERSION=$VERSION`" -dSUBLOC=$SUBLOC `"-dLIBPQBINDIR=$LIBPQBINDIR`" `"-dLIBPQMSVCDLL=$LIBPQMSVCDLL`" `"-dLIBPQMSVCSYS=$LIBPQMSVCSYS`" `"-dPODBCMSVCDLL=$PODBCMSVCDLL`" `"-dPODBCMSVCSYS=$PODBCMSVCSYS`" $addpara -o $CPUTYPE\psqlodbcm.wixobj psqlodbcm_cpu.wxs"
        if ($LASTEXITCODE -ne 0) {
            throw "Failed to build merge module"
        }
index f83c09d6269306ed73837c853ada3c8b9a6e4165..812c1a35326b17c1529de55ad452fa8344a932ef 100644 (file)
   <?define CIDPFILES = "5C9A19B5-D7C6-4bb4-BBBC-88C2A67A59B0" ?>
   <?define CIDXFILES = "121A6C41-2B8F-463D-BA84-6BF36701428A" ?>
   <?define InstallerVersion = "300" ?>
+<?if $(env.PROCESSOR_ARCHITECTURE) = x64 ?>
+  <?define SysFolder = "$(env.SystemRoot)\system32" ?>
+<?else?>
+  <?define SysFolder = "$(env.SystemRoot)\sysnative" ?>
+<?endif?>
 <?else?>
   <?define ModuleName = "psqlODBC" ?>
   <?define BIT64 = "no" ?>
   <?define CIDPFILES = "00A1ACE3-B7C2-41b8-A1F1-DB565990DA4E" ?>
   <?define CIDXFILES = "49933A1E-4350-437C-B8D5-E96AA5D61139" ?>
   <?define InstallerVersion = "150" ?>
+<?if $(env.PROCESSOR_ARCHITECTURE) = x64 ?>
+  <?define SysFolder = "$(env.SystemRoot)\syswow64" ?>
+<?else?>
+  <?define SysFolder = "$(env.SystemRoot)\system32" ?>
+<?endif?>
 <?endif?>
 
   <Module
           <File Id="pgenlista.dll" Name="pgenlista.dll" Source="../$(var.ANSIFOLDER)/pgenlista.dll" />
           <File Id="pgenlista.pdb" Name="pgenlista.pdb" Source="../$(var.ANSIFOLDER)/pgenlista.pdb" />
    <!-- MSVC Runtime -->
-<?if "$(var.MSVCRUNTIMEDLL)" != "" ?>
-          <File Source="$(var.MSVCRUNTIMEDLL)" />
+<?if "$(var.PODBCMSVCDLL)" != "" ?>
+          <File Source="$(var.PODBCMSVCDLL)" />
+<?endif?>
+<?if "$(var.PODBCMSVCSYS)" != "" ?>
+          <File Source="$(var.SysFolder)\$(var.PODBCMSVCSYS)" />
+<?endif?>
+<?if "$(var.LIBPQMSVCDLL)" != "" ?>
+          <File Source="$(var.LIBPQMSVCDLL)" />
 <?endif?>
-<?if "$(var.LIBPQMSVC)" != "" ?>
-          <File Source="$(var.LIBPQMSVC)" />
+<?if "$(var.LIBPQMSVCSYS)" != "" ?>
+          <File Source="$(var.SysFolder)\$(var.LIBPQMSVCSYS)" />
 <?endif?>
 
           <File Id="libpq.dll" Name="libpq.dll" Source="$(var.LIBPQBINDIR)\libpq.dll" KeyPath="yes" />