Skip to content

Commit 8823499

Browse files
committed
unix: set _PYTHON_HOST_PLATFORM when targeting x86_64-apple-darwin
When commit a7fc6cf (#150) unbusted aarch64 -> x86-64 cross-compilation on macOS, the produced distributions failed validation because the sysconfig reported platform tag was wrong. We extend our existing configure patch to handle the x86_64-apple-darwin target to ensure the platform tag is defined correctly. As part of this we refresh the entire patch against the CPython 3.11. Fortunately it still appears to apply on older Python versions.
1 parent 5ba2246 commit 8823499

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

cpython-unix/patch-apple-cross.patch

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/configure.ac b/configure.ac
2-
index cc69015b10..9592ec3877 100644
2+
index c62a565eb6..f39de9f98c 100644
33
--- a/configure.ac
44
+++ b/configure.ac
5-
@@ -400,6 +400,15 @@ then
5+
@@ -545,6 +545,15 @@ then
66
*-*-cygwin*)
77
ac_sys_system=Cygwin
88
;;
@@ -18,7 +18,7 @@ index cc69015b10..9592ec3877 100644
1818
*-*-vxworks*)
1919
ac_sys_system=VxWorks
2020
;;
21-
@@ -449,6 +458,19 @@ if test "$cross_compiling" = yes; then
21+
@@ -600,6 +609,19 @@ if test "$cross_compiling" = yes; then
2222
*-*-cygwin*)
2323
_host_cpu=
2424
;;
@@ -38,7 +38,7 @@ index cc69015b10..9592ec3877 100644
3838
*-*-vxworks*)
3939
_host_cpu=$host_cpu
4040
;;
41-
@@ -457,7 +479,21 @@ if test "$cross_compiling" = yes; then
41+
@@ -611,7 +633,24 @@ if test "$cross_compiling" = yes; then
4242
MACHDEP="unknown"
4343
AC_MSG_ERROR([cross build not supported for $host])
4444
esac
@@ -55,13 +55,16 @@ index cc69015b10..9592ec3877 100644
5555
+ aarch64-apple-darwin*)
5656
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-arm64"
5757
+ ;;
58+
+ x86_64-apple-darwin*)
59+
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-x86_64"
60+
+ ;;
5861
+ *)
5962
+ _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
6063
+ esac
6164
fi
6265

6366
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
64-
@@ -1171,7 +1207,7 @@ if test $enable_shared = "yes"; then
67+
@@ -1507,7 +1546,7 @@ if test $enable_shared = "yes"; then
6568
BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(LDVERSION)'
6669
RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}
6770
;;
@@ -70,7 +73,7 @@ index cc69015b10..9592ec3877 100644
7073
LDLIBRARY='libpython$(LDVERSION).dylib'
7174
BLDLIBRARY='-L. -lpython$(LDVERSION)'
7275
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
73-
@@ -1209,15 +1245,6 @@ then
76+
@@ -1626,15 +1665,6 @@ then
7477
fi
7578

7679
AC_CHECK_TOOLS([READELF], [readelf], [:])
@@ -86,8 +89,8 @@ index cc69015b10..9592ec3877 100644
8689

8790
case $MACHDEP in
8891
hp*|HP*)
89-
@@ -2715,6 +2742,11 @@ then
90-
Linux*|GNU*|QNX*|VxWorks*)
92+
@@ -3173,6 +3203,11 @@ then
93+
Linux*|GNU*|QNX*|VxWorks*|Haiku*)
9194
LDSHARED='$(CC) -shared'
9295
LDCXXSHARED='$(CXX) -shared';;
9396
+ iOS*|tvOS*|watchOS*)

0 commit comments

Comments
 (0)