mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 13:54:46 +08:00
[python3] Fix pkgconfig for debug Linux builds (#22529)
This commit is contained in:
parent
5fe063fda0
commit
19712ff43a
@ -1,11 +0,0 @@
|
||||
diff --git a/Misc/python-embed.pc.in b/Misc/python-embed.pc.in
|
||||
index 2be9df8..a2e5ff7 100644
|
||||
--- a/Misc/python-embed.pc.in
|
||||
+++ b/Misc/python-embed.pc.in
|
||||
@@ -9,5 +9,5 @@ Description: Embed Python into an application
|
||||
Requires:
|
||||
Version: @VERSION@
|
||||
Libs.private: @LIBS@
|
||||
-Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
|
||||
+Libs: -L${libdir} -lpython@ABIVERSION@@ABIFLAGS@@ABISUFFIX@
|
||||
Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
|
16
ports/python3/0009-python.pc.patch
Normal file
16
ports/python3/0009-python.pc.patch
Normal file
@ -0,0 +1,16 @@
|
||||
--- a/Misc/python.pc.in 2022-01-14 05:23:10.299912709 +0000
|
||||
+++ b/Misc/python.pc.in 2022-01-14 05:23:15.908022446 +0000
|
||||
@@ -10,4 +10,4 @@
|
||||
Version: @VERSION@
|
||||
Libs.private: @LIBS@
|
||||
Libs:
|
||||
-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
|
||||
+Cflags: -I${includedir}/python@VERSION@
|
||||
--- a/Misc/python-embed.pc.in 2022-01-14 05:22:57.043653570 +0000
|
||||
+++ b/Misc/python-embed.pc.in 2022-01-14 05:23:04.603801315 +0000
|
||||
@@ -10,4 +10,4 @@
|
||||
Version: @VERSION@
|
||||
Libs.private: @LIBS@
|
||||
Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
|
||||
-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
|
||||
+Cflags: -I${includedir}/python@VERSION@
|
@ -13,6 +13,7 @@ set(PATCHES
|
||||
0003-devendor-external-dependencies.patch
|
||||
0004-dont-copy-vcruntime.patch
|
||||
0005-only-build-required-projects.patch
|
||||
0009-python.pc.patch
|
||||
)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
list(PREPEND PATCHES 0001-static-library.patch)
|
||||
@ -33,7 +34,6 @@ if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
|
||||
if("${WINSDK_VERSION}" VERSION_GREATER_EQUAL "10.0.22000")
|
||||
list(APPEND PATCHES "0007-workaround-windows-11-sdk-rc-compiler-error.patch")
|
||||
endif()
|
||||
list(APPEND PATCHES "0009-python-embed.pc.patch")
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
@ -47,6 +47,25 @@ vcpkg_from_github(
|
||||
|
||||
vcpkg_replace_string("${SOURCE_PATH}/Makefile.pre.in" "$(INSTALL) -d -m $(DIRMODE)" "$(MKDIR_P)")
|
||||
|
||||
function(make_python_pkgconfig)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 arg "" "FILE;INSTALL_ROOT;EXEC_PREFIX;INCLUDEDIR;ABIFLAGS" "")
|
||||
|
||||
set(prefix "${CURRENT_PACKAGES_DIR}")
|
||||
set(libdir [[${prefix}/lib]])
|
||||
set(exec_prefix ${arg_EXEC_PREFIX})
|
||||
set(includedir ${arg_INCLUDEDIR})
|
||||
set(VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
|
||||
set(ABIFLAGS ${arg_ABIFLAGS})
|
||||
|
||||
string(REPLACE "python" "python-${VERSION}" out_file ${arg_FILE})
|
||||
set(out_full_path "${arg_INSTALL_ROOT}/lib/pkgconfig/${out_file}")
|
||||
configure_file("${SOURCE_PATH}/Misc/${arg_FILE}.in" ${out_full_path} @ONLY)
|
||||
|
||||
file(READ ${out_full_path} pkgconfig_file)
|
||||
string(REPLACE "-lpython${VERSION}" "-lpython${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}" pkgconfig_file "${pkgconfig_file}")
|
||||
file(WRITE ${out_full_path} "${pkgconfig_file}")
|
||||
endfunction()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
|
||||
# Due to the way Python handles C extension modules on Windows, a static python core cannot
|
||||
# load extension modules.
|
||||
@ -161,25 +180,18 @@ if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
|
||||
endif()
|
||||
|
||||
# pkg-config files
|
||||
set(prefix "${CURRENT_PACKAGES_DIR}")
|
||||
set(libdir [[${prefix}/lib]])
|
||||
set(ABIVERSION "${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
|
||||
set(VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
set(exec_prefix "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
||||
set(includedir [[${prefix}/include]])
|
||||
set(ABISUFFIX "")
|
||||
configure_file("${SOURCE_PATH}/Misc/python.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/python-${VERSION}.pc" @ONLY)
|
||||
configure_file("${SOURCE_PATH}/Misc/python-embed.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/python-${VERSION}-embed.pc" @ONLY)
|
||||
make_python_pkgconfig(FILE python.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
|
||||
EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
|
||||
make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT ${CURRENT_PACKAGES_DIR}
|
||||
EXEC_PREFIX "\${prefix}/tools/${PORT}" INCLUDEDIR [[${prefix}/include]] ABIFLAGS "")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
set(exec_prefix "\${prefix}/../tools/${PORT}")
|
||||
set(includedir [[${prefix}/../include]])
|
||||
set(ABISUFFIX "_d")
|
||||
configure_file("${SOURCE_PATH}/Misc/python.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/python-${VERSION}.pc" @ONLY)
|
||||
configure_file("${SOURCE_PATH}/Misc/python-embed.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/python-${VERSION}-embed.pc" @ONLY)
|
||||
make_python_pkgconfig(FILE python.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
|
||||
EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
|
||||
make_python_pkgconfig(FILE python-embed.pc INSTALL_ROOT "${CURRENT_PACKAGES_DIR}/debug"
|
||||
EXEC_PREFIX "\${prefix}/../tools/${PORT}" INCLUDEDIR [[${prefix}/../include]] ABIFLAGS "_d")
|
||||
endif()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "python3",
|
||||
"version-semver": "3.10.1",
|
||||
"port-version": 5,
|
||||
"port-version": 6,
|
||||
"description": "The Python programming language",
|
||||
"homepage": "https://github.com/python/cpython",
|
||||
"license": "Python-2.0",
|
||||
|
@ -5538,7 +5538,7 @@
|
||||
},
|
||||
"python3": {
|
||||
"baseline": "3.10.1",
|
||||
"port-version": 5
|
||||
"port-version": 6
|
||||
},
|
||||
"qca": {
|
||||
"baseline": "2.3.4",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "a7ef4a1d73a9e486cd23edd98f12a2f4d4216920",
|
||||
"version-semver": "3.10.1",
|
||||
"port-version": 6
|
||||
},
|
||||
{
|
||||
"git-tree": "c9b705608afc0485c03effb5aaa439f027b20af4",
|
||||
"version-semver": "3.10.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user