[libpq] Update to 12.2 and some feature fixes (#10915)

* fix number of spaces in string replacement

* fix libiconv library name

* [libpq] update to 12.2
fix some issues with features
feature combination client+nls does not compile with latest VS
due to libpq src's accessing an implementation detail (needs upstream fix)

* on arm skip host openssl version check if host cannot execute the triplet version

* use PORT_VERSION to update the version references more easily

* fix tcl and python feature on windows
This commit is contained in:
Alexander Neumann 2020-05-18 19:36:03 +02:00 committed by GitHub
parent 8a583e80da
commit 6b871df7e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 213 additions and 50 deletions

View File

@ -1,5 +1,5 @@
Source: libpq
Version: 12.0-2
Version: 12.2
Build-Depends: libpq[bonjour] (osx)
Supports: !uwp
Homepage: https://www.postgresql.org/
@ -23,15 +23,15 @@ Build-Depends: libedit
Description: prefer libedit (--with-libedit-preferred)
Feature: perl
Build-Depends: perl
Build-Depends: perl, libpq[core,client]
Description: build the server programming language PL/Perl (dynamic only?) (--with-perl)
Feature: python
Build-Depends: python
Build-Depends: python3, libpq[core,client]
Description: build the PL/Python server programming language (dynamic only?) (--with-python)
Feature: tcl
Build-Depends: tcl
Build-Depends: tcl, libpq[core,client]
Description: build the PL/Tcl procedural language(dynamic only?) (--with-tcl)
Feature: nls

View File

@ -0,0 +1,13 @@
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index 823357c02..b93992f22 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -381,7 +381,7 @@ EOF
print $f <<EOF;
<PreLinkEvent>
<Message>Generate DEF file</Message>
- <Command>perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}</Command>
+ <Command>perl "src\\tools\\msvc\\gendef.pl" $cfgname\\$self->{name} $self->{platform}</Command>
</PreLinkEvent>
EOF
}

View File

@ -110,7 +110,7 @@ index 51711c2bf..d33fdc3b0 100644
{
$proj->AddIncludeDir($self->{options}->{iconv} . '\include');
- $proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib');
+ $proj->AddLibrary($self->{options}->{iconv} . '\debug\lib\iconv.lib'); # This must be updated
+ $proj->AddLibrary($self->{options}->{iconv} . '\debug\lib\libiconv.lib'); # This must be updated
}
if ($self->{options}->{icu})
{

View File

@ -110,7 +110,7 @@ index 51711c2bf..d33fdc3b0 100644
{
$proj->AddIncludeDir($self->{options}->{iconv} . '\include');
- $proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib');
+ $proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib'); # This must be updated
+ $proj->AddLibrary($self->{options}->{iconv} . '\lib\libiconv.lib'); # This must be updated
}
if ($self->{options}->{icu})
{

View File

@ -0,0 +1,38 @@
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 25a549015..9018270ab 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -132,21 +132,21 @@ sub GetOpenSSLVersion
# Attempt to get OpenSSL version and location. This assumes that
# openssl.exe is in the specified directory.
# Quote the .exe name in case it has spaces
- my $opensslcmd =
- qq("openssl.exe" version 2>&1);
- my $sslout = `$opensslcmd`;
+ #my $opensslcmd =
+ # qq("openssl.exe" version 2>&1);
+ #my $sslout = `$opensslcmd`;
- $? >> 8 == 0
- or croak
- "Unable to determine OpenSSL version: The openssl.exe command wasn't found.";
+ #$? >> 8 == 0
+ # or croak
+ # "Unable to determine OpenSSL version: The openssl.exe command wasn't found.";
- if ($sslout =~ /(\d+)\.(\d+)\.(\d+)(\D)/m)
- {
- return ($1, $2, $3);
- }
+ #if ($sslout =~ /(\d+)\.(\d+)\.(\d+)(\D)/m)
+ #{
+ return (1, 1, 1);
+ #}
- croak
- "Unable to determine OpenSSL version: The openssl.exe version could not be determined.";
+ #croak
+ # "Unable to determine OpenSSL version: The openssl.exe version could not be determined.";
}
sub GenerateFiles

View File

@ -0,0 +1,13 @@
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 66c0c3483..2154c6cf6 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -728,7 +728,7 @@ sub GenerateNLSFiles
EnsureDirectories($target, "share/libpq/locale/$lang",
"share/libpq/locale/$lang/LC_MESSAGES");
my @args = (
- "$nlspath\\bin\\msgfmt",
+ "msgfmt.exe",
'-o',
"$target\\share\\libpq\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo",
$_);

View File

@ -2,33 +2,12 @@ diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 51711c2bf..d33fdc3b0 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -127,19 +127,19 @@ sub GetOpenSSLVersion
# openssl.exe is in the specified directory.
my $opensslcmd =
$self->{options}->{openssl} . "\\bin\\openssl.exe version 2>&1";
- my $sslout = `$opensslcmd`;
+ #my $sslout = `$opensslcmd`;
@@ -133,7 +133,7 @@ sub GetOpenSSLVersion
# openssl.exe is in the specified directory.
# Quote the .exe name in case it has spaces
my $opensslcmd =
- qq("$self->{options}->{openssl}\\bin\\openssl.exe" version 2>&1);
+ qq("openssl.exe" version 2>&1);
my $sslout = `$opensslcmd`;
- $? >> 8 == 0
- or croak
- "Unable to determine OpenSSL version: The openssl.exe command wasn't found.";
+ #$? >> 8 == 0
+ # or croak
+ # "Unable to determine OpenSSL version: The openssl.exe command wasn't found.";
- if ($sslout =~ /(\d+)\.(\d+)\.(\d+)(\D)/m)
- {
- return ($1, $2, $3);
- }
+ #if ($sslout =~ /(\d+)\.(\d+)\.(\d+)(\D)/m)
+ #{
+ return (1, 1, 1);
+ #}
- croak
- "Unable to determine OpenSSL version: The openssl.exe version could not be determined.";
+ #croak
+ # "Unable to determine OpenSSL version: The openssl.exe version could not be determined.";
}
sub GenerateFiles
$? >> 8 == 0

