summarylogtreecommitdiffstats
path: root/0029-cross-darwin-feature.patch
blob: 39fa9c9e1193f835e55900d6f2370f8be88a788a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
From 28b76e2a3d4a629a2e5280c760fce8d661909ae0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
 <alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:51:44 +0530
Subject: [PATCH 029/N] cross darwin feature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Алексей <alexey.pawlow@gmail.com>
---
 configure.ac | 54 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 49 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5459145..bd4ff50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -387,6 +387,7 @@ if test -z "$MACHDEP"
 then
     # avoid using uname for cross builds
     if test "$cross_compiling" = yes; then
+       ac_sys_release=
        # ac_sys_system and ac_sys_release are used for setting
        # a lot of different things including 'define_xopen_source'
        # in the case statement below.
@@ -403,6 +404,27 @@ then
 	*-*-mingw*)
 		ac_sys_system=MINGW
 		;;
+	*-*-darwin*)
+		ac_sys_system=Darwin
+		ac_sys_release=$(echo $host | sed -n 's/.*-[^0-9]\+\([0-9]\+\)/\1/p')
+		if test -z "$ac_sys_release"; then
+			# A reasonable default.
+			ac_sys_release=11
+		fi
+		# Use the last released version number for old versions.
+	        if test "$ac_sys_release" = "9" ; then
+			ac_sys_release=9.8
+	        elif test "$ac_sys_release" = "10" ; then
+			ac_sys_release=10.8
+	        elif test "$ac_sys_release" = "11" ; then
+			ac_sys_release=11.4.0
+	        elif test "$ac_sys_release" = "12" ; then
+			ac_sys_release=12.0.0
+		else
+		# ..and .0.0 for unknown versions.
+			ac_sys_release=${ac_sys_release}.0.0
+		fi
+		;;
 	*-*-vxworks*)
 	    ac_sys_system=VxWorks
 	    ;;
@@ -411,7 +433,6 @@ then
 		MACHDEP="unknown"
 		AC_MSG_ERROR([cross build not supported for $host])
 	esac
-	ac_sys_release=
     else
 	ac_sys_system=`uname -s`
 	if test "$ac_sys_system" = "AIX" \
@@ -459,6 +480,9 @@ if test "$cross_compiling" = yes; then
 	*-*-mingw*)
 		_host_cpu=
 		;;
+	*-*-darwin*)
+		_host_cpu=
+		;;
 	*)
 		# for now, limit cross builds to known configurations
 		MACHDEP="unknown"
@@ -1655,6 +1679,26 @@ AC_SUBST(BASECFLAGS)
 AC_SUBST(CFLAGS_NODIST)
 AC_SUBST(LDFLAGS_NODIST)
 
+if test "x$cross_compiling" = xyes; then
+    function cross_arch
+    {
+        case $host in
+	  x86_64*darwin*)
+	    echo i386
+          ;;
+	  x86_64*)
+            echo x86_64
+	  ;;
+	  *)
+            echo i386
+	  ;;
+	esac
+    }
+    ARCH_PROG=cross_arch
+else
+    ARCH_PROG=/usr/bin/arch
+fi
+
 # The -arch flags for universal builds on macOS
 UNIVERSAL_ARCH_FLAGS=
 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
@@ -2033,7 +2077,7 @@ yes)
                     ;;
                 esac
             else
-                if test `/usr/bin/arch` = "i386"
+                if test "$($ARCH_PROG)" = "i386"
                 then
                     # 10.4 was the first release to support Intel archs
                     cur_target="10.4"
@@ -2606,7 +2650,7 @@ case $ac_sys_system/$ac_sys_release in
     if test "${enable_universalsdk}"; then
 	    :
     else
-        LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
+        LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only $($ARCH_PROG)"
     fi
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -2631,7 +2675,7 @@ case $ac_sys_system/$ac_sys_release in
     ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
 
     if test "${ac_osx_32bit}" = "yes"; then
-    	case `/usr/bin/arch` in
+    	case $($ARCH_PROG) in
     	i386)
     		MACOSX_DEFAULT_ARCH="i386"
     		;;
@@ -2643,7 +2687,7 @@ case $ac_sys_system/$ac_sys_release in
     		;;
     	esac
     else
-    	case `/usr/bin/arch` in
+    	case $($ARCH_PROG) in
     	i386)
     		MACOSX_DEFAULT_ARCH="x86_64"
     		;;
-- 
2.33.0