@@ -814,6 +814,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
814814 $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
815815 $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
816816
817+ # This rule is for iOS, which requires an annoyingly just slighly different
818+ # format for frameworks to macOS. It *doesn't* use a versioned framework, and
819+ # the Info.plist must be in the root of the framework.
820+ $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
821+ $(LIBRARY) \
822+ $(RESSRCDIR)/Info.plist
823+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
824+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
825+ -all_load $(LIBRARY) \
826+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
827+ -compatibility_version $(VERSION) \
828+ -current_version $(VERSION) \
829+ -framework CoreFoundation $(LIBS);
830+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
831+
817832# This rule builds the Cygwin Python DLL and import library if configured
818833# for a shared core library; otherwise, this rule is a noop.
819834$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2324,9 +2339,11 @@ frameworkinstall: install
23242339# automatically set prefix to the location deep down in the framework, so we
23252340# only have to cater for the structural bits of the framework.
23262341
2327- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2342+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
23282343
2329- frameworkinstallstructure: $(LDLIBRARY)
2344+ # macOS uses a versioned frameworks structure that includes a full install
2345+ .PHONY: frameworkinstallversionedstructure
2346+ frameworkinstallversionedstructure: $(LDLIBRARY)
23302347 @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
23312348 echo Not configured with --enable-framework; \
23322349 exit 1; \
@@ -2347,6 +2364,27 @@ frameworkinstallstructure: $(LDLIBRARY)
23472364 $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
23482365 $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
23492366
2367+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
2368+ # framework root, no .lproj data, and only stub compilation assistance binaries
2369+ .PHONY: frameworkinstallunversionedstructure
2370+ frameworkinstallunversionedstructure: $(LDLIBRARY)
2371+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2372+ echo Not configured with --enable-framework; \
2373+ exit 1; \
2374+ else true; \
2375+ fi
2376+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
2377+ echo "Clearing stale header symlink directory"; \
2378+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
2379+ fi
2380+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
2381+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
2382+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2383+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
2384+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
2385+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
2386+ done
2387+
23502388# This installs Mac/Lib into the framework
23512389# Install a number of symlinks to keep software that expects a normal unix
23522390# install (which includes python-config) happy.
@@ -2381,6 +2419,19 @@ frameworkaltinstallunixtools:
23812419frameworkinstallextras:
23822420 cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
23832421
2422+ # On iOS, bin/lib can't live inside the framework; include needs to be called
2423+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
2424+ # subdirectory. The install has put these folders in the same folder as
2425+ # Python.framework; Move the headers to their final framework-compatible home.
2426+ .PHONY: frameworkinstallmobileheaders
2427+ frameworkinstallmobileheaders:
2428+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2429+ echo "Removing old framework headers"; \
2430+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
2431+ fi
2432+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
2433+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
2434+
23842435# Build the toplevel Makefile
23852436Makefile.pre: $(srcdir)/Makefile.pre.in config.status
23862437 CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
@@ -2586,7 +2637,7 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
25862637.PHONY: all build_all build_wasm sharedmods check-clean-src oldsharedmods test quicktest
25872638.PHONY: install altinstall oldsharedinstall bininstall altbininstall
25882639.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
2589- .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
2640+ .PHONY: frameworkinstall frameworkinstallframework
25902641.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
25912642.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
25922643.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
0 commit comments