View File

@ -0,0 +1,40 @@
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 99f39caa5..21b5559d6 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -494,14 +494,15 @@ sub mkvcbuild
# Attempt to get python version and location.
# Assume python.exe in specified dir.
- my $pythonprog = "import sys;print(sys.prefix);"
- . "print(str(sys.version_info[0])+str(sys.version_info[1]))";
- my $prefixcmd =
- $solution->{options}->{python} . "\\python -c \"$pythonprog\"";
- my $pyout = `$prefixcmd`;
- die "Could not query for python version!\n" if $?;
- my ($pyprefix, $pyver) = split(/\r?\n/, $pyout);
-
+ #my $pythonprog = "import sys;print(sys.prefix);"
+ # . "print(str(sys.version_info[0])+str(sys.version_info[1]))";
+ #my $prefixcmd =
+ # $solution->{options}->{python} . "\\python -c \"$pythonprog\"";
+ #my $pyout = `$prefixcmd`;
+ #die "Could not query for python version!\n" if $?;
+ #my ($pyprefix, $pyver) = split(/\r?\n/, $pyout);
+ my $pyprefix = $solution->{options}->{python};
+ my $pyver = 37;
# Sometimes (always?) if python is not present, the execution
# appears to work, but gives no data...
die "Failed to query python for version information\n"
@@ -510,8 +511,9 @@ sub mkvcbuild
my $pymajorver = substr($pyver, 0, 1);
my $plpython = $solution->AddProject('plpython' . $pymajorver,
'dll', 'PLs', 'src/pl/plpython');
- $plpython->AddIncludeDir($pyprefix . '/include');
- $plpython->AddLibrary($pyprefix . "/Libs/python$pyver.lib");
+ $plpython->AddIncludeDir($pyprefix . '/include/python3.7');
+ $plpython->AddDefine('_DEBUG'); # required for python autolink linking correctly!
+ $plpython->AddLibrary($pyprefix . "/debug/lib/python$pyver" . "_d.lib");
$plpython->AddReference($postgres);
# Add transform modules dependent on plpython

View File

@ -0,0 +1,39 @@
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 99f39caa5..21b5559d6 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -494,14 +494,15 @@ sub mkvcbuild
# Attempt to get python version and location.
# Assume python.exe in specified dir.
- my $pythonprog = "import sys;print(sys.prefix);"
- . "print(str(sys.version_info[0])+str(sys.version_info[1]))";
- my $prefixcmd =
- $solution->{options}->{python} . "\\python -c \"$pythonprog\"";
- my $pyout = `$prefixcmd`;
- die "Could not query for python version!\n" if $?;
- my ($pyprefix, $pyver) = split(/\r?\n/, $pyout);
-
+ #my $pythonprog = "import sys;print(sys.prefix);"
+ # . "print(str(sys.version_info[0])+str(sys.version_info[1]))";
+ #my $prefixcmd =
+ # $solution->{options}->{python} . "\\python -c \"$pythonprog\"";
+ #my $pyout = `$prefixcmd`;
+ #die "Could not query for python version!\n" if $?;
+ #my ($pyprefix, $pyver) = split(/\r?\n/, $pyout);
+ my $pyprefix = $solution->{options}->{python};
+ my $pyver = 37;
# Sometimes (always?) if python is not present, the execution
# appears to work, but gives no data...
die "Failed to query python for version information\n"
@@ -510,8 +511,8 @@ sub mkvcbuild
my $pymajorver = substr($pyver, 0, 1);
my $plpython = $solution->AddProject('plpython' . $pymajorver,
'dll', 'PLs', 'src/pl/plpython');
- $plpython->AddIncludeDir($pyprefix . '/include');
- $plpython->AddLibrary($pyprefix . "/Libs/python$pyver.lib");
+ $plpython->AddIncludeDir($pyprefix . '/include/python3.7');
+ $plpython->AddLibrary($pyprefix . "/lib/python$pyver.lib");
$plpython->AddReference($postgres);
# Add transform modules dependent on plpython

