Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python3] Fix lld-link and add port config for python site #36245

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ports/python3/0016-undup-ffi-symbols.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/Modules/_ctypes/malloc_closure.c b/Modules/_ctypes/malloc_closure.c
index 788bae6a9..3938f79db 100644
--- a/Modules/_ctypes/malloc_closure.c
+++ b/Modules/_ctypes/malloc_closure.c
@@ -11,6 +11,9 @@
#endif
#include "ctypes.h"

+#undef Py_ffi_closure_alloc
+#undef Py_ffi_closure_free
+
/* BLOCKSIZE can be adjusted. Larger blocksize will take a larger memory
overhead, but allocate less blocks from the system. It may be that some
systems have a limit of how many mmap'd blocks can be open.
10 changes: 10 additions & 0 deletions ports/python3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ set(PATCHES
0012-force-disable-modules.patch
0014-fix-get-python-inc-output.patch
0015-dont-use-WINDOWS-def.patch
0016-undup-ffi-symbols.patch # Required for lld-link.
0018-fix-sysconfig-include.patch
)

Expand Down Expand Up @@ -375,3 +376,12 @@ if (NOT VCPKG_TARGET_IS_WINDOWS)
replace_dirs_in_config_file("${python_config_file}")
endif()
endif()

if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/python3/Lib/distutils/command/build_ext.py" "'libs'" "'../../lib'")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/python3.${PYTHON_VERSION_MINOR}/distutils/command/build_ext.py" "'libs'" "'../../lib'")
file(COPY_FILE "${CURRENT_PACKAGES_DIR}/tools/python3/python3.${PYTHON_VERSION_MINOR}" "${CURRENT_PACKAGES_DIR}/tools/python3/python3")
endif()

configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" "${CURRENT_PACKAGES_DIR}/share/python3/vcpkg-port-config.cmake" @ONLY)
12 changes: 12 additions & 0 deletions ports/python3/vcpkg-port-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(PYTHON3_VERSION "@VERSION@")
set(PYTHON3_VERSION_MAJOR "@PYTHON_VERSION_MAJOR@")
set(PYTHON3_VERSION_MINOR "@PYTHON_VERSION_MINOR@")
set(PYTHON3_INCLUDE "include/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}")
set(site_base "")
if(VCPKG_TARGET_IS_WINDOWS)
set(site_base "tools/python${PYTHON3_VERSION_MAJOR}/Lib")
else()
set(site_base "lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}")
endif()
set(PYTHON3_SITE "${site_base}/site-packages")

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": "3.11.5",
"port-version": 3,
"port-version": 4,
"description": "The Python programming language",
"homepage": "https://github.com/python/cpython",
"license": "Python-2.0",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6906,7 +6906,7 @@
},
"python3": {
"baseline": "3.11.5",
"port-version": 3
"port-version": 4
},
"qca": {
"baseline": "2.3.7",
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": "196d8baf56879fd416fbcfb05a7033ea61febf24",
"version": "3.11.5",
"port-version": 4
},
{
"git-tree": "e6acf202b9752a04a0b9557d1ea9e4fa2f427e8d",
"version": "3.11.5",
Expand Down