@@ -700,6 +700,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
700
700
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
701
701
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
702
702
703
+ # This rule is for iOS, which requires an annoyingly just slighly different
704
+ # format for frameworks to macOS. It *doesn't* use a versioned framework, and
705
+ # the Info.plist must be in the root of the framework.
706
+ $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
707
+ $(LIBRARY) \
708
+ $(RESSRCDIR)/Info.plist
709
+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
710
+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
711
+ -all_load $(LIBRARY) \
712
+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
713
+ -compatibility_version $(VERSION) \
714
+ -current_version $(VERSION) \
715
+ -framework CoreFoundation $(LIBS);
716
+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
717
+
703
718
# This rule builds the Cygwin Python DLL and import library if configured
704
719
# for a shared core library; otherwise, this rule is a noop.
705
720
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -1725,9 +1740,11 @@ frameworkinstall: install
1725
1740
# automatically set prefix to the location deep down in the framework, so we
1726
1741
# only have to cater for the structural bits of the framework.
1727
1742
1728
- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1743
+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
1729
1744
1730
- frameworkinstallstructure: $(LDLIBRARY)
1745
+ # macOS uses a versioned frameworks structure that includes a full install
1746
+ .PHONY: frameworkinstallversionedstructure
1747
+ frameworkinstallversionedstructure: $(LDLIBRARY)
1731
1748
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1732
1749
echo Not configured with --enable-framework; \
1733
1750
exit 1; \
@@ -1748,6 +1765,27 @@ frameworkinstallstructure: $(LDLIBRARY)
1748
1765
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1749
1766
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1750
1767
1768
+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
1769
+ # framework root, no .lproj data, and only stub compilation assistance binaries
1770
+ .PHONY: frameworkinstallunversionedstructure
1771
+ frameworkinstallunversionedstructure: $(LDLIBRARY)
1772
+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1773
+ echo Not configured with --enable-framework; \
1774
+ exit 1; \
1775
+ else true; \
1776
+ fi
1777
+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
1778
+ echo "Clearing stale header symlink directory"; \
1779
+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
1780
+ fi
1781
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
1782
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
1783
+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1784
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
1785
+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
1786
+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
1787
+ done
1788
+
1751
1789
# This installs Mac/Lib into the framework
1752
1790
# Install a number of symlinks to keep software that expects a normal unix
1753
1791
# install (which includes python-config) happy.
@@ -1782,6 +1820,19 @@ frameworkaltinstallunixtools:
1782
1820
frameworkinstallextras:
1783
1821
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1784
1822
1823
+ # On iOS, bin/lib can't live inside the framework; include needs to be called
1824
+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
1825
+ # subdirectory. The install has put these folders in the same folder as
1826
+ # Python.framework; Move the headers to their final framework-compatible home.
1827
+ .PHONY: frameworkinstallmobileheaders
1828
+ frameworkinstallmobileheaders:
1829
+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
1830
+ echo "Removing old framework headers"; \
1831
+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
1832
+ fi
1833
+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
1834
+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
1835
+
1785
1836
# Build the toplevel Makefile
1786
1837
Makefile.pre: $(srcdir)/Makefile.pre.in config.status
1787
1838
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
@@ -1980,7 +2031,7 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
1980
2031
.PHONY: all build_all sharedmods check-clean-src oldsharedmods test quicktest
1981
2032
.PHONY: install altinstall oldsharedinstall bininstall altbininstall
1982
2033
.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1983
- .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
2034
+ .PHONY: frameworkinstall frameworkinstallframework
1984
2035
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1985
2036
.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
1986
2037
.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
0 commit comments