@@ -697,6 +697,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
697697 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
698698 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
699699
700+ # This rule is for iOS, which requires an annoyingly just slighly different
701+ # format for frameworks to macOS. It *doesn't* use a versioned framework, and
702+ # the Info.plist must be in the root of the framework.
703+ $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
704+ $(LIBRARY) \
705+ $(RESSRCDIR)/Info.plist
706+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
707+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
708+ -all_load $(LIBRARY) \
709+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
710+ -compatibility_version $(VERSION) \
711+ -current_version $(VERSION) \
712+ -framework CoreFoundation $(LIBS);
713+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
714+
700715# This rule builds the Cygwin Python DLL and import library if configured
701716# for a shared core library; otherwise, this rule is a noop.
702717$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -1778,9 +1793,11 @@ frameworkinstall: install
17781793# automatically set prefix to the location deep down in the framework, so we
17791794# only have to cater for the structural bits of the framework.
17801795
1781- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1796+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
17821797
1783- frameworkinstallstructure: $(LDLIBRARY)
1798+ # macOS uses a versioned frameworks structure that includes a full install
1799+ .PHONY: frameworkinstallversionedstructure
1800+ frameworkinstallversionedstructure: $(LDLIBRARY)
17841801 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
17851802 echo Not configured with --enable-framework; \
17861803 exit 1; \
@@ -1801,6 +1818,27 @@ frameworkinstallstructure: $(LDLIBRARY)
18011818 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
18021819 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
18031820
1821+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
1822+ # framework root, no .lproj data, and only stub compilation assistance binaries
1823+ .PHONY: frameworkinstallunversionedstructure
1824+ frameworkinstallunversionedstructure: $(LDLIBRARY)
1825+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1826+ echo Not configured with --enable-framework; \
1827+ exit 1; \
1828+ else true; \
1829+ fi
1830+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
1831+ echo "Clearing stale header symlink directory"; \
1832+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
1833+ fi
1834+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
1835+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
1836+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1837+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
1838+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
1839+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
1840+ done
1841+
18041842# This installs Mac/Lib into the framework
18051843# Install a number of symlinks to keep software that expects a normal unix
18061844# install (which includes python-config) happy.
@@ -1835,6 +1873,19 @@ frameworkaltinstallunixtools:
18351873frameworkinstallextras:
18361874 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
18371875
1876+ # On iOS, bin/lib can't live inside the framework; include needs to be called
1877+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
1878+ # subdirectory. The install has put these folders in the same folder as
1879+ # Python.framework; Move the headers to their final framework-compatible home.
1880+ .PHONY: frameworkinstallmobileheaders
1881+ frameworkinstallmobileheaders:
1882+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
1883+ echo "Removing old framework headers"; \
1884+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
1885+ fi
1886+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
1887+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
1888+
18381889# Build the toplevel Makefile
18391890Makefile.pre: $(srcdir)/Makefile.pre.in config.status
18401891 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
@@ -2035,7 +2086,7 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
20352086.PHONY: all build_all sharedmods check-clean-src oldsharedmods test quicktest
20362087.PHONY: install altinstall oldsharedinstall bininstall altbininstall
20372088.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
2038- .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
2089+ .PHONY: frameworkinstall frameworkinstallframework
20392090.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
20402091.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
20412092.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
0 commit comments