Skip to content

Commit

Permalink
[libpq] update to 14.4 and pass flags in msbuild (#26051)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Neumann-A authored Aug 5, 2022
1 parent 02b300f commit 52b6604
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 9 deletions.
25 changes: 25 additions & 0 deletions ports/libpq/libpq.props.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<CLCompile>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_DEBUG@</AdditionalOptions>
</CLCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG@</AdditionalOptions>
</Link>
<Lib>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG@</AdditionalOptions>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<CLCompile>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_RELEASE@</AdditionalOptions>
</CLCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE@</AdditionalOptions>
</Link>
<Lib>
<AdditionalOptions>%(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE@</AdditionalOptions>
</Lib>
</ItemDefinitionGroup>
</Project>
2 changes: 1 addition & 1 deletion ports/libpq/patches/fix-configure.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 18 additions & 0 deletions ports/libpq/patches/windows/macro-def.patch
Original file line number Diff line number Diff line change
@@ -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,
13 changes: 9 additions & 4 deletions ports/libpq/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -165,13 +169,15 @@ 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
/p:UseIntelMKL=No
/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}\""
)
Expand Down Expand Up @@ -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")
Expand Down
7 changes: 5 additions & 2 deletions ports/libpq/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -14,6 +13,10 @@
"bonjour"
],
"platform": "osx"
},
{
"name": "vcpkg-cmake-get-vars",
"host": true
}
],
"default-features": [
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libpq.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2b3456bfb8b04525c44007f3c8a04b7e208d639d",
"version": "14.4",
"port-version": 0
},
{
"git-tree": "2b437be1592b794cb09437beba153937991a189a",
"version": "14.1",
Expand Down

0 comments on commit 52b6604

Please sign in to comment.