Skip to content

Commit 45ad84e

Browse files
committed
unix: refresh Apple cross-compiling patch
An upcoming change to always use a host Python tickles issues with `_PYTHON_HOST_PLATFORM` not being set correctly when building a single arch aarch64-apple-darwin binary. So we refresh the patch to always set this variable.
1 parent c06c837 commit 45ad84e

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

cpython-unix/patch-apple-cross.patch

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/configure.ac b/configure.ac
2-
index c62a565eb6..f39de9f98c 100644
2+
index c62a565eb6..7e5d34632c 100644
33
--- a/configure.ac
44
+++ b/configure.ac
55
@@ -545,6 +545,15 @@ then
@@ -38,32 +38,30 @@ index c62a565eb6..f39de9f98c 100644
3838
*-*-vxworks*)
3939
_host_cpu=$host_cpu
4040
;;
41-
@@ -611,7 +633,24 @@ if test "$cross_compiling" = yes; then
42-
MACHDEP="unknown"
43-
AC_MSG_ERROR([cross build not supported for $host])
44-
esac
45-
- _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
46-
+
47-
+ case "$host" in
48-
+ # The _PYTHON_HOST_PLATFORM environment variable is used to
49-
+ # override the platform name in distutils and sysconfig when
50-
+ # cross-compiling. On Apple, the platform name expansion logic
51-
+ # is non-trivial, including renaming MACHDEP=darwin to macosx
52-
+ # and including the deployment target (or current OS version if
53-
+ # not set). Our hack here is not generic, but gets the job done
54-
+ # for python-build-standalone's cross-compile use cases.
55-
+ aarch64-apple-darwin*)
56-
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-arm64"
57-
+ ;;
58-
+ x86_64-apple-darwin*)
59-
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-x86_64"
60-
+ ;;
61-
+ *)
62-
+ _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
63-
+ esac
41+
@@ -614,6 +636,23 @@ if test "$cross_compiling" = yes; then
42+
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
6443
fi
6544

45+
+# The _PYTHON_HOST_PLATFORM environment variable is used to
46+
+# override the platform name in distutils and sysconfig when
47+
+# cross-compiling. On Apple, the platform name expansion logic
48+
+# is non-trivial, including renaming MACHDEP=darwin to macosx
49+
+# and including the deployment target (or current OS version if
50+
+# not set). Here we always force an override based on the target
51+
+# triple. We do this in all build configurations because historically
52+
+# the automatic resolution has been brittle.
53+
+case "$host" in
54+
+aarch64-apple-darwin*)
55+
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-arm64"
56+
+ ;;
57+
+x86_64-apple-darwin*)
58+
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-x86_64"
59+
+ ;;
60+
+esac
61+
+
6662
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
63+
# disable features if it is defined, without any means to access these
64+
# features as extensions. For these systems, we skip the definition of
6765
@@ -1507,7 +1546,7 @@ if test $enable_shared = "yes"; then
6866
BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(LDVERSION)'
6967
RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}

0 commit comments

Comments
 (0)