From d08c785695c93adb486a76c3cd5e3bfe9d76ce20 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Fri, 2 Oct 2020 00:03:12 +0200
Subject: [PATCH 17/25] cross compile darwin
By Isuru Fernando.
---
Lib/platform.py | 7 ++++++-
configure | 5 ++++-
configure.ac | 5 ++++-
setup.py | 6 +++---
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/Lib/platform.py b/Lib/platform.py
index c272c407c7..c05b9b8ea9 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -413,7 +413,12 @@ def win32_ver(release='', version='', csd='', ptype=''):
def _mac_ver_xml():
fn = '/System/Library/CoreServices/SystemVersion.plist'
if not os.path.exists(fn):
- return None
+ if 'SDKROOT' in os.environ:
+ fn = os.environ['SDKROOT'] + fn
+ if not os.path.exists(fn):
+ return None
+ else:
+ return None
try:
import plistlib
diff --git a/configure b/configure
index 91227f00be..b89d1a380a 100755
--- a/configure
+++ b/configure
@@ -3873,6 +3873,9 @@ if test "$cross_compiling" = yes; then
_host_cpu=$host_cpu
esac
;;
+ *-*-darwin*)
+ _host_cpu=$host_cpu
+ ;;
*-*-cygwin*)
_host_cpu=
;;
@@ -7051,7 +7054,7 @@ esac
fi
fi
-if test "$cross_compiling" = yes; then
+if test "$cross_compiling" = yes -a "$ac_sys_system" != "Darwin"; then
case "$READELF" in
readelf|:)
as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5
diff --git a/configure.ac b/configure.ac
index 77fb609b74..1d9fa9e4ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -597,6 +597,9 @@ if test "$cross_compiling" = yes; then
_host_cpu=$host_cpu
esac
;;
+ *-*-darwin*)
+ _host_cpu=$host_cpu
+ ;;
*-*-cygwin*)
_host_cpu=
;;
@@ -1590,7 +1593,7 @@ then
fi
AC_CHECK_TOOLS([READELF], [readelf], [:])
-if test "$cross_compiling" = yes; then
+if test "$cross_compiling" = yes -a "$ac_sys_system" != "Darwin"; then
case "$READELF" in
readelf|:)
AC_MSG_ERROR([readelf for the host is required for cross builds])
diff --git a/setup.py b/setup.py
index 1bb48591c6..79dae21c6d 100644
--- a/setup.py
+++ b/setup.py
@@ -81,7 +81,7 @@ def get_platform():
HOST_PLATFORM = get_platform()
MS_WINDOWS = (HOST_PLATFORM == 'win32')
CYGWIN = (HOST_PLATFORM == 'cygwin')
-MACOS = (HOST_PLATFORM == 'darwin')
+MACOS = (HOST_PLATFORM.startswith('darwin'))
AIX = (HOST_PLATFORM.startswith('aix'))
VXWORKS = ('vxworks' in HOST_PLATFORM)
EMSCRIPTEN = HOST_PLATFORM == 'emscripten-wasm32'
@@ -1046,11 +1046,11 @@ def detect_readline_curses(self):
readline_lib = 'readline'
do_readline = self.compiler.find_library_file(self.lib_dirs,
readline_lib)
- if CROSS_COMPILING:
+ if CROSS_COMPILING and not MACOS:
ret = run_command("%s -d %s | grep '(NEEDED)' > %s"
% (sysconfig.get_config_var('READELF'),
do_readline, tmpfile))
- elif find_executable('ldd'):
+ elif find_executable('ldd') and not MACOS:
ret = run_command("ldd %s > %s" % (do_readline, tmpfile))
else:
ret = 1
--
2.32.1 (Apple Git-133)