@@ -44,9 +44,11 @@ TRIPLE_OS-macOS=macos
44
44
VERSION_MIN-macOS =11.0
45
45
46
46
# iOS targets
47
- TARGETS-iOS =iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
47
+ TARGETS-iOS =iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64 macabi.x86_64 macabi.arm64
48
48
TRIPLE_OS-iOS =ios
49
49
VERSION_MIN-iOS =13.0
50
+ VERSION_MIN_OVERRIDE-macabi =14.2
51
+ CONFIGFLAGS-macabi=--with-catalyst-macos-version =11.2
50
52
51
53
# tvOS targets
52
54
TARGETS-tvOS =appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64
@@ -132,15 +134,34 @@ os=$2
132
134
OS_LOWER-$(target ) =$(shell echo $(os ) | tr '[:upper:]' '[:lower:]')
133
135
134
136
# $(target) can be broken up into is composed of $(SDK).$(ARCH)
135
- SDK-$(target ) =$$(basename $(target ) )
137
+ BASE-$(target ) =$$(basename $(target ) )
138
+ SDK-$(target ) =$$(subst macabi,macosx,$$(BASE-$(target ) ) )
136
139
ARCH-$(target ) =$$(subst .,,$$(suffix $(target ) ) )
137
140
141
+ # Compute version minimum for the target
142
+ VERSION_MIN-$(target ) =$$(VERSION_MIN-$(os ) )
143
+ ifdef VERSION_MIN_OVERRIDE-$$(BASE-$(target))
144
+ VERSION_MIN-$(target) =$$(VERSION_MIN_OVERRIDE-$$(BASE-$(target ) ) )
145
+ endif
146
+
147
+ # Inherit the basename for the configure flags.
148
+ ifdef CONFIGFLAGS-$$(BASE-$(target))
149
+ CONFIGFLAGS-$(target) =$$(CONFIGFLAGS-$$(BASE-$(target ) )
150
+ else
151
+ CONFIGFLAGS-$(target ) =
152
+ endif
153
+
138
154
ifneq ($(os ) ,macOS )
139
- ifeq ($$(findstring simulator,$$(SDK-$(target))),)
140
- TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(TRIPLE_OS-$(os ) )$$(VERSION_MIN-$(os ) )
155
+ ifeq ($$(findstring simulator,$$(BASE-$(target))),)
156
+ ifeq ($$(findstring macabi,$$(BASE-$(target))),)
157
+ TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(TRIPLE_OS-$(os ) )$$(VERSION_MIN-$(target ) )
141
158
IS_SIMULATOR-$(target) =False
159
+ else
160
+ TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(TRIPLE_OS-$(os ) )$$(VERSION_MIN-$(target ) ) -macabi
161
+ IS_SIMULATOR-$(target) =False
162
+ endif
142
163
else
143
- TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(TRIPLE_OS-$(os ) )$$(VERSION_MIN-$(os ) ) -simulator
164
+ TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(TRIPLE_OS-$(os ) )$$(VERSION_MIN-$(target ) ) -simulator
144
165
IS_SIMULATOR-$(target) =True
145
166
endif
146
167
endif
@@ -274,6 +295,13 @@ PYTHON_PLATFORM_CONFIG-$(target)=$$(PYTHON_INSTALL-$(target))/platform-config/$$
274
295
PYTHON_PLATFORM_SITECUSTOMIZE-$(target) =$$(PYTHON_PLATFORM_CONFIG-$(target ) ) /sitecustomize.py
275
296
276
297
298
+
299
+ ifneq ($$(BASE-$(target ) ) ,macabi)
300
+ RESCDIR-$(target) =$(PROJECT_DIR ) /$$(PYTHON_SRCDIR-$(target ) ) /$(os ) /Resources
301
+ else
302
+ RESCDIR-$(target) =$(PROJECT_DIR ) /$$(PYTHON_SRCDIR-$(target ) ) /MacCatalyst/Resources
303
+ endif
304
+
277
305
$$(PYTHON_SRCDIR-$(target ) ) /configure : \
278
306
downloads/Python-$(PYTHON_VERSION ) .tar.gz \
279
307
$$(BZIP2_LIB-$(target ) ) \
@@ -287,15 +315,15 @@ $$(PYTHON_SRCDIR-$(target))/configure: \
287
315
# Apply target Python patches
288
316
cd $$(PYTHON_SRCDIR-$(target ) ) && patch -p1 < $(PROJECT_DIR ) /patch/Python/Python.patch
289
317
# Make sure the binary scripts are executable
290
- chmod 755 $$(PYTHON_SRCDIR -$(target ) ) / $( os ) /Resources /bin/*
318
+ chmod 755 $$(RESCDIR -$(target ) ) /bin/*
291
319
# Touch the configure script to ensure that Make identifies it as up to date.
292
320
touch $$(PYTHON_SRCDIR-$(target ) ) /configure
293
321
294
322
$$(PYTHON_SRCDIR-$(target ) ) /Makefile : \
295
323
$$(PYTHON_SRCDIR-$(target ) ) /configure
296
324
# Configure target Python
297
325
cd $$(PYTHON_SRCDIR-$(target ) ) && \
298
- PATH=" $( PROJECT_DIR ) / $$ (PYTHON_SRCDIR -$( target) )/ $( os ) /Resources /bin:$( PATH) " \
326
+ PATH=" $$ (RESCDIR -$( target) )/bin:$( PATH) " \
299
327
./configure \
300
328
LIBLZMA_CFLAGS=" -I$$ (XZ_INSTALL-$( target) )/include" \
301
329
LIBLZMA_LIBS=" -L$$ (XZ_INSTALL-$( target) )/lib -llzma" \
@@ -312,19 +340,21 @@ $$(PYTHON_SRCDIR-$(target))/Makefile: \
312
340
--with-openssl=" $$ (OPENSSL_INSTALL-$( target) )" \
313
341
--enable-framework=" $$ (PYTHON_INSTALL-$( target) )" \
314
342
--with-system-libmpdec \
343
+ $$(CONFIGFLAGS-$(target ) ) \
315
344
2>&1 | tee -a ../python-$(PYTHON_VERSION ) .config.log
316
345
317
346
$$(PYTHON_SRCDIR-$(target ) ) /python.exe : $$(PYTHON_SRCDIR-$(target ) ) /Makefile
318
347
@echo " >>> Build Python for $( target) "
348
+
319
349
cd $$(PYTHON_SRCDIR-$(target ) ) && \
320
- PATH=" $( PROJECT_DIR ) / $$ (PYTHON_SRCDIR -$( target) )/ $( os ) /Resources /bin:$( PATH) " \
350
+ PATH=" $$ (RESCDIR -$( target) )/bin:$( PATH) " \
321
351
make -j8 all \
322
352
2>&1 | tee -a ../python-$(PYTHON_VERSION ) .build.log
323
353
324
354
$$(PYTHON_LIB-$(target ) ) : $$(PYTHON_SRCDIR-$(target ) ) /python.exe
325
355
@echo " >>> Install Python for $( target) "
326
356
cd $$(PYTHON_SRCDIR-$(target ) ) && \
327
- PATH=" $( PROJECT_DIR ) / $$ (PYTHON_SRCDIR -$( target) )/ $( os ) /Resources /bin:$( PATH) " \
357
+ PATH=" $$ (RESCDIR -$( target) )/bin:$( PATH) " \
328
358
make install \
329
359
2>&1 | tee -a ../python-$(PYTHON_VERSION ) .install.log
330
360
@@ -349,7 +379,7 @@ $$(PYTHON_PLATFORM_SITECUSTOMIZE-$(target)):
349
379
| sed -e " s/{{platform}}/$$ (OS_LOWER-$( target) )/g" \
350
380
| sed -e " s/{{arch}}/$$ (ARCH-$( target) )/g" \
351
381
| sed -e " s/{{sdk}}/$$ (SDK-$( target) )/g" \
352
- | sed -e " s/{{version_min}}/$$ (VERSION_MIN-$( os ) )/g" \
382
+ | sed -e " s/{{version_min}}/$$ (VERSION_MIN-$( target ) )/g" \
353
383
| sed -e " s/{{is_simulator}}/$$ (IS_SIMULATOR-$( target) )/g" \
354
384
> $$(PYTHON_PLATFORM_CONFIG-$(target ) ) /_cross_$$(ARCH-$(target ) ) _$$(SDK-$(target ) ) .py
355
385
cat $(PROJECT_DIR ) /patch/Python/sitecustomize.py.tmpl \
495
525
$$(foreach target,$$(SDK_TARGETS-$(sdk)),cp $$(PYTHON_INCLUDE-$$(target))/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig-$$(ARCH-$$(target)).h; )
496
526
497
527
# Copy the cross-target header from the source folder of the first target in the $(sdk) SDK
498
- cp $$(PYTHON_SRCDIR -$$(firstword $$(SDK_TARGETS-$(sdk))))/$(os)/Resources /pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
528
+ cp $$(RESCDIR -$$(firstword $$(SDK_TARGETS-$(sdk))))/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
499
529
endif
500
530
501
531
0 commit comments