@@ -912,6 +912,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
912
912
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
913
913
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
914
914
915
+ # This rule is for iOS, which requires an annoyingly just slighly different
916
+ # format for frameworks to macOS. It *doesn't* use a versioned framework, and
917
+ # the Info.plist must be in the root of the framework.
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
+ -framework CoreFoundation $(LIBS);
928
+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
929
+
915
930
# This rule builds the Cygwin Python DLL and import library if configured
916
931
# for a shared core library; otherwise, this rule is a noop.
917
932
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2607,10 +2622,11 @@ frameworkinstall: install
2607
2622
# only have to cater for the structural bits of the framework.
2608
2623
2609
2624
.PHONY: frameworkinstallframework
2610
- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2625
+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
2611
2626
2612
- .PHONY: frameworkinstallstructure
2613
- frameworkinstallstructure: $(LDLIBRARY)
2627
+ # macOS uses a versioned frameworks structure that includes a full install
2628
+ .PHONY: frameworkinstallversionedstructure
2629
+ frameworkinstallversionedstructure: $(LDLIBRARY)
2614
2630
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2615
2631
echo Not configured with --enable-framework; \
2616
2632
exit 1; \
@@ -2631,6 +2647,27 @@ frameworkinstallstructure: $(LDLIBRARY)
2631
2647
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
2632
2648
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2633
2649
2650
+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
2651
+ # framework root, no .lproj data, and only stub compilation assistance binaries
2652
+ .PHONY: frameworkinstallunversionedstructure
2653
+ frameworkinstallunversionedstructure: $(LDLIBRARY)
2654
+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2655
+ echo Not configured with --enable-framework; \
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
+
2634
2671
# This installs Mac/Lib into the framework
2635
2672
# Install a number of symlinks to keep software that expects a normal unix
2636
2673
# install (which includes python-config) happy.
@@ -2671,6 +2708,19 @@ frameworkaltinstallunixtools:
2671
2708
frameworkinstallextras:
2672
2709
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
2673
2710
2711
+ # On iOS, bin/lib can't live inside the framework; include needs to be called
2712
+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
2713
+ # subdirectory. The install has put these folders in the same folder as
2714
+ # Python.framework; Move the headers to their final framework-compatible home.
2715
+ .PHONY: frameworkinstallmobileheaders
2716
+ frameworkinstallmobileheaders:
2717
+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2718
+ echo "Removing old framework 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
+
2674
2724
# Build the toplevel Makefile
2675
2725
Makefile.pre: $(srcdir)/Makefile.pre.in config.status
2676
2726
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
0 commit comments