View File

@ -0,0 +1,17 @@
diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h
index 3a1f0d56d..6a8a09a20 100644
--- a/src/pl/plpython/plpython.h
+++ b/src/pl/plpython/plpython.h
@@ -46,12 +46,10 @@
#if defined(_MSC_VER) && defined(_DEBUG)
/* Python uses #pragma to bring in a non-default libpython on VC++ if
* _DEBUG is defined */
-#undef _DEBUG
/* Also hide away errcode, since we load Python.h before postgres.h */
#define errcode __msvc_errcode
#include <Python.h>
#undef errcode
-#define _DEBUG
#elif defined (_MSC_VER)
#define errcode __msvc_errcode
#include <Python.h>

View File

@ -1,3 +1,5 @@
set(PORT_VERSION 12.2)
macro(feature_unsupported)
foreach(_feat ${ARGN})
if("${FEATURES}" MATCHES "${_feat}")
@ -18,7 +20,7 @@ if(VCPKG_TARGET_IS_WINDOWS)
# on windows libpq seems to only depend on openssl gss(kerberos) and ldap on the soruce site_name
# the configuration header depends on zlib, nls, ldap, uuid, xml, xlst,gss,openssl,icu
feature_unsupported(readline bonjour libedit kerberos bsd systemd llvm pam)
feature_not_implemented_yet(perl python tcl uuid)
feature_not_implemented_yet(perl uuid)
elseif(VCPKG_TARGET_IS_OSX)
feature_not_implemented_yet(readline libedit kerberos bsd systemd llvm pam perl python tcl uuid)
else()
@ -27,9 +29,9 @@ endif()
## Download and extract sources
vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.postgresql.org/pub/source/v12.0/postgresql-12.0.tar.bz2"
FILENAME "postgresql-12.0.tar.bz2"
SHA512 231a0b5c181c33cb01c3f39de1802319b79eceec6997935ab8605dea1f4583a52d0d16e5a70fcdeea313462f062503361d543433ee03d858ba332c72a665f696
URLS "https://ftp.postgresql.org/pub/source/v${PORT_VERSION}/postgresql-${PORT_VERSION}.tar.bz2"
FILENAME "postgresql-${PORT_VERSION}.tar.bz2"
SHA512 0e0ce8e21856e8f43e58b840c10c4e3ffae6d5207e0d778e9176e36f8e20e34633cbb06f0030a7c963c3491bb7e941456d91b55444c561cfc6f283fba76f33ee
)
set(PATCHES
@ -37,6 +39,9 @@ set(PATCHES
patches/windows/win_bison_flex.patch
patches/windows/openssl_exe_path.patch
patches/windows/Solution.patch
patches/windows/MSBuildProject_fix_gendef_perl.patch
patches/windows/msgfmt.patch
patches/windows/python_lib.patch
patches/linux/configure.patch)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
@ -48,6 +53,7 @@ if(VCPKG_CRT_LINKAGE STREQUAL static)
endif()
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
list(APPEND PATCHES patches/windows/arm.patch)
list(APPEND PATCHES patches/windows/host_skip_openssl.patch) # Skip openssl.exe version check since it cannot be executed by the host
endif()
if(NOT "${FEATURES}" MATCHES "client")
list(APPEND PATCHES patches/windows/minimize_install.patch)
@ -66,17 +72,17 @@ foreach(program_name BISON FLEX PERL)
vcpkg_find_acquire_program(${program_name})
get_filename_component(${program_name}_EXE_PATH ${${program_name}} DIRECTORY)
vcpkg_add_to_path(PREPEND "${${program_name}_EXE_PATH}")
set(buildenv_contents "${buildenv_contents}\n\$ENV{PATH}=\$ENV{PATH} . ';${${program_name}_EXE_PATH}';")
set(buildenv_contents "${buildenv_contents}\n\$ENV{'PATH'}=\$ENV{'PATH'} . ';${${program_name}_EXE_PATH}';")
endforeach()
## Setup build types
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE MATCHES "[Rr][Ee][Ll][Ee][Aa][Ss][Ee]")
set(_buildtype RELEASE)
set(_short rel)
list(APPEND port_config_list ${_buildtype})
set(INSTALL_PATH_SUFFIX_${_buildtype} "")
set(BUILDPATH_${_buildtype} "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${_short}")
file(REMOVE_RECURSE "${BUILDPATH_${_buildtype}}") #Clean old builds
set(PACKAGE_DIR_${_buildtype} ${CURRENT_PACKAGES_DIR})
unset(_short)
unset(_buildtype)
@ -87,6 +93,7 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg
list(APPEND port_config_list ${_buildtype})
set(INSTALL_PATH_SUFFIX_${_buildtype} "/debug")
set(BUILDPATH_${_buildtype} "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${_short}")
file(REMOVE_RECURSE "${BUILDPATH_${_buildtype}}") #Clean old builds
set(PACKAGE_DIR_${_buildtype} ${CURRENT_PACKAGES_DIR}${INSTALL_PATH_SUFFIX_${_buildtype}})
unset(_short)
unset(_buildtype)
@ -108,9 +115,16 @@ if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_apply_patches(
SOURCE_PATH "${BUILDPATH_${_buildtype}}"
PATCHES patches/windows/Solution_${_buildtype}.patch
patches/windows/python3_build_${_buildtype}.patch
)
message(STATUS "Patches applied!")
file(COPY "${CURRENT_PORT_DIR}/config.pl" DESTINATION "${BUILDPATH_${_buildtype}}/src/tools/msvc")
set(MSPROJ_PERL "${BUILDPATH_${_buildtype}}/src/tools/msvc/MSBuildProject.pm")
file(READ "${MSPROJ_PERL}" _contents)
string(REPLACE "perl" "\"${PERL}\"" _contents "${_contents}")
file(WRITE "${MSPROJ_PERL}" "${_contents}")
set(CONFIG_FILE "${BUILDPATH_${_buildtype}}/src/tools/msvc/config.pl")
file(READ "${CONFIG_FILE}" _contents)
@ -120,9 +134,9 @@ if(VCPKG_TARGET_IS_WINDOWS)
## icu => undef, # --with-icu=<path> ##done
## nls => undef, # --enable-nls=<path> ##done
## tap_tests => undef, # --enable-tap-tests
## tcl => undef, # --with-tcl=<path>
## perl => undef, # --with-perl
## python => undef, # --with-python=<path>
## tcl => undef, # --with-tcl=<path> #done
## perl => undef, # --with-perl # requires a patch to the lib path and a port for it
## python => undef, # --with-python=<path> ##done
## openssl => undef, # --with-openssl=<path> ##done
## uuid => undef, # --with-ossp-uuid
## xml => undef, # --with-libxml=<path> ##done
@ -136,20 +150,30 @@ if(VCPKG_TARGET_IS_WINDOWS)
string(REPLACE "ldap => undef" "ldap => 1" _contents "${_contents}")
endif()
if("${FEATURES}" MATCHES "icu")
string(REPLACE "icu => undef" "icu => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
string(REPLACE "icu => undef" "icu => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
endif()
if("${FEATURES}" MATCHES "nls")
string(REPLACE "nls => undef" "nls => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
string(REPLACE "nls => undef" "nls => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
vcpkg_acquire_msys(MSYS_ROOT PACKAGES gettext)
vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
endif()
if("${FEATURES}" MATCHES "openssl")
set(buildenv_contents "${buildenv_contents}\n\$ENV{PATH}=\$ENV{PATH} . ';${CURRENT_INSTALLED_DIR}/tools/openssl';")
set(buildenv_contents "${buildenv_contents}\n\$ENV{'PATH'}=\$ENV{'PATH'} . ';${CURRENT_INSTALLED_DIR}/tools/openssl';")
#set(_contents "${_contents}\n\$ENV{PATH}=\$ENV{PATH} . ';${CURRENT_INSTALLED_DIR}/tools/openssl';")
string(REPLACE "openssl => undef" "openssl => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
endif()
if("${FEATURES}" MATCHES "python")
#vcpkg_find_acquire_program(PYTHON3)
#get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY)
#vcpkg_add_to_path("${PYTHON3_EXE_PATH}")
string(REPLACE "python => undef" "python => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
endif()
if("${FEATURES}" MATCHES "tcl")
string(REPLACE "tcl => undef" "tcl => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
endif()
if("${FEATURES}" MATCHES "xml")
string(REPLACE "xml => undef" "xml => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
string(REPLACE "iconv => undef" "iconv => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
string(REPLACE "xml => undef" "xml => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
string(REPLACE "iconv => undef" "iconv => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
endif()
if("${FEATURES}" MATCHES "xslt")