diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index ba0f88171..8b76a6c36 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -125,14 +125,6 @@ if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_11}" ]; then patch -p1 -i "${ROOT}/patch-always-build-python-for-freeze.patch" fi -# Add a make target to write the PYTHON_FOR_BUILD variable so we can -# invoke the host Python on our own. -if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" ]; then - patch -p1 -i "${ROOT}/patch-write-python-for-build-3.12.patch" -else - patch -p1 -i "${ROOT}/patch-write-python-for-build.patch" -fi - # Object files can get listed multiple times leading to duplicate symbols # when linking. Prevent this. if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_10}" ]; then @@ -804,12 +796,18 @@ if [ -n "${CPYTHON_DEBUG}" ]; then PYTHON_BINARY_SUFFIX="${PYTHON_BINARY_SUFFIX}d" fi -# Python interpreter to use during the build. When cross-compiling, -# we have the Makefile emit a script which sets some environment -# variables that force the invoked Python to pick up the configuration -# of the target Python but invoke the host binary. +# Python interpreter to use during the build. When cross-compiling, emit a +# script with Make's expanded PYTHON_FOR_BUILD value. This sets environment +# variables that force the invoked Python to pick up the configuration of the +# target Python but invoke the host binary. if [ -n "${CROSS_COMPILING}" ]; then - make write-python-for-build + make -f - python-for-build <<'EOF' +include Makefile + +python-for-build: + printf "%s\n" "#!/bin/sh" "set -e" "exec env $(PYTHON_FOR_BUILD) \$$@" > python-for-build + chmod +x python-for-build +EOF BUILD_PYTHON=$(pwd)/python-for-build else BUILD_PYTHON=${ROOT}/out/python/install/bin/python3 diff --git a/cpython-unix/patch-write-python-for-build-3.12.patch b/cpython-unix/patch-write-python-for-build-3.12.patch deleted file mode 100644 index b25927f66..000000000 --- a/cpython-unix/patch-write-python-for-build-3.12.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/Makefile.pre.in b/Makefile.pre.in -index 09ceccda1d..91e08cf28f 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -2769,6 +2769,12 @@ update-config: - - Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h - -+write-python-for-build: -+ echo "#!/bin/sh" > python-for-build -+ echo "set -e" >> python-for-build -+ echo "exec env $(PYTHON_FOR_BUILD) \$$@" >> python-for-build -+ chmod +x python-for-build -+ - ########################################################################## - # Module dependencies and platform-specific files - diff --git a/cpython-unix/patch-write-python-for-build.patch b/cpython-unix/patch-write-python-for-build.patch deleted file mode 100644 index 17cbc6895..000000000 --- a/cpython-unix/patch-write-python-for-build.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/Makefile.pre.in b/Makefile.pre.in -index f128444b98..d2013a2987 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -1930,6 +1930,12 @@ patchcheck: @DEF_MAKE_RULE@ - - Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h - -+write-python-for-build: -+ echo "#!/bin/sh" > python-for-build -+ echo "set -e" >> python-for-build -+ echo "exec env $(PYTHON_FOR_BUILD) \$$@" >> python-for-build -+ chmod +x python-for-build -+ - # Declare targets that aren't real files - .PHONY: all build_all sharedmods check-clean-src oldsharedmods test quicktest - .PHONY: install altinstall oldsharedinstall bininstall altbininstall