@@ -33,24 +33,28 @@ OPENSSL_VERSION=3.0.16-2
33
33
XZ_VERSION =5.6.4-2
34
34
35
35
# Supported OS
36
- OS_LIST =macOS iOS tvOS watchOS
36
+ OS_LIST =macOS iOS tvOS watchOS visionOS
37
37
38
38
CURL_FLAGS =--disable --fail --location --create-dirs --progress-bar
39
39
40
40
# macOS targets
41
41
TARGETS-macOS =macosx.x86_64 macosx.arm64
42
+ TRIPLE_OS-macOS =macos
42
43
VERSION_MIN-macOS =11.0
43
44
44
45
# iOS targets
45
46
TARGETS-iOS =iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
47
+ TRIPLE_OS-iOS =ios
46
48
VERSION_MIN-iOS =13.0
47
49
48
50
# tvOS targets
49
51
TARGETS-tvOS =appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64
52
+ TRIPLE_OS-tvOS =tvos
50
53
VERSION_MIN-tvOS =12.0
51
54
52
55
# watchOS targets
53
56
TARGETS-watchOS =watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32
57
+ TRIPLE_OS-watchOS =watchos
54
58
VERSION_MIN-watchOS =4.0
55
59
56
60
# The architecture of the machine doing the build
@@ -128,10 +132,10 @@ ARCH-$(target)=$$(subst .,,$$(suffix $(target)))
128
132
129
133
ifneq ($(os ) ,macOS)
130
134
ifeq ($$(findstring simulator,$$(SDK-$(target))),)
131
- TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(OS_LOWER -$(target ) )$$(VERSION_MIN-$(os ) )
135
+ TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(TRIPLE_OS -$(os ) )$$(VERSION_MIN-$(os ) )
132
136
IS_SIMULATOR-$(target) =False
133
137
else
134
- TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(OS_LOWER -$(target ) )$$(VERSION_MIN-$(os ) ) -simulator
138
+ TARGET_TRIPLE-$(target) =$$(ARCH-$(target ) ) -apple-$$(TRIPLE_OS -$(os ) )$$(VERSION_MIN-$(os ) ) -simulator
135
139
IS_SIMULATOR-$(target) =True
136
140
endif
137
141
endif
@@ -398,15 +402,13 @@ define build-sdk
398
402
sdk=$1
399
403
os=$2
400
404
401
- OS_LOWER-$(sdk ) =$(shell echo $(os ) | tr '[:upper:]' '[:lower:]')
402
-
403
405
SDK_TARGETS-$(sdk ) =$$(filter $(sdk ) .% ,$$(TARGETS-$(os ) ) )
404
406
SDK_ARCHES-$(sdk ) =$$(sort $$(subst .,,$$(suffix $$(SDK_TARGETS-$(sdk ) ) ) ) )
405
407
406
408
ifeq ($$(findstring simulator,$(sdk ) ) ,)
407
- SDK_SLICE-$(sdk) =$$(OS_LOWER -$(sdk ) ) -$$(shell echo $$(SDK_ARCHES-$(sdk ) ) | sed "s/ /_/g")
409
+ SDK_SLICE-$(sdk) =$$(TRIPLE_OS -$(os ) ) -$$(shell echo $$(SDK_ARCHES-$(sdk ) ) | sed "s/ /_/g")
408
410
else
409
- SDK_SLICE-$(sdk) =$$(OS_LOWER -$(sdk ) ) -$$(shell echo $$(SDK_ARCHES-$(sdk ) ) | sed "s/ /_/g") -simulator
411
+ SDK_SLICE-$(sdk) =$$(TRIPLE_OS -$(os ) ) -$$(shell echo $$(SDK_ARCHES-$(sdk ) ) | sed "s/ /_/g") -simulator
410
412
endif
411
413
412
414
# Expand the build-target macro for target on this OS
@@ -450,6 +452,7 @@ $$(PYTHON_LIB-$(sdk)): $$(foreach target,$$(SDK_TARGETS-$(sdk)),$$(PYTHON_LIB-$$
450
452
mkdir -p $$(dir $$(PYTHON_LIB-$(sdk ) ) )
451
453
lipo -create -output $$@ $$^ \
452
454
2>&1 | tee -a install/$(os ) /$(sdk ) /python-$(PYTHON_VERSION ) .lipo.log
455
+ dsymutil $$@ -o $$(PYTHON_INSTALL-$(sdk ) ) /Python.dSYM
453
456
454
457
$$(PYTHON_FRAMEWORK-$(sdk ) ) /Info.plist : $$(PYTHON_LIB-$(sdk ) )
455
458
@echo " >>> Install Info.plist for the $( sdk) SDK"
@@ -481,11 +484,15 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
481
484
mkdir -p $$(PYTHON_INSTALL-$(sdk))/include
482
485
ln -si ../Python.framework/Headers $$(PYTHON_INSTALL-$(sdk))/include/python$(PYTHON_VER)
483
486
487
+ ifeq ($(os ) , visionOS)
488
+ echo "Skipping arch-specific header copying for visionOS"
489
+ else
484
490
# Add the individual headers from each target in an arch-specific name
485
491
$$(foreach target,$$(SDK_TARGETS-$(sdk)),cp $$(PYTHON_INCLUDE-$$(target))/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig-$$(ARCH-$$(target)).h; )
486
492
487
493
# Copy the cross-target header from the source folder of the first target in the $(sdk) SDK
488
494
cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$(sdk))))/$(os)/Resources/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
495
+ endif
489
496
490
497
491
498
$$(PYTHON_STDLIB-$(sdk ) ) /LICENSE.TXT : $$(PYTHON_LIB-$(sdk ) ) $$(PYTHON_FRAMEWORK-$(sdk ) ) /Info.plist $$(PYTHON_INCLUDE-$(sdk ) ) /pyconfig.h $$(foreach target,$$(SDK_TARGETS-$(sdk ) ) ,$$(PYTHON_PLATFORM_SITECUSTOMIZE-$$(target ) ) )
@@ -510,6 +517,14 @@ $$(PYTHON_STDLIB-$(sdk))/LICENSE.TXT: $$(PYTHON_LIB-$(sdk)) $$(PYTHON_FRAMEWORK-
510
517
# Merge the binary modules from each target in the $(sdk) SDK into a single binary
511
518
$$(foreach module,$$(wildcard $$(PYTHON_STDLIB-$$(firstword $$(SDK_TARGETS-$(sdk))))/lib-dynload/*),lipo -create -output $$(PYTHON_STDLIB-$(sdk))/lib-dynload/$$(notdir $$(module)) $$(foreach target,$$(SDK_TARGETS-$(sdk)),$$(PYTHON_STDLIB-$$(target))/lib-dynload/$$(notdir $$(module))); )
512
519
520
+ # Create dSYM files for each module
521
+ $$(foreach module,$$(wildcard $$(PYTHON_STDLIB-$$(firstword $$(SDK_TARGETS-$(sdk))))/lib-dynload/*),dsymutil $$(PYTHON_STDLIB-$(sdk))/lib-dynload/$$(notdir $$(module)); )
522
+
523
+ # Copy in known-required xcprivacy files.
524
+ # Libraries linking OpenSSL must provide a privacy manifest. The one in this repository
525
+ # has been sourced from https://github.com/openssl/openssl/blob/openssl-3.0/os-dep/Apple/PrivacyInfo.xcprivacy
526
+ cp $(PROJECT_DIR)/patch/Python/OpenSSL.xcprivacy $$(PYTHON_STDLIB-$(sdk))/lib-dynload/_hashlib.xcprivacy
527
+ cp $(PROJECT_DIR)/patch/Python/OpenSSL.xcprivacy $$(PYTHON_STDLIB-$(sdk))/lib-dynload/_ssl.xcprivacy
513
528
endif
514
529
515
530
$(sdk ) : $$(PYTHON_STDLIB-$(sdk ) ) /LICENSE.TXT
@@ -647,10 +662,11 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
647
662
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/bin $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
648
663
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/lib $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
649
664
$$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/platform-config $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
665
+ $$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/Python.dSYM $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
650
666
651
- ifeq ($(os ) ,iOS)
667
+ ifeq ($(filter $( os ) ,iOS visionOS) , $( os ) )
652
668
@echo ">>> Clone testbed project for $(os)"
653
- $(HOST_PYTHON) $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$$(firstword $$(SDKS-$(os))))))/iOS /testbed clone --framework $$(PYTHON_XCFRAMEWORK-$(os)) support/$(PYTHON_VER)/$(os)/testbed
669
+ $(HOST_PYTHON) $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$$(firstword $$(SDKS-$(os))))))/$(os) /testbed clone --framework $$(PYTHON_XCFRAMEWORK-$(os)) support/$(PYTHON_VER)/$(os)/testbed
654
670
endif
655
671
656
672
@echo ">>> Create VERSIONS file for $(os)"
0 commit comments