[libpq] Fix MinGW build (#34747)

This commit is contained in:
Todor Prokopov 2023-10-28 04:00:49 +03:00 committed by GitHub
parent 4b00fb593f
commit cbb9d90a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 6 deletions

View File

@ -24,7 +24,6 @@ vcpkg_extract_source_archive(
file(GLOB _py3_include_path "${CURRENT_HOST_INSTALLED_DIR}/include/python3*") file(GLOB _py3_include_path "${CURRENT_HOST_INSTALLED_DIR}/include/python3*")
string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp "${_py3_include_path}") string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp "${_py3_include_path}")
set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_1}") 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) if("client" IN_LIST FEATURES)
set(HAS_TOOLS TRUE) set(HAS_TOOLS TRUE)
@ -89,7 +88,7 @@ else()
file(COPY "${CMAKE_CURRENT_LIST_DIR}/Makefile" DESTINATION "${SOURCE_PATH}") file(COPY "${CMAKE_CURRENT_LIST_DIR}/Makefile" DESTINATION "${SOURCE_PATH}")
vcpkg_list(SET BUILD_OPTS) 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) if(option IN_LIST FEATURES)
list(APPEND BUILD_OPTS --with-${option}) list(APPEND BUILD_OPTS --with-${option})
else() else()
@ -103,6 +102,7 @@ else()
endif() endif()
endif() endif()
if("python" IN_LIST FEATURES) if("python" IN_LIST FEATURES)
list(APPEND BUILD_OPTS --with-python=3.${PYTHON_VERSION_MINOR})
vcpkg_find_acquire_program(PYTHON3) vcpkg_find_acquire_program(PYTHON3)
list(APPEND BUILD_OPTS "PYTHON=${PYTHON3}") list(APPEND BUILD_OPTS "PYTHON=${PYTHON3}")
endif() endif()

View File

@ -1,14 +1,24 @@
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index a35395e..3c1b3e2 100644 index 7f97248992..33b6c84fc4 100644
--- a/configure.ac --- a/configure.ac
+++ b/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 if test "$with_python" = yes; then
PGAC_PATH_PYTHON PGAC_PATH_PYTHON
- PGAC_CHECK_PYTHON_EMBED_SETUP - PGAC_CHECK_PYTHON_EMBED_SETUP
+ python_majorversion=3 + python_majorversion=3
+ python_version=3.REPLACEME
+ PKG_CHECK_MODULES(PYTHON_EMBED, python-${python_version}-embed) + PKG_CHECK_MODULES(PYTHON_EMBED, python-${python_version}-embed)
+ python_includespec="${PYTHON_EMBED_CFLAGS}" + python_includespec="${PYTHON_EMBED_CFLAGS}"
+ python_libdir=[$(echo " ${PYTHON_EMBED_LIBS}" | sed -e 's/\( -L[^ ]*\).*/\1/' -e 's/^.* -L//')] + python_libdir=[$(echo " ${PYTHON_EMBED_LIBS}" | sed -e 's/\( -L[^ ]*\).*/\1/' -e 's/^.* -L//')]

View File

@ -1,6 +1,7 @@
{ {
"name": "libpq", "name": "libpq",
"version": "16.0", "version": "16.0",
"port-version": 1,
"description": "The official database access API of postgresql", "description": "The official database access API of postgresql",
"homepage": "https://www.postgresql.org/", "homepage": "https://www.postgresql.org/",
"license": "PostgreSQL", "license": "PostgreSQL",

View File

@ -4590,7 +4590,7 @@
}, },
"libpq": { "libpq": {
"baseline": "16.0", "baseline": "16.0",
"port-version": 0 "port-version": 1
}, },
"libpqxx": { "libpqxx": {
"baseline": "7.8.1", "baseline": "7.8.1",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "1f0007ec87e337d4f484164ecf589395b174d044",
"version": "16.0",
"port-version": 1
},
{ {
"git-tree": "cbd6314cbfd04132985a7a6412184d368c3cd0b6", "git-tree": "cbd6314cbfd04132985a7a6412184d368c3cd0b6",
"version": "16.0", "version": "16.0",