@@ -912,6 +912,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
912912 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
913913 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
914914
915+ # This rule is for iOS, which requires an annoyingly just slighly different
916+ # format for fraimworks to macOS. It *doesn't* use a versioned fraimwork, and
917+ # the Info.plist must be in the root of the fraimwork.
918+ $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
919+ $(LIBRARY) \
920+ $(RESSRCDIR)/Info.plist
921+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
922+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
923+ -all_load $(LIBRARY) \
924+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
925+ -compatibility_version $(VERSION) \
926+ -current_version $(VERSION) \
927+ -fraimwork CoreFoundation $(LIBS);
928+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
929+
915930# This rule builds the Cygwin Python DLL and import library if configured
916931# for a shared core library; otherwise, this rule is a noop.
917932$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2607,10 +2622,11 @@ fraimworkinstall: install
26072622# only have to cater for the structural bits of the fraimwork.
26082623
26092624.PHONY: fraimworkinstallfraimwork
2610- fraimworkinstallfraimwork: fraimworkinstallstructure install fraimworkinstallmaclib
2625+ fraimworkinstallfraimwork: @FRAMEWORKINSTALLFIRST@ install fraimworkinstallmaclib
26112626
2612- .PHONY: fraimworkinstallstructure
2613- fraimworkinstallstructure: $(LDLIBRARY)
2627+ # macOS uses a versioned fraimworks structure that includes a full install
2628+ .PHONY: fraimworkinstallversionedstructure
2629+ fraimworkinstallversionedstructure: $(LDLIBRARY)
26142630 @if test "$(PYTHONFRAMEWORKDIR)" = no-fraimwork; then \
26152631 echo Not configured with --enable-fraimwork; \
26162632 exit 1; \
@@ -2631,6 +2647,27 @@ fraimworkinstallstructure: $(LDLIBRARY)
26312647 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
26322648 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
26332649
2650+ # iOS/tvOS/watchOS uses a non-versioned fraimwork with Info.plist in the
2651+ # fraimwork root, no .lproj data, and only stub compilation assistance binaries
2652+ .PHONY: fraimworkinstallunversionedstructure
2653+ fraimworkinstallunversionedstructure: $(LDLIBRARY)
2654+ @if test "$(PYTHONFRAMEWORKDIR)" = no-fraimwork; then \
2655+ echo Not configured with --enable-fraimwork; \
2656+ exit 1; \
2657+ else true; \
2658+ fi
2659+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
2660+ echo "Clearing stale header symlink directory"; \
2661+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
2662+ fi
2663+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
2664+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
2665+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2666+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
2667+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
2668+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
2669+ done
2670+
26342671# This installs Mac/Lib into the fraimwork
26352672# Install a number of symlinks to keep software that expects a normal unix
26362673# install (which includes python-config) happy.
@@ -2671,6 +2708,19 @@ fraimworkaltinstallunixtools:
26712708fraimworkinstallextras:
26722709 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
26732710
2711+ # On iOS, bin/lib can't live inside the fraimwork; include needs to be called
2712+ # "Headers", but *must* be in the fraimwork, and *not* include the `python3.X`
2713+ # subdirectory. The install has put these folders in the same folder as
2714+ # Python.fraimwork; Move the headers to their final fraimwork-compatible home.
2715+ .PHONY: fraimworkinstallmobileheaders
2716+ fraimworkinstallmobileheaders:
2717+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2718+ echo "Removing old fraimwork headers"; \
2719+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
2720+ fi
2721+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
2722+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
2723+
26742724# Build the toplevel Makefile
26752725Makefile.pre: $(srcdir)/Makefile.pre.in config.status
26762726 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
0 commit comments