@@ -19,7 +19,7 @@ BUILD_NUMBER=custom
1919# of a release cycle, as official binaries won't be published.
2020# PYTHON_MICRO_VERSION is the full version number, without any alpha/beta/rc suffix. (e.g., 3.10.0)
2121# PYTHON_VER is the major/minor version (e.g., 3.10)
22- PYTHON_VERSION =3.14.0rc1
22+ PYTHON_VERSION =3.14.0rc3
2323PYTHON_PKG_VERSION =$(PYTHON_VERSION )
2424PYTHON_MICRO_VERSION =$(shell echo $(PYTHON_VERSION ) | grep -Eo "\d+\.\d+\.\d+")
2525PYTHON_PKG_MICRO_VERSION =$(shell echo $(PYTHON_PKG_VERSION ) | grep -Eo "\d+\.\d+\.\d+")
@@ -32,6 +32,7 @@ LIBFFI_VERSION=3.4.7-2
3232MPDECIMAL_VERSION =4.0.0-2
3333OPENSSL_VERSION =3.0.16-2
3434XZ_VERSION =5.6.4-2
35+ ZSTD_VERSION =1.5.7-1
3536
3637# Supported OS
3738OS_LIST =macOS iOS tvOS watchOS visionOS
@@ -41,25 +42,30 @@ CURL_FLAGS=--disable --fail --location --create-dirs --progress-bar
4142# macOS targets
4243TARGETS-macOS =macosx.x86_64 macosx.arm64
4344TRIPLE_OS-macOS =macos
45+ PLATFORM_NAME-macOS =macOS
4446VERSION_MIN-macOS =11.0
4547
4648# iOS targets
4749TARGETS-iOS =iphonesimulator.x86_64 iphonesimulator.arm64 iphoneos.arm64
4850TRIPLE_OS-iOS =ios
51+ PLATFORM_NAME-iOS =iOS
4952VERSION_MIN-iOS =13.0
5053
5154# tvOS targets
5255TARGETS-tvOS =appletvsimulator.x86_64 appletvsimulator.arm64 appletvos.arm64
5356TRIPLE_OS-tvOS =tvos
57+ PLATFORM_NAME-tvOS =tvOS
5458VERSION_MIN-tvOS =12.0
5559
5660# watchOS targets
5761TARGETS-watchOS =watchsimulator.x86_64 watchsimulator.arm64 watchos.arm64_32
5862TRIPLE_OS-watchOS =watchos
63+ PLATFORM_NAME-watchOS =watchOS
5964VERSION_MIN-watchOS =4.0
6065
6166TARGETS-visionOS =xrsimulator.arm64 xros.arm64
6267TRIPLE_OS-visionOS =xros
68+ PLATFORM_NAME-visionOS =xrOS
6369VERSION_MIN-visionOS =2.0
6470
6571# The architecture of the machine doing the build
@@ -95,7 +101,7 @@ update-patch:
95101 # call
96102 if [ -z " $( PYTHON_REPO_DIR) " ]; then echo " \n\nPYTHON_REPO_DIR must be set to the root of your Python github checkout\n\n" ; fi
97103 cd $(PYTHON_REPO_DIR ) && \
98- git diff -D v$(PYTHON_VERSION ) $(PYTHON_VER ) -patched \
104+ git diff --no-renames - D v$(PYTHON_VERSION ) $(PYTHON_VER ) -patched \
99105 | PATH=" /usr/local/bin:/opt/homebrew/bin:$( PATH) " filterdiff \
100106 -X $(PROJECT_DIR ) /patch/Python/diff.exclude -p 1 --clean \
101107 > $(PROJECT_DIR ) /patch/Python/Python.patch
@@ -187,6 +193,26 @@ $$(XZ_LIB-$(target)): downloads/xz-$(XZ_VERSION)-$(target).tar.gz
187193 # Ensure the target is marked as clean.
188194 touch $$(XZ_LIB-$(target ) )
189195
196+ # ##########################################################################
197+ # Target: zstd (ZStandard)
198+ # ##########################################################################
199+
200+ ZSTD_INSTALL-$(target ) =$(PROJECT_DIR ) /install/$(os ) /$(target ) /zstd-$(ZSTD_VERSION )
201+ ZSTD_LIB-$(target ) =$$(ZSTD_INSTALL-$(target ) ) /lib/libzstd.a
202+
203+ downloads/zstd-$(ZSTD_VERSION ) -$(target ) .tar.gz:
204+ @echo ">>> Download zstd for $(target ) "
205+ mkdir -p downloads
206+ curl $(CURL_FLAGS ) -o $$@ \
207+ https://github.com/beeware/cpython-apple-source-deps/releases/download/zstd-$(ZSTD_VERSION ) /zstd-$(ZSTD_VERSION ) -$(target ) .tar.gz
208+
209+ $$(ZSTD_LIB-$(target ) ) : downloads/zstd-$(ZSTD_VERSION ) -$(target ) .tar.gz
210+ @echo ">>> Install zstd for $(target ) "
211+ mkdir -p $$(ZSTD_INSTALL-$(target ) )
212+ cd $$(ZSTD_INSTALL-$(target ) ) && tar zxvf $(PROJECT_DIR ) /downloads/zstd-$(ZSTD_VERSION ) -$(target ) .tar.gz --exclude="*.dylib"
213+ # Ensure the target is marked as clean.
214+ touch $$(ZSTD_LIB-$(target ) )
215+
190216# ##########################################################################
191217# Target: mpdecimal
192218# ##########################################################################
@@ -280,22 +306,23 @@ $$(PYTHON_SRCDIR-$(target))/configure: \
280306 $$(LIBFFI_LIB-$(target ) ) \
281307 $$(MPDECIMAL_LIB-$(target ) ) \
282308 $$(OPENSSL_SSL_LIB-$(target ) ) \
283- $$(XZ_LIB-$(target ) )
309+ $$(XZ_LIB-$(target ) ) \
310+ $$(ZSTD_LIB-$(target ) )
284311 @echo " >>> Unpack and configure Python for $( target) "
285312 mkdir -p $$(PYTHON_SRCDIR-$(target ) )
286313 tar zxf downloads/Python-$(PYTHON_VERSION ) .tar.gz --strip-components 1 -C $$(PYTHON_SRCDIR-$(target ) )
287314 # Apply target Python patches
288315 cd $$(PYTHON_SRCDIR-$(target ) ) && patch -p1 < $(PROJECT_DIR ) /patch/Python/Python.patch
289316 # Make sure the binary scripts are executable
290- chmod 755 $$(PYTHON_SRCDIR-$(target ) ) /$(os ) /Resources/bin/*
317+ chmod 755 $$(PYTHON_SRCDIR-$(target ) ) /Apple/ $(os ) /Resources/bin/*
291318 # Touch the configure script to ensure that Make identifies it as up to date.
292319 touch $$(PYTHON_SRCDIR-$(target ) ) /configure
293320
294321$$(PYTHON_SRCDIR-$(target ) ) /Makefile : \
295322 $$(PYTHON_SRCDIR-$(target ) ) /configure
296323 # Configure target Python
297324 cd $$(PYTHON_SRCDIR-$(target ) ) && \
298- PATH=" $( PROJECT_DIR) /$$ (PYTHON_SRCDIR-$( target) )/$( os) /Resources/bin:$( PATH) " \
325+ PATH=" $( PROJECT_DIR) /$$ (PYTHON_SRCDIR-$( target) )/Apple/ $( os) /Resources/bin:$( PATH) " \
299326 ./configure \
300327 LIBLZMA_CFLAGS=" -I$$ (XZ_INSTALL-$( target) )/include" \
301328 LIBLZMA_LIBS=" -L$$ (XZ_INSTALL-$( target) )/lib -llzma" \
@@ -305,6 +332,8 @@ $$(PYTHON_SRCDIR-$(target))/Makefile: \
305332 LIBMPDEC_LIBS=" -L$$ (MPDECIMAL_INSTALL-$( target) )/lib -lmpdec" \
306333 LIBFFI_CFLAGS=" -I$$ (LIBFFI_INSTALL-$( target) )/include" \
307334 LIBFFI_LIBS=" -L$$ (LIBFFI_INSTALL-$( target) )/lib -lffi" \
335+ LIBZSTD_CFLAGS ="-I$$(ZSTD_INSTALL-$(target ) ) /include" \
336+ LIBZSTD_LIBS="-L$$(ZSTD_INSTALL-$(target ) ) /lib -lzstd" \
308337 --host=$$(TARGET_TRIPLE-$(target ) ) \
309338 --build=$(HOST_ARCH ) -apple-darwin \
310339 --with-build-python=$(HOST_PYTHON ) \
@@ -317,14 +346,14 @@ $$(PYTHON_SRCDIR-$(target))/Makefile: \
317346$$(PYTHON_SRCDIR-$(target ) ) /python.exe : $$(PYTHON_SRCDIR-$(target ) ) /Makefile
318347 @echo " >>> Build Python for $( target) "
319348 cd $$(PYTHON_SRCDIR-$(target ) ) && \
320- PATH=" $( PROJECT_DIR) /$$ (PYTHON_SRCDIR-$( target) )/$( os) /Resources/bin:$( PATH) " \
349+ PATH=" $( PROJECT_DIR) /$$ (PYTHON_SRCDIR-$( target) )/Apple/ $( os) /Resources/bin:$( PATH) " \
321350 make -j8 all \
322351 2>&1 | tee -a ../python-$(PYTHON_VERSION ) .build.log
323352
324353$$(PYTHON_LIB-$(target ) ) : $$(PYTHON_SRCDIR-$(target ) ) /python.exe
325354 @echo " >>> Install Python for $( target) "
326355 cd $$(PYTHON_SRCDIR-$(target ) ) && \
327- PATH=" $( PROJECT_DIR) /$$ (PYTHON_SRCDIR-$( target) )/$( os) /Resources/bin:$( PATH) " \
356+ PATH=" $( PROJECT_DIR) /$$ (PYTHON_SRCDIR-$( target) )/Apple/ $( os) /Resources/bin:$( PATH) " \
328357 make install \
329358 2>&1 | tee -a ../python-$(PYTHON_VERSION ) .install.log
330359
@@ -490,15 +519,11 @@ $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h: $$(PYTHON_LIB-$(sdk))
490519 mkdir -p $$(PYTHON_INSTALL-$(sdk))/include
491520 ln -si ../Python.framework/Headers $$(PYTHON_INSTALL-$(sdk))/include/python$(PYTHON_VER)
492521
493- ifeq ($(os ) , visionOS)
494- echo "Skipping arch-specific header copying for visionOS"
495- else
496522 # Add the individual headers from each target in an arch-specific name
497523 $$(foreach target,$$(SDK_TARGETS-$(sdk)),cp $$(PYTHON_INCLUDE-$$(target))/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig-$$(ARCH-$$(target)).h; )
498524
499525 # Copy the cross-target header from the source folder of the first target in the $(sdk) SDK
500- cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$(sdk))))/$(os)/Resources/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
501- endif
526+ cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$(sdk))))/Apple/$(os)/Resources/pyconfig.h $$(PYTHON_INCLUDE-$(sdk))/pyconfig.h
502527
503528
504529$$(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 ) ) )
@@ -666,6 +691,11 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
666691 -output $$(PYTHON_XCFRAMEWORK-$(os ) ) $$(foreach sdk,$$(SDKS-$(os ) ) ,-framework $$(PYTHON_FRAMEWORK-$$(sdk ) ) ) \
667692 2>&1 | tee -a support/$(PYTHON_VER ) /python-$(os ) .xcframework.log
668693
694+ @echo ">>> Install build tools for $(os)"
695+ mkdir $$(PYTHON_XCFRAMEWORK-$(os))/build
696+ cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$$(firstword $$(SDKS-$(os))))))/Apple/testbed/Python.xcframework/build/utils.sh $$(PYTHON_XCFRAMEWORK-$(os))/build
697+ cp $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$$(firstword $$(SDKS-$(os))))))/Apple/testbed/Python.xcframework/build/$$(PLATFORM_NAME-$(os))-dylib-Info-template.plist $$(PYTHON_XCFRAMEWORK-$(os))/build
698+
669699 @echo ">>> Install PYTHONHOME for $(os)"
670700 $$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/include $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
671701 $$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/bin $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
@@ -674,9 +704,9 @@ $$(PYTHON_XCFRAMEWORK-$(os))/Info.plist: \
674704 # Disable dSYM production (for now)
675705 # $$(foreach sdk,$$(SDKS-$(os)),cp -r $$(PYTHON_INSTALL-$$(sdk))/Python.dSYM $$(PYTHON_XCFRAMEWORK-$(os))/$$(SDK_SLICE-$$(sdk)); )
676706
677- ifeq ($(filter $(os ) ,iOS visionOS) ,$(os ) )
707+ ifeq ($(filter $(os ) ,iOS tvOS visionOS) ,$(os ) )
678708 @echo ">>> Clone testbed project for $(os)"
679- $(HOST_PYTHON) $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$$(firstword $$(SDKS-$(os))))))/$(os) /testbed clone --framework $$(PYTHON_XCFRAMEWORK-$(os)) support/$(PYTHON_VER)/$(os)/testbed
709+ $(HOST_PYTHON) $$(PYTHON_SRCDIR-$$(firstword $$(SDK_TARGETS-$$(firstword $$(SDKS-$(os))))))/Apple /testbed clone --platform $(os) --framework $$(PYTHON_XCFRAMEWORK-$(os)) support/$(PYTHON_VER)/$(os)/testbed
680710endif
681711
682712 @echo ">>> Create VERSIONS file for $(os)"
@@ -689,6 +719,7 @@ endif
689719 echo "mpdecimal: $(MPDECIMAL_VERSION)" >> support/$(PYTHON_VER)/$(os)/VERSIONS
690720 echo "OpenSSL: $(OPENSSL_VERSION)" >> support/$(PYTHON_VER)/$(os)/VERSIONS
691721 echo "XZ: $(XZ_VERSION)" >> support/$(PYTHON_VER)/$(os)/VERSIONS
722+ echo "Zstandard: $(ZSTD_VERSION)" >> support/$(PYTHON_VER)/$(os)/VERSIONS
692723
693724dist/Python-$(PYTHON_VER ) -$(os ) -support.$(BUILD_NUMBER ) .tar.gz : \
694725 $$(PYTHON_XCFRAMEWORK-$(os ) ) /Info.plist \
@@ -757,6 +788,7 @@ config:
757788 @echo " MPDECIMAL_VERSION=$( MPDECIMAL_VERSION) "
758789 @echo " OPENSSL_VERSION=$( OPENSSL_VERSION) "
759790 @echo " XZ_VERSION=$( XZ_VERSION) "
791+ @echo " ZSTD_VERSION=$( ZSTD_VERSION) "
760792
761793# Expand cross-platform build and clean targets for each output product
762794clean : $(foreach os,$(OS_LIST ) ,clean-$(os ) )
0 commit comments