Skip to content

Commit

Permalink
[python3] Install pkg-config files on Windows platforms (microsoft#22198
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mkhon authored Jan 3, 2022
1 parent c3dfd6a commit c662463
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
11 changes: 11 additions & 0 deletions ports/python3/0009-python-embed.pc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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@
25 changes: 25 additions & 0 deletions ports/python3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ 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(
Expand Down Expand Up @@ -158,6 +159,30 @@ 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)
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)
endif()

vcpkg_fixup_pkgconfig()

vcpkg_clean_msbuild()
else()
set(OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion ports/python3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "python3",
"version-semver": "3.10.1",
"port-version": 3,
"port-version": 4,
"description": "The Python programming language",
"homepage": "https://github.com/python/cpython",
"supports": "!uwp",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5498,7 +5498,7 @@
},
"python3": {
"baseline": "3.10.1",
"port-version": 3
"port-version": 4
},
"qca": {
"baseline": "2.3.4",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/python3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "75172bc36c45d15ee298de1803625af1770cb805",
"version-semver": "3.10.1",
"port-version": 4
},
{
"git-tree": "35f071d147af8c4d8dfac5eaa95ad41e395448a5",
"version-semver": "3.10.1",
Expand Down

0 comments on commit c662463

Please sign in to comment.