Skip to content

Commit 2b98b39

Browse files
Copilotzanieb
andauthored
Drop patch-apple-cross on 3.14+ (#888)
Retains the `patch-apple-cross` patch for Python 3.13 but drops it for 3.14+, where the upstream configure script now supports cross-compiling on Apple. - Changed version check from `PYTHON_MEETS_MAXIMUM_VERSION_3_12` to `PYTHON_MEETS_MAXIMUM_VERSION_3_13` in `cpython-unix/build-cpython.sh` - Restored `patch-apple-cross-3.13.patch` for Python 3.13 - Updated build script to use version-specific patches: - 3.10, 3.11: `patch-apple-cross.patch` - 3.12: `patch-apple-cross-3.12.patch` - 3.13: `patch-apple-cross-3.13.patch` - 3.14+: No patch applied <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: zanieb <[email protected]>
1 parent d5e469d commit 2b98b39

File tree

2 files changed

+90
-1
lines changed

2 files changed

+90
-1
lines changed

cpython-unix/build-cpython.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ cat Makefile.extra
5959
pushd Python-${PYTHON_VERSION}
6060

6161
# configure doesn't support cross-compiling on Apple. Teach it.
62-
if [[ "${PYBUILD_PLATFORM}" = macos* && -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_12}" ]]; then
62+
if [[ "${PYBUILD_PLATFORM}" = macos* && -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" ]]; then
6363
if [ "${PYTHON_MAJMIN_VERSION}" = "3.12" ]; then
6464
patch -p1 -i ${ROOT}/patch-apple-cross-3.12.patch
65+
elif [ "${PYTHON_MAJMIN_VERSION}" = "3.13" ]; then
66+
patch -p1 -i ${ROOT}/patch-apple-cross-3.13.patch
6567
else
6668
patch -p1 -i ${ROOT}/patch-apple-cross.patch
6769
fi
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
diff --git a/configure.ac b/configure.ac
2+
index 58f54076ff2..a734260691a 100644
3+
--- a/configure.ac
4+
+++ b/configure.ac
5+
@@ -330,6 +330,21 @@ then
6+
*-apple-ios*)
7+
ac_sys_system=iOS
8+
;;
9+
+ *-apple-ios*)
10+
+ ac_sys_system=iOS
11+
+ ;;
12+
+ *-apple-tvos*)
13+
+ ac_sys_system=tvOS
14+
+ ;;
15+
+ *-apple-watchos*)
16+
+ ac_sys_system=watchOS
17+
+ ;;
18+
+ *-*-darwin*)
19+
+ ac_sys_system=Darwin
20+
+ ;;
21+
+ *-apple-*)
22+
+ ac_sys_system=Darwin
23+
+ ;;
24+
*-*-vxworks*)
25+
ac_sys_system=VxWorks
26+
;;
27+
@@ -771,6 +786,15 @@ if test "$cross_compiling" = yes; then
28+
;;
29+
esac
30+
;;
31+
+ *-*-darwin*)
32+
+ case "$host_cpu" in
33+
+ arm*)
34+
+ _host_ident=arm
35+
+ ;;
36+
+ *)
37+
+ _host_ident=$host_cpu
38+
+ esac
39+
+ ;;
40+
*-*-vxworks*)
41+
_host_ident=$host_cpu
42+
;;
43+
@@ -785,6 +809,23 @@ if test "$cross_compiling" = yes; then
44+
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_ident:+-$_host_ident}"
45+
fi
46+
47+
+# The _PYTHON_HOST_PLATFORM environment variable is used to
48+
+# override the platform name in distutils and sysconfig when
49+
+# cross-compiling. On Apple, the platform name expansion logic
50+
+# is non-trivial, including renaming MACHDEP=darwin to macosx
51+
+# and including the deployment target (or current OS version if
52+
+# not set). Here we always force an override based on the target
53+
+# triple. We do this in all build configurations because historically
54+
+# the automatic resolution has been brittle.
55+
+case "$host" in
56+
+aarch64-apple-darwin*)
57+
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-arm64"
58+
+ ;;
59+
+x86_64-apple-darwin*)
60+
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-x86_64"
61+
+ ;;
62+
+esac
63+
+
64+
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
65+
# disable features if it is defined, without any means to access these
66+
# features as extensions. For these systems, we skip the definition of
67+
@@ -1582,7 +1623,7 @@ if test $enable_shared = "yes"; then
68+
BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(LDVERSION)'
69+
RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}
70+
;;
71+
- Darwin*)
72+
+ Darwin*|iOS*|tvOS*|watchOS*)
73+
LDLIBRARY='libpython$(LDVERSION).dylib'
74+
BLDLIBRARY='-L. -lpython$(LDVERSION)'
75+
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
76+
@@ -3469,6 +3510,11 @@ then
77+
Linux*|GNU*|QNX*|VxWorks*|Haiku*)
78+
LDSHARED='$(CC) -shared'
79+
LDCXXSHARED='$(CXX) -shared';;
80+
+ iOS*|tvOS*|watchOS*)
81+
+ LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
82+
+ LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
83+
+ BLDSHARED="$LDSHARED"
84+
+ ;;
85+
FreeBSD*)
86+
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
87+
then

0 commit comments

Comments
 (0)