From 52b66042533aaf7f5721941941fd12fbf46164d4 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Fri, 5 Aug 2022 04:31:00 +0200 Subject: [PATCH] [libpq] update to 14.4 and pass flags in msbuild (#26051) * update libpq and pass flags to msbuild * v db * readd patch for linux * v db * readd patch * v db * Update ports/libpq/patches/fix-configure.patch * v db * use #pragma x_macro * v db * CI retrigger --- ports/libpq/libpq.props.in | 25 +++++++++++++++++++++ ports/libpq/patches/fix-configure.patch | 2 +- ports/libpq/patches/windows/macro-def.patch | 18 +++++++++++++++ ports/libpq/portfile.cmake | 13 +++++++---- ports/libpq/vcpkg.json | 7 ++++-- versions/baseline.json | 4 ++-- versions/l-/libpq.json | 5 +++++ 7 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 ports/libpq/libpq.props.in create mode 100644 ports/libpq/patches/windows/macro-def.patch diff --git a/ports/libpq/libpq.props.in b/ports/libpq/libpq.props.in new file mode 100644 index 00000000000..d172a4af401 --- /dev/null +++ b/ports/libpq/libpq.props.in @@ -0,0 +1,25 @@ + + + + + %(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_DEBUG@ + + + %(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG@ + + + %(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG@ + + + + + %(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_RELEASE@ + + + %(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE@ + + + %(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE@ + + + diff --git a/ports/libpq/patches/fix-configure.patch b/ports/libpq/patches/fix-configure.patch index bf7c606e7b9..716e7a0a9be 100644 --- a/ports/libpq/patches/fix-configure.patch +++ b/ports/libpq/patches/fix-configure.patch @@ -4,7 +4,7 @@ index fba79ee..4fadb94 100644 +++ b/configure.ac @@ -19,7 +19,7 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros - AC_INIT([PostgreSQL], [14.1], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/]) + AC_INIT([PostgreSQL], [14.4], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/]) -m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required. +m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_warn([unsupported],[Autoconf version 2.69 is required. diff --git a/ports/libpq/patches/windows/macro-def.patch b/ports/libpq/patches/windows/macro-def.patch new file mode 100644 index 00000000000..1d16c127082 --- /dev/null +++ b/ports/libpq/patches/windows/macro-def.patch @@ -0,0 +1,18 @@ +diff --git a/src/include/common/checksum_helper.h b/src/include/common/checksum_helper.h +index cac7570ea..d0ca1243c 100644 +--- a/src/include/common/checksum_helper.h ++++ b/src/include/common/checksum_helper.h +@@ -33,7 +28,13 @@ + */ + typedef enum pg_checksum_type + { ++#pragma push_macro("CHECKSUM_TYPE_NONE") ++#ifdef CHECKSUM_TYPE_NONE ++// winioctl.h defines CHECKSUM_TYPE_NONE to 0 as a macro. ++#undef CHECKSUM_TYPE_NONE ++#endif + CHECKSUM_TYPE_NONE, ++#pragma pop_macro("CHECKSUM_TYPE_NONE") + CHECKSUM_TYPE_CRC32C, + CHECKSUM_TYPE_SHA224, + CHECKSUM_TYPE_SHA256, diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake index 09b36591dfc..ceb44d57cf6 100644 --- a/ports/libpq/portfile.cmake +++ b/ports/libpq/portfile.cmake @@ -1,11 +1,11 @@ -set(PORT_VERSION 14.1) +set(PORT_VERSION 14.4) # NOTE: the python patches must be regenerated on version update ## Download and extract sources vcpkg_download_distfile(ARCHIVE URLS "https://ftp.postgresql.org/pub/source/v${PORT_VERSION}/postgresql-${PORT_VERSION}.tar.bz2" FILENAME "postgresql-${PORT_VERSION}.tar.bz2" - SHA512 4a0bec157d5464bb9e5f5c0eb0efdede55526e03f6f4d660b87d161a47705eb152fa0878960b1581bce42a5ed28a1f457825ea54e8d22e34b5b8eb36473ceefd + SHA512 dd2f80248684e331d2ffb1e26cd2a285df1fb18710807a0c31aedabf917912ce9267f8ca26318e5371d916c6fe476f8a17886d82d3ff86a974e6f24c19a6aafb ) set(PATCHES @@ -18,7 +18,8 @@ set(PATCHES patches/windows/python_lib.patch patches/windows/fix-compile-flag-Zi.patch patches/windows/tcl_version.patch - patches/fix-configure.patch + patches/windows/macro-def.patch + patches/fix-configure.patch ) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") @@ -84,6 +85,9 @@ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}") ## Do the build if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_cmake_get_vars(vars_file) + include("${vars_file}") + file(GLOB SOURCE_FILES ${SOURCE_PATH}/*) foreach(_buildtype ${port_config_list}) # Copy libpq sources. @@ -165,6 +169,7 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) file(WRITE "${CONFIG_FILE}" "${_contents}") file(WRITE "${BUILDPATH_${_buildtype}}/src/tools/msvc/buildenv.pl" "${buildenv_contents}") + configure_file("${CURRENT_PORT_DIR}/libpq.props.in" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/libpq.props" @ONLY) vcpkg_get_windows_sdk(VCPKG_TARGET_PLATFORM_VERSION) set(ENV{MSBFLAGS} "/p:PlatformToolset=${VCPKG_PLATFORM_TOOLSET} /p:VCPkgLocalAppDataDisabled=true @@ -172,6 +177,7 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) /p:WindowsTargetPlatformVersion=${VCPKG_TARGET_PLATFORM_VERSION} /m /p:ForceImportBeforeCppTargets=\"${SCRIPTS}/buildsystems/msbuild/vcpkg.targets\" + /p:ForceImportAfterCppTargets=\"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/libpq.props\" /p:VcpkgTriplet=${TARGET_TRIPLET} /p:VcpkgCurrentInstalledDir=\"${CURRENT_INSTALLED_DIR}\"" ) @@ -208,7 +214,6 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) message(STATUS "Installing libpq ${TARGET_TRIPLET}-${_buildtype}... done") endforeach() - message(STATUS "Cleanup libpq ${TARGET_TRIPLET}...") #Cleanup file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/libpq/vcpkg.json b/ports/libpq/vcpkg.json index 3e2532f4b4c..d8f59322b94 100644 --- a/ports/libpq/vcpkg.json +++ b/ports/libpq/vcpkg.json @@ -1,7 +1,6 @@ { "name": "libpq", - "version": "14.1", - "port-version": 2, + "version": "14.4", "description": "The official database access API of postgresql", "homepage": "https://www.postgresql.org/", "license": "PostgreSQL", @@ -14,6 +13,10 @@ "bonjour" ], "platform": "osx" + }, + { + "name": "vcpkg-cmake-get-vars", + "host": true } ], "default-features": [ diff --git a/versions/baseline.json b/versions/baseline.json index cc17dde2fdc..24d7edac1ef 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3981,8 +3981,8 @@ "port-version": 14 }, "libpq": { - "baseline": "14.1", - "port-version": 2 + "baseline": "14.4", + "port-version": 0 }, "libpqxx": { "baseline": "7.7.3", diff --git a/versions/l-/libpq.json b/versions/l-/libpq.json index 13954499188..f01f4c4651b 100644 --- a/versions/l-/libpq.json +++ b/versions/l-/libpq.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "2b3456bfb8b04525c44007f3c8a04b7e208d639d", + "version": "14.4", + "port-version": 0 + }, { "git-tree": "2b437be1592b794cb09437beba153937991a189a", "version": "14.1",