@@ -697,6 +697,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
697
697
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
698
698
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
699
699
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
+
700
715
# This rule builds the Cygwin Python DLL and import library if configured
701
716
# for a shared core library; otherwise, this rule is a noop.
702
717
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -1778,9 +1793,11 @@ frameworkinstall: install
1778
1793
# automatically set prefix to the location deep down in the framework, so we
1779
1794
# only have to cater for the structural bits of the framework.
1780
1795
1781
- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1796
+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
1782
1797
1783
- frameworkinstallstructure: $(LDLIBRARY)
1798
+ # macOS uses a versioned frameworks structure that includes a full install
1799
+ .PHONY: frameworkinstallversionedstructure
1800
+ frameworkinstallversionedstructure: $(LDLIBRARY)
1784
1801
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1785
1802
echo Not configured with --enable-framework; \
1786
1803
exit 1; \
@@ -1801,6 +1818,27 @@ frameworkinstallstructure: $(LDLIBRARY)
1801
1818
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1802
1819
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1803
1820
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
+
1804
1842
# This installs Mac/Lib into the framework
1805
1843
# Install a number of symlinks to keep software that expects a normal unix
1806
1844
# install (which includes python-config) happy.
@@ -1835,6 +1873,19 @@ frameworkaltinstallunixtools:
1835
1873
frameworkinstallextras:
1836
1874
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1837
1875
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
+
1838
1889
# Build the toplevel Makefile
1839
1890
Makefile.pre: $(srcdir)/Makefile.pre.in config.status
1840
1891
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
@@ -2035,7 +2086,7 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
2035
2086
.PHONY: all build_all sharedmods check-clean-src oldsharedmods test quicktest
2036
2087
.PHONY: install altinstall oldsharedinstall bininstall altbininstall
2037
2088
.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
2038
- .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
2089
+ .PHONY: frameworkinstall frameworkinstallframework
2039
2090
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
2040
2091
.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
2041
2092
.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
0 commit comments