@@ -871,6 +871,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
871871 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
872872 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
873873
874+ # This rule is for iOS, which requires an annoyingly just slighly different
875+ # format for frameworks to macOS. It *doesn't* use a versioned framework, and
876+ # the Info.plist must be in the root of the framework.
877+ $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
878+ $(LIBRARY) \
879+ $(RESSRCDIR)/Info.plist
880+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
881+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
882+ -all_load $(LIBRARY) \
883+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
884+ -compatibility_version $(VERSION) \
885+ -current_version $(VERSION) \
886+ -framework CoreFoundation $(LIBS);
887+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
888+
874889# This rule builds the Cygwin Python DLL and import library if configured
875890# for a shared core library; otherwise, this rule is a noop.
876891$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2505,10 +2520,11 @@ frameworkinstall: install
25052520# only have to cater for the structural bits of the framework.
25062521
25072522.PHONY: frameworkinstallframework
2508- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2523+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
25092524
2510- .PHONY: frameworkinstallstructure
2511- frameworkinstallstructure: $(LDLIBRARY)
2525+ # macOS uses a versioned frameworks structure that includes a full install
2526+ .PHONY: frameworkinstallversionedstructure
2527+ frameworkinstallversionedstructure: $(LDLIBRARY)
25122528 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
25132529 echo Not configured with --enable-framework; \
25142530 exit 1; \
@@ -2529,6 +2545,27 @@ frameworkinstallstructure: $(LDLIBRARY)
25292545 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
25302546 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
25312547
2548+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
2549+ # framework root, no .lproj data, and only stub compilation assistance binaries
2550+ .PHONY: frameworkinstallunversionedstructure
2551+ frameworkinstallunversionedstructure: $(LDLIBRARY)
2552+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2553+ echo Not configured with --enable-framework; \
2554+ exit 1; \
2555+ else true; \
2556+ fi
2557+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
2558+ echo "Clearing stale header symlink directory"; \
2559+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
2560+ fi
2561+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
2562+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
2563+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2564+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
2565+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
2566+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
2567+ done
2568+
25322569# This installs Mac/Lib into the framework
25332570# Install a number of symlinks to keep software that expects a normal unix
25342571# install (which includes python-config) happy.
@@ -2569,6 +2606,19 @@ frameworkaltinstallunixtools:
25692606frameworkinstallextras:
25702607 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
25712608
2609+ # On iOS, bin/lib can't live inside the framework; include needs to be called
2610+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
2611+ # subdirectory. The install has put these folders in the same folder as
2612+ # Python.framework; Move the headers to their final framework-compatible home.
2613+ .PHONY: frameworkinstallmobileheaders
2614+ frameworkinstallmobileheaders:
2615+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2616+ echo "Removing old framework headers"; \
2617+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
2618+ fi
2619+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
2620+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
2621+
25722622# Build the toplevel Makefile
25732623Makefile.pre: $(srcdir)/Makefile.pre.in config.status
25742624 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
0 commit comments