forked from indygreg/python-build-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add patch for Apple cross compilation on 3.13+
- Loading branch information
Showing
2 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
diff --git a/configure.ac b/configure.ac | ||
index c62a565eb6..7e5d34632c 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -545,6 +545,15 @@ then | ||
*-*-cygwin*) | ||
ac_sys_system=Cygwin | ||
;; | ||
+ *-apple-ios*) | ||
+ ac_sys_system=iOS | ||
+ ;; | ||
+ *-apple-tvos*) | ||
+ ac_sys_system=tvOS | ||
+ ;; | ||
+ *-apple-watchos*) | ||
+ ac_sys_system=watchOS | ||
+ ;; | ||
*-*-vxworks*) | ||
ac_sys_system=VxWorks | ||
;; | ||
@@ -600,6 +609,19 @@ if test "$cross_compiling" = yes; then | ||
*-*-cygwin*) | ||
_host_cpu= | ||
;; | ||
+ *-*-darwin*) | ||
+ _host_cpu= | ||
+ ;; | ||
+ *-apple-*) | ||
+ case "$host_cpu" in | ||
+ arm*) | ||
+ _host_cpu=arm | ||
+ ;; | ||
+ *) | ||
+ _host_cpu=$host_cpu | ||
+ ;; | ||
+ esac | ||
+ ;; | ||
*-*-vxworks*) | ||
_host_cpu=$host_cpu | ||
;; | ||
@@ -614,6 +636,23 @@ if test "$cross_compiling" = yes; then | ||
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" | ||
fi | ||
|
||
+# The _PYTHON_HOST_PLATFORM environment variable is used to | ||
+# override the platform name in distutils and sysconfig when | ||
+# cross-compiling. On Apple, the platform name expansion logic | ||
+# is non-trivial, including renaming MACHDEP=darwin to macosx | ||
+# and including the deployment target (or current OS version if | ||
+# not set). Here we always force an override based on the target | ||
+# triple. We do this in all build configurations because historically | ||
+# the automatic resolution has been brittle. | ||
+case "$host" in | ||
+aarch64-apple-darwin*) | ||
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-arm64" | ||
+ ;; | ||
+x86_64-apple-darwin*) | ||
+ _PYTHON_HOST_PLATFORM="macosx-${MACOSX_DEPLOYMENT_TARGET}-x86_64" | ||
+ ;; | ||
+esac | ||
+ | ||
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they | ||
# disable features if it is defined, without any means to access these | ||
# features as extensions. For these systems, we skip the definition of | ||
@@ -1582,7 +1621,7 @@ if test $enable_shared = "yes"; then | ||
BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(LDVERSION)' | ||
RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}} | ||
;; | ||
- Darwin*) | ||
+ Darwin*|iOS*|tvOS*|watchOS*) | ||
LDLIBRARY='libpython$(LDVERSION).dylib' | ||
BLDLIBRARY='-L. -lpython$(LDVERSION)' | ||
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}} | ||
@@ -3173,6 +3203,11 @@ then | ||
Linux*|GNU*|QNX*|VxWorks*|Haiku*) | ||
LDSHARED='$(CC) -shared' | ||
LDCXXSHARED='$(CXX) -shared';; | ||
+ iOS*|tvOS*|watchOS*) | ||
+ LDSHARED='$(CC) -bundle -undefined dynamic_lookup' | ||
+ LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' | ||
+ BLDSHARED="$LDSHARED" | ||
+ ;; | ||
FreeBSD*) | ||
if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] | ||
then |