@@ -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)
@@ -2513,10 +2528,11 @@ frameworkinstall: install
25132528# only have to cater for the structural bits of the framework.
25142529
25152530.PHONY: frameworkinstallframework
2516- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2531+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
25172532
2518- .PHONY: frameworkinstallstructure
2519- frameworkinstallstructure: $(LDLIBRARY)
2533+ # macOS uses a versioned frameworks structure that includes a full install
2534+ .PHONY: frameworkinstallversionedstructure
2535+ frameworkinstallversionedstructure: $(LDLIBRARY)
25202536 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
25212537 echo Not configured with --enable-framework; \
25222538 exit 1; \
@@ -2537,6 +2553,27 @@ frameworkinstallstructure: $(LDLIBRARY)
25372553 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
25382554 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
25392555
2556+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
2557+ # framework root, no .lproj data, and only stub compilation assistance binaries
2558+ .PHONY: frameworkinstallunversionedstructure
2559+ frameworkinstallunversionedstructure: $(LDLIBRARY)
2560+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2561+ echo Not configured with --enable-framework; \
2562+ exit 1; \
2563+ else true; \
2564+ fi
2565+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
2566+ echo "Clearing stale header symlink directory"; \
2567+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
2568+ fi
2569+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
2570+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
2571+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2572+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
2573+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
2574+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
2575+ done
2576+
25402577# This installs Mac/Lib into the framework
25412578# Install a number of symlinks to keep software that expects a normal unix
25422579# install (which includes python-config) happy.
@@ -2577,6 +2614,19 @@ frameworkaltinstallunixtools:
25772614frameworkinstallextras:
25782615 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
25792616
2617+ # On iOS, bin/lib can't live inside the framework; include needs to be called
2618+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
2619+ # subdirectory. The install has put these folders in the same folder as
2620+ # Python.framework; Move the headers to their final framework-compatible home.
2621+ .PHONY: frameworkinstallmobileheaders
2622+ frameworkinstallmobileheaders:
2623+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2624+ echo "Removing old framework headers"; \
2625+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
2626+ fi
2627+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
2628+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
2629+
25802630# Build the toplevel Makefile
25812631Makefile.pre: $(srcdir)/Makefile.pre.in config.status
25822632 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
0 commit comments