@@ -57,8 +57,9 @@ CFLAGS-watchOS=-mwatchos-version-min=2.0
5757CFLAGS-watchos.armv7k = -fembed-bitcode
5858PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack =no
5959
60- # override machine for arm64
61- MACHINE-arm64 =aarch64
60+ # override machine types for arm64
61+ MACHINE_DETAILED-arm64 =aarch64
62+ MACHINE_SIMPLE-arm64 =arm
6263
6364all : $(foreach os,$(OS ) ,$(os ) )
6465
@@ -160,16 +161,22 @@ $(PYTHON_DIR-host)/dist/bin/python$(PYTHON_VER): $(PYTHON_DIR-host)/Makefile
160161# - $2 - OS
161162define build-target
162163ARCH-$1= $$(subst .,,$$(suffix $1) )
163- ifdef MACHINE -$$(ARCH-$1)
164- MACHINE -$1 = $$(MACHINE -$$(ARCH-$1 ) )
164+ ifdef MACHINE_DETAILED -$$(ARCH-$1)
165+ MACHINE_DETAILED -$1 = $$(MACHINE_DETAILED -$$(ARCH-$1 ) )
165166else
166- MACHINE-$1 = $$(ARCH-$1 )
167+ MACHINE_DETAILED-$1 = $$(ARCH-$1 )
168+ endif
169+ ifdef MACHINE_SIMPLE-$$(ARCH-$1)
170+ MACHINE_SIMPLE-$1 = $$(MACHINE_SIMPLE-$$(ARCH-$1 ) )
171+ else
172+ MACHINE_SIMPLE-$1 = $$(ARCH-$1 )
167173endif
168174SDK-$1= $$(basename $1)
169175
170176SDK_ROOT-$1= $$(shell xcrun --sdk $$(SDK-$1 ) --show-sdk-path)
171- CC-$1= xcrun --sdk $$(SDK-$1 ) clang\
172- -arch $$(ARCH-$1 ) --sysroot=$$(SDK_ROOT-$1 ) $$(CFLAGS-$2 ) $$(CFLAGS-$1 )
177+ CC-$1= xcrun --sdk $$(SDK-$1 ) clang\
178+ -arch $$(ARCH-$1 ) --sysroot=$$(SDK_ROOT-$1 ) $$(CFLAGS-$2 ) $$(CFLAGS-$1 )
179+ LDFLAGS-$1= -arch $$(ARCH-$1 ) -isysroot=$$(SDK_ROOT-$1 )
173180
174181OPENSSL_DIR-$1= build/$2/openssl-$(OPENSSL_VERSION ) -$1
175182BZIP2_DIR-$1= build/$2/bzip2-$(BZIP2_VERSION ) -$1
@@ -230,7 +237,9 @@ $$(XZ_DIR-$1)/Makefile: downloads/xz-$(XZ_VERSION).tgz
230237 # Configure the build
231238 cd $$(XZ_DIR-$1 ) && ./configure \
232239 CC="$$(CC-$1 ) " \
233- --host=$$(MACHINE-$1 ) -apple-ios --build=x86_64-apple-darwin$(shell uname -r) \
240+ LDFLAGS="$$(LDFLAGS-$1 ) " \
241+ --disable-shared --enable-static \
242+ --host=$$(MACHINE_SIMPLE-$1 ) -apple-darwin \
234243 --prefix=$(PROJECT_DIR ) /build/$2/xz
235244
236245# Build XZ
@@ -250,14 +259,14 @@ $$(PYTHON_DIR-$1)/Makefile: downloads/Python-$(PYTHON_VERSION).tgz $(PYTHON_HOST
250259 # Configure target Python
251260 cd $$(PYTHON_DIR-$1 ) && PATH=$(PROJECT_DIR ) /$(PYTHON_DIR-host ) /dist/bin:$(PATH ) ./configure \
252261 CC="$$(CC-$1 ) " LD="$$(CC-$1 ) " \
253- --host=$$(MACHINE -$1 ) -apple-ios --build=x86_64-apple-darwin$(shell uname -r) \
262+ --host=$$(MACHINE_DETAILED -$1 ) -apple-ios --build=x86_64-apple-darwin$(shell uname -r) \
254263 --prefix=$(PROJECT_DIR ) /$$(PYTHON_DIR-$1 ) /dist \
255264 --without-pymalloc --without-doc-strings --disable-ipv6 --without-ensurepip \
256265 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no \
257266 $$(PYTHON_CONFIGURE-$2 )
258267
259268# Build Python
260- $$(PYTHON_DIR-$1 ) /dist/lib/libpython$(PYTHON_VER ) .a: $$(PYTHON_DIR-$1 ) /Makefile build/$2/OpenSSL.framework build/$2/bzip2/lib/libbz2.a
269+ $$(PYTHON_DIR-$1 ) /dist/lib/libpython$(PYTHON_VER ) .a: $$(PYTHON_DIR-$1 ) /Makefile build/$2/OpenSSL.framework build/$2/bzip2/lib/libbz2.a build/$2/xz/lib/liblzma.a
261270 # Build target Python
262271 cd $$(PYTHON_DIR-$1 ) && PATH=$(PROJECT_DIR ) /$(PYTHON_DIR-host ) /dist/bin:$(PATH ) make all install
263272
@@ -267,7 +276,7 @@ build/$2/$$(pyconfig.h-$1): $$(PYTHON_DIR-$1)/dist/include/python$(PYTHON_VER)/p
267276# Dump vars (for test)
268277vars-$1:
269278 @echo "ARCH-$1: $$(ARCH-$1 ) "
270- @echo "MACHINE -$1: $$(MACHINE -$1 ) "
279+ @echo "MACHINE_DETAILED -$1: $$(MACHINE_DETAILED -$1 ) "
271280 @echo "SDK-$1: $$(SDK-$1 ) "
272281 @echo "SDK_ROOT-$1: $$(SDK_ROOT-$1 ) "
273282 @echo "CC-$1: $$(CC-$1 ) "
0 commit comments