@@ -912,6 +912,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
912912 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
913913 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
914914
915+ # This rule is for iOS, which requires an annoyingly just slighly different
916+ # format for frameworks to macOS. It *doesn't* use a versioned framework, and
917+ # the Info.plist must be in the root of the framework.
918+ $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
919+ $(LIBRARY) \
920+ $(RESSRCDIR)/Info.plist
921+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
922+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
923+ -all_load $(LIBRARY) \
924+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
925+ -compatibility_version $(VERSION) \
926+ -current_version $(VERSION) \
927+ -framework CoreFoundation $(LIBS);
928+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
929+
915930# This rule builds the Cygwin Python DLL and import library if configured
916931# for a shared core library; otherwise, this rule is a noop.
917932$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2607,10 +2622,11 @@ frameworkinstall: install
26072622# only have to cater for the structural bits of the framework.
26082623
26092624.PHONY: frameworkinstallframework
2610- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2625+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
26112626
2612- .PHONY: frameworkinstallstructure
2613- frameworkinstallstructure: $(LDLIBRARY)
2627+ # macOS uses a versioned frameworks structure that includes a full install
2628+ .PHONY: frameworkinstallversionedstructure
2629+ frameworkinstallversionedstructure: $(LDLIBRARY)
26142630 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
26152631 echo Not configured with --enable-framework; \
26162632 exit 1; \
@@ -2631,6 +2647,27 @@ frameworkinstallstructure: $(LDLIBRARY)
26312647 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
26322648 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
26332649
2650+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
2651+ # framework root, no .lproj data, and only stub compilation assistance binaries
2652+ .PHONY: frameworkinstallunversionedstructure
2653+ frameworkinstallunversionedstructure: $(LDLIBRARY)
2654+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2655+ echo Not configured with --enable-framework; \
2656+ exit 1; \
2657+ else true; \
2658+ fi
2659+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
2660+ echo "Clearing stale header symlink directory"; \
2661+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
2662+ fi
2663+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
2664+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
2665+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2666+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
2667+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
2668+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
2669+ done
2670+
26342671# This installs Mac/Lib into the framework
26352672# Install a number of symlinks to keep software that expects a normal unix
26362673# install (which includes python-config) happy.
@@ -2671,6 +2708,19 @@ frameworkaltinstallunixtools:
26712708frameworkinstallextras:
26722709 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
26732710
2711+ # On iOS, bin/lib can't live inside the framework; include needs to be called
2712+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
2713+ # subdirectory. The install has put these folders in the same folder as
2714+ # Python.framework; Move the headers to their final framework-compatible home.
2715+ .PHONY: frameworkinstallmobileheaders
2716+ frameworkinstallmobileheaders:
2717+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2718+ echo "Removing old framework headers"; \
2719+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
2720+ fi
2721+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
2722+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
2723+
26742724# Build the toplevel Makefile
26752725Makefile.pre: $(srcdir)/Makefile.pre.in config.status
26762726 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
0 commit comments