summaryrefslogtreecommitdiffstats
path: root/Makefile.pre.in
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2024-07-21 23:36:08 (GMT)
committerGitHub <noreply@github.com>2024-07-21 23:36:08 (GMT)
commit728432c8043edc07bb8a24b180a70778fcd35878 (patch)
treea4e8a99cee2c762935cb4d1d0a3e37d41f5ca86f /Makefile.pre.in
parent5901d92739c6e53668e3924eaff38e2e9eb95162 (diff)
downloadcpython-728432c8043edc07bb8a24b180a70778fcd35878.zip
cpython-728432c8043edc07bb8a24b180a70778fcd35878.tar.gz
cpython-728432c8043edc07bb8a24b180a70778fcd35878.tar.bz2
gh-120522: Apply App Store compliance patch during installation (#121947)
Adds a --with-app-store-compliance configuration option that patches out code known to be an issue with App Store review processes. This option is applied automatically on iOS, and optionally on macOS.
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r--Makefile.pre.in23
1 files changed, 22 insertions, 1 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 3b2e35d..1a8f4d3 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -179,6 +179,9 @@ EXPORTSFROM= @EXPORTSFROM@
EXE= @EXEEXT@
BUILDEXE= @BUILDEXEEXT@
+# Name of the patch file to apply for app store compliance
+APP_STORE_COMPLIANCE_PATCH=@APP_STORE_COMPLIANCE_PATCH@
+
# Short name and location for Mac OS X Python framework
UNIVERSALSDK=@UNIVERSALSDK@
PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
@@ -692,7 +695,7 @@ list-targets:
@grep -E '^[A-Za-z][-A-Za-z0-9]+:' Makefile | awk -F : '{print $$1}'
.PHONY: build_all
-build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \
+build_all: check-clean-src check-app-store-compliance $(BUILDPYTHON) platform sharedmods \
gdbhooks Programs/_testembed scripts checksharedmods rundsymutil
.PHONY: build_wasm
@@ -715,6 +718,16 @@ check-clean-src:
exit 1; \
fi
+# Check that the app store compliance patch can be applied (if configured).
+# This is checked as a dry-run against the original library sources;
+# the patch will be actually applied during the install phase.
+.PHONY: check-app-store-compliance
+check-app-store-compliance:
+ @if [ "$(APP_STORE_COMPLIANCE_PATCH)" != "" ]; then \
+ patch --dry-run --quiet --force --strip 1 --directory "$(abs_srcdir)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)"; \
+ echo "App store compliance patch can be applied."; \
+ fi
+
# Profile generation build must start from a clean tree.
profile-clean-stamp:
$(MAKE) clean
@@ -2570,6 +2583,14 @@ libinstall: all $(srcdir)/Modules/xxmodule.c
$(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
$(DESTDIR)$(LIBDEST); \
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+ @ # If app store compliance has been configured, apply the patch to the
+ @ # installed library code. The patch has been previously validated against
+ @ # the original source tree, so we can ignore any errors that are raised
+ @ # due to files that are missing because of --disable-test-modules etc.
+ @if [ "$(APP_STORE_COMPLIANCE_PATCH)" != "" ]; then \
+ echo "Applying app store compliance patch"; \
+ patch --force --reject-file "$(abs_builddir)/app-store-compliance.rej" --strip 2 --directory "$(DESTDIR)$(LIBDEST)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)" || true ; \
+ fi
@ # Build PYC files for the 3 optimization levels (0, 1, 2)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \