@@ -33,24 +33,28 @@ OPENSSL_VERSION=3.0.16-2
3333XZ_VERSION =5.6.4-2
3434
3535# Supported OS
36- OS_LIST =macOS iOS tvOS watchOS
36+ OS_LIST =macOS iOS tvOS watchOS visionOS
3737
3838CURL_FLAGS =--disable --fail --location --create-dirs --progress-bar
3939
4040# macOS targets
4141TARGETS-macOS =macosx.x86_64 macosx.arm64
42+ TRIPLE_OS-macOS =macos
4243VERSION_MIN-macOS =11.0
4344
4445# iOS targets
4546TARGETS-iOS =iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
47+ TRIPLE_OS-iOS =ios
4648VERSION_MIN-iOS =13.0
4749
4850# tvOS targets
4951TARGETS-tvOS =appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64
52+ TRIPLE_OS-tvOS =tvos
5053VERSION_MIN-tvOS =12.0
5154
5255# watchOS targets
5356TARGETS-watchOS =watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32
57+ TRIPLE_OS-watchOS =watchos
5458VERSION_MIN-watchOS =4.0
5559
5660# The architecture of the machine doing the build
@@ -128,10 +132,10 @@ ARCH-$(target)=$$(subst .,,$$(suffix $(target)))
128132
129133ifneq ($(os ) ,macOS)
130134 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 ) )
132136IS_SIMULATOR-$(target) =False
133137 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
135139IS_SIMULATOR-$(target) =True
136140 endif
137141endif
@@ -398,15 +402,13 @@ define build-sdk
398402sdk=$1
399403os=$2
400404
401- OS_LOWER-$(sdk ) =$(shell echo $(os ) | tr '[:upper:]' '[:lower:]')
402-
403405SDK_TARGETS-$(sdk ) =$$(filter $(sdk ) .% ,$$(TARGETS-$(os ) ) )
404406SDK_ARCHES-$(sdk ) =$$(sort $$(subst .,,$$(suffix $$(SDK_TARGETS-$(sdk ) ) ) ) )
405407
406408ifeq ($$(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")
408410else
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
410412endif
411413
412414# Expand the build-target macro for target on this OS
@@ -450,6 +452,7 @@ $$(PYTHON_LIB-$(sdk)): $$(foreach target,$$(SDK_TARGETS-$(sdk)),$$(PYTHON_LIB-$$
450452 mkdir -p $$(dir $$(PYTHON_LIB-$(sdk ) ) )
451453 lipo -create -output $$@ $$^ \
452454 2>&1 | tee -a install/$(os ) /$(sdk ) /python-$(PYTHON_VERSION ) .lipo.log
455+ dsymutil $$@ -o $$(PYTHON_INSTALL-$(sdk ) ) /Python.dSYM
453456
454457$$(PYTHON_FRAMEWORK-$(sdk ) ) /Info.plist : $$(PYTHON_LIB-$(sdk ) )
455458 @echo " >>> Install Info.plist for the $( sdk) SDK"
@@ -481,11 +484,15 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
481484 mkdir -p $$(PYTHON_INSTALL-$(sdk))/include
482485 ln -si ../Python.framework/Headers $$(PYTHON_INSTALL-$(sdk))/include/python$(PYTHON_VER)
483486
487+ ifeq ($(os ) , visionOS)
488+ echo "Skipping arch-specific header copying for visionOS"
489+ else
484490 # Add the individual headers from each target in an arch-specific name
485491 $$(foreach target,$$(SDK_TARGETS-$(sdk)),cp $$(PYTHON_INCLUDE-$$(target))/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig-$$(ARCH-$$(target)).h; )
486492
487493 # Copy the cross-target header from the source folder of the first target in the $(sdk) SDK
488494 cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$(sdk))))/$(os)/Resources/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
495+ endif
489496
490497
491498$$(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-
510517 # Merge the binary modules from each target in the $(sdk) SDK into a single binary
511518 $$(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))); )
512519
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
513528endif
514529
515530$(sdk ) : $$(PYTHON_STDLIB-$(sdk ) ) /LICENSE.TXT
@@ -647,10 +662,11 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
647662 $$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/bin $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
648663 $$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/lib $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
649664 $$(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)); )
650666
651- ifeq ($(os ) ,iOS)
667+ ifeq ($(filter $( os ) ,iOS visionOS) , $( os ) )
652668 @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
654670endif
655671
656672 @echo ">>> Create VERSIONS file for $(os)"
0 commit comments