From cbb9d90a2ea64b7922658b0760793a8ebbfe1a2a Mon Sep 17 00:00:00 2001 From: Todor Prokopov Date: Sat, 28 Oct 2023 04:00:49 +0300 Subject: [PATCH] [libpq] Fix MinGW build (#34747) --- ports/libpq/portfile.cmake | 4 ++-- ports/libpq/unix/python.patch | 16 +++++++++++++--- ports/libpq/vcpkg.json | 1 + versions/baseline.json | 2 +- versions/l-/libpq.json | 5 +++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ports/libpq/portfile.cmake b/ports/libpq/portfile.cmake index 77abf18c27..d700306b94 100644 --- a/ports/libpq/portfile.cmake +++ b/ports/libpq/portfile.cmake @@ -24,7 +24,6 @@ vcpkg_extract_source_archive( file(GLOB _py3_include_path "${CURRENT_HOST_INSTALLED_DIR}/include/python3*") string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp "${_py3_include_path}") set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_1}") -vcpkg_replace_string("${SOURCE_PATH}/configure.ac" "python_version=3.REPLACEME" "python_version=3.${PYTHON_VERSION_MINOR}") if("client" IN_LIST FEATURES) set(HAS_TOOLS TRUE) @@ -89,7 +88,7 @@ else() file(COPY "${CMAKE_CURRENT_LIST_DIR}/Makefile" DESTINATION "${SOURCE_PATH}") vcpkg_list(SET BUILD_OPTS) - foreach(option IN ITEMS icu lz4 nls openssl python readline xml xslt zlib zstd) + foreach(option IN ITEMS icu lz4 nls openssl readline xml xslt zlib zstd) if(option IN_LIST FEATURES) list(APPEND BUILD_OPTS --with-${option}) else() @@ -103,6 +102,7 @@ else() endif() endif() if("python" IN_LIST FEATURES) + list(APPEND BUILD_OPTS --with-python=3.${PYTHON_VERSION_MINOR}) vcpkg_find_acquire_program(PYTHON3) list(APPEND BUILD_OPTS "PYTHON=${PYTHON3}") endif() diff --git a/ports/libpq/unix/python.patch b/ports/libpq/unix/python.patch index c83458025b..7d8f58d4af 100644 --- a/ports/libpq/unix/python.patch +++ b/ports/libpq/unix/python.patch @@ -1,14 +1,24 @@ diff --git a/configure.ac b/configure.ac -index a35395e..3c1b3e2 100644 +index 7f97248992..33b6c84fc4 100644 --- a/configure.ac +++ b/configure.ac -@@ -1176,7 +1176,19 @@ fi +@@ -891,7 +891,9 @@ AC_SUBST(with_perl) + # Optionally build Python modules (PL/Python) + # + AC_MSG_CHECKING([whether to build Python modules]) +-PGAC_ARG_BOOL(with, python, no, [build Python modules (PL/Python)]) ++PGAC_ARG_OPTARG(with, python, [PYTHON_VERSION], [build Python modules (PL/Python)], ++ [], ++ [python_version=$withval]) + AC_MSG_RESULT([$with_python]) + AC_SUBST(with_python) + +@@ -1214,7 +1216,18 @@ fi if test "$with_python" = yes; then PGAC_PATH_PYTHON - PGAC_CHECK_PYTHON_EMBED_SETUP + python_majorversion=3 -+ python_version=3.REPLACEME + PKG_CHECK_MODULES(PYTHON_EMBED, python-${python_version}-embed) + python_includespec="${PYTHON_EMBED_CFLAGS}" + python_libdir=[$(echo " ${PYTHON_EMBED_LIBS}" | sed -e 's/\( -L[^ ]*\).*/\1/' -e 's/^.* -L//')] diff --git a/ports/libpq/vcpkg.json b/ports/libpq/vcpkg.json index 13e9e6d4b2..5cf4153e6e 100644 --- a/ports/libpq/vcpkg.json +++ b/ports/libpq/vcpkg.json @@ -1,6 +1,7 @@ { "name": "libpq", "version": "16.0", + "port-version": 1, "description": "The official database access API of postgresql", "homepage": "https://www.postgresql.org/", "license": "PostgreSQL", diff --git a/versions/baseline.json b/versions/baseline.json index 55d3f4f433..1c9848874a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4590,7 +4590,7 @@ }, "libpq": { "baseline": "16.0", - "port-version": 0 + "port-version": 1 }, "libpqxx": { "baseline": "7.8.1", diff --git a/versions/l-/libpq.json b/versions/l-/libpq.json index c19c69f992..5344e706af 100644 --- a/versions/l-/libpq.json +++ b/versions/l-/libpq.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1f0007ec87e337d4f484164ecf589395b174d044", + "version": "16.0", + "port-version": 1 + }, { "git-tree": "cbd6314cbfd04132985a7a6412184d368c3cd0b6", "version": "16.0",