[string]$BuildConfigPath
)
-function findRuntime($runtime_version)
+function findRuntime($runtime_version, $pgmvc)
{
# where's the dll?
$rt_dllname="msvcr${runtime_version}0.dll"
- $pgmvc = $archinfo.runtime_folder
if ("$pgmvc" -ne "") {
$dllspecified = "${pgmvc}\${rt_dllname}"
if (Test-Path -Path $dllspecified) {
{
$VERSION = $configInfo.Configuration.version
- $archinfo = $configInfo.Configuration.$CPUTYPE
-
- $LIBPQVER=$archinfo.libpq.version
- if ($LIBPQVER -eq "") {
- $LIBPQVER=$LIBPQ_VERSION
- }
-
- if ($CPUTYPE -eq "x64")
- {
- $LIBPQBINDIR=$archinfo.libpq.bin
- if ($LIBPQBINDIR -eq "default") {
- if ($env:PROCESSOR_ARCHITECTURE -ne "x86") {
- $pgmfs = "$env:ProgramFiles"
- $LIBPQBINDIR = "$pgmfs\PostgreSQL\$LIBPQVER\bin"
- }
- elseif ("${env:ProgramW6432}" -ne "") {
- $pgmfs = "$env:ProgramW6432"
- $LIBPQBINDIR = "$pgmfs\PostgreSQL\$LIBPQVER\bin"
- }
- }
- }
- elseif ($CPUTYPE -eq "x86")
- {
- $LIBPQBINDIR=$archinfo.libpq.bin
- if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
- $pgmfs = "$env:ProgramFiles"
- } else {
- $pgmfs = "${env:ProgramFiles(x86)}"
- }
- if ($LIBPQBINDIR -eq "default") {
- $LIBPQBINDIR = "$pgmfs\PostgreSQL\$LIBPQVER\bin"
- }
- }
- else
- {
- throw "Unknown CPU type $CPUTYPE";
- }
+ $LIBPQBINDIR=getPGDir $configInfo $CPUTYPE "bin"
# msvc runtime psqlodbc links
$PODBCMSVCDLL = ""
$PODBCMSVPDLL = ""
# msvc runtime libpq links
$LIBPQMSVCDLL = ""
$LIBPQMSVCSYS = ""
+ $pgmvc = $configInfo.Configuration.$CPUTYPE.runtime_folder
if (-not $ExcludeRuntime) {
$toolset = $configInfo.Configuration.BuildResult.PlatformToolset
if ($toolset -match "^v(\d+)0") {
}
# where's the msvc runtime dll psqlodbc links?
if ([int] $runtime_version0 -lt 14) {
- $dlls=findRuntime($runtime_version0)
+ $dlls=findRuntime $runtime_version0 $pgmvc
$PODBCMSVCDLL=$dlls[0]
$PODBCMSVPDLL=$PODBCMSVCDLL.Replace("msvcr", "msvcp")
$PODBCMSVCSYS=$dlls[1]
$runtime_version1=$msvclist[0]
}
if ($runtime_version1 -ne $runtime_version0) {
- $dlls=findRuntime($runtime_version1)
+ $dlls=findRuntime $runtime_version1 $pgmvc
$LIBPQMSVCDLL=$dlls[0]
$LIBPQMSVCSYS=$dlls[1]
Write-Host "LIBPQ requires msvcr${runtime_version1}0.dll"
[switch]$AlongWithInstallers
)
-function buildPlatform($platinfo, $Platform)
+function buildPlatform($configInfo, $Platform)
{
- $LIBPQVER=$platinfo.libpq.version
- if ($LIBPQVER -eq "") {
- $LIBPQVER = $LIBPQ_VERSION
- }
- $PG_INC=$platinfo.libpq.include
- $PG_LIB=$platinfo.libpq.lib
- $BUILD_MACROS=$platinfo.build_macros
- if ($Platform -eq "x64") {
- if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
- $pgmfs = "$env:ProgramW6432"
- } else {
- $pgmfs = "$env:ProgramFiles"
- }
+ if ($Platform -ieq "x64") {
+ $platinfo=$configInfo.Configuration.x64
} else {
- if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
- $pgmfs = "$env:ProgramFiles"
- } else {
- $pgmfs = "${env:ProgramFiles(x86)}"
- }
- }
- if ($PG_INC -eq "default") {
- if ($pgmfs -eq "") {
- PG_INC=""
- } else {
- $PG_INC = "$pgmfs\PostgreSQL\$LIBPQVER\include"
- }
- }
- if ($PG_LIB -eq "default") {
- if ($pgmfs -eq "") {
- PG_LIB=""
- } else {
- $PG_LIB = "$pgmfs\PostgreSQL\$LIBPQVER\lib"
- }
+ $platinfo=$configInfo.Configuration.x86
}
+ $BUILD_MACROS=$platinfo.build_macros
+ $PG_INC=getPGDir $configInfo $Platform "include"
+ $PG_LIB=getPGDir $configInfo $Platform "lib"
Write-Host "USE LIBPQ : ($PG_INC $PG_LIB)"
# build 32bit dlls
#
if ($Platform -ieq "Win32" -or $Platform -ieq "both") {
- buildPlatform $configInfo.Configuration.x86 "Win32"
+ buildPlatform $configInfo "Win32"
if ($LastExitCode -ne 0) {
$recordResult = $false
}
# build 64bit dlls
#
if ($Platform -ieq "x64" -or $Platform -ieq "both") {
- buildPlatform $configInfo.Configuration.x64 "x64"
+ buildPlatform $configInfo "x64"
if ($LastExitCode -ne 0) {
$recordResult = $false
}
}
}
+function global:getPGDir($configInfo, $Platform, $kind)
+{
+ if ($Platform -ieq "x64") {
+ $platinfo=$configInfo.Configuration.x64
+ } else {
+ $platinfo=$configInfo.Configuration.x86
+ }
+ $LIBPQVER=$platinfo.libpq.version
+ if ($LIBPQVER -eq "") {
+ $LIBPQVER = $LIBPQ_VERSION
+ }
+ if ($kind -eq "include") {
+ $result=$platinfo.libpq.include
+ } elseif ($kind -eq "lib") {
+ $result=$platinfo.libpq.lib
+ } else {
+ $result=$platinfo.libpq.bin
+ }
+ if ($result -ne "default") {
+ return $result
+ }
+ if ($Platform -ieq "x64") {
+ if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
+ $pgmfs = "$env:ProgramW6432"
+ } else {
+ $pgmfs = "$env:ProgramFiles"
+ }
+ } else {
+ if ($env:PROCESSOR_ARCHITECTURE -eq "x86") {
+ $pgmfs = "$env:ProgramFiles"
+ } else {
+ $pgmfs = "${env:ProgramFiles(x86)}"
+ }
+ }
+ if ("$pgmfs" -eq "") {
+ $result = $null
+ } else {
+ $result = "$pgmfs\PostgreSQL\$LIBPQVER\$kind"
+ }
+ return $result
+}
+
Write-Debug "configPath=$configPath"
-$global:LIBPQ_VERSION="9.3"
+$global:LIBPQ_VERSION="9.5"
$scriptPath = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition)
$global:configurationTemplatePath = "$scriptPath\configuration_template.xml"
$global:configurationXmlPath = $configPath