@@ -871,6 +871,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
871
871
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
872
872
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
873
873
874
+ # This rule is for iOS, which requires an annoyingly just slighly different
875
+ # format for frameworks to macOS. It *doesn't* use a versioned framework, and
876
+ # the Info.plist must be in the root of the framework.
877
+ $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
878
+ $(LIBRARY) \
879
+ $(RESSRCDIR)/Info.plist
880
+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
881
+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
882
+ -all_load $(LIBRARY) \
883
+ -install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
884
+ -compatibility_version $(VERSION) \
885
+ -current_version $(VERSION) \
886
+ -framework CoreFoundation $(LIBS);
887
+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist
888
+
874
889
# This rule builds the Cygwin Python DLL and import library if configured
875
890
# for a shared core library; otherwise, this rule is a noop.
876
891
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2511,10 +2526,11 @@ frameworkinstall: install
2511
2526
# only have to cater for the structural bits of the framework.
2512
2527
2513
2528
.PHONY: frameworkinstallframework
2514
- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2529
+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
2515
2530
2516
- .PHONY: frameworkinstallstructure
2517
- frameworkinstallstructure: $(LDLIBRARY)
2531
+ # macOS uses a versioned frameworks structure that includes a full install
2532
+ .PHONY: frameworkinstallversionedstructure
2533
+ frameworkinstallversionedstructure: $(LDLIBRARY)
2518
2534
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2519
2535
echo Not configured with --enable-framework; \
2520
2536
exit 1; \
@@ -2535,6 +2551,27 @@ frameworkinstallstructure: $(LDLIBRARY)
2535
2551
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
2536
2552
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2537
2553
2554
+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
2555
+ # framework root, no .lproj data, and only stub compilation assistance binaries
2556
+ .PHONY: frameworkinstallunversionedstructure
2557
+ frameworkinstallunversionedstructure: $(LDLIBRARY)
2558
+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2559
+ echo Not configured with --enable-framework; \
2560
+ exit 1; \
2561
+ else true; \
2562
+ fi
2563
+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
2564
+ echo "Clearing stale header symlink directory"; \
2565
+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
2566
+ fi
2567
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
2568
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
2569
+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2570
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
2571
+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
2572
+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
2573
+ done
2574
+
2538
2575
# This installs Mac/Lib into the framework
2539
2576
# Install a number of symlinks to keep software that expects a normal unix
2540
2577
# install (which includes python-config) happy.
@@ -2575,6 +2612,19 @@ frameworkaltinstallunixtools:
2575
2612
frameworkinstallextras:
2576
2613
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
2577
2614
2615
+ # On iOS, bin/lib can't live inside the framework; include needs to be called
2616
+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
2617
+ # subdirectory. The install has put these folders in the same folder as
2618
+ # Python.framework; Move the headers to their final framework-compatible home.
2619
+ .PHONY: frameworkinstallmobileheaders
2620
+ frameworkinstallmobileheaders:
2621
+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2622
+ echo "Removing old framework headers"; \
2623
+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
2624
+ fi
2625
+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
2626
+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
2627
+
2578
2628
# Build the toplevel Makefile
2579
2629
Makefile.pre: $(srcdir)/Makefile.pre.in config.status
2580
2630
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
0 commit comments