@@ -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)
@@ -2506,10 +2521,11 @@ frameworkinstall: install
2506
2521
# only have to cater for the structural bits of the framework.
2507
2522
2508
2523
.PHONY: frameworkinstallframework
2509
- frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
2524
+ frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib
2510
2525
2511
- .PHONY: frameworkinstallstructure
2512
- frameworkinstallstructure: $(LDLIBRARY)
2526
+ # macOS uses a versioned frameworks structure that includes a full install
2527
+ .PHONY: frameworkinstallversionedstructure
2528
+ frameworkinstallversionedstructure: $(LDLIBRARY)
2513
2529
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2514
2530
echo Not configured with --enable-framework; \
2515
2531
exit 1; \
@@ -2530,6 +2546,27 @@ frameworkinstallstructure: $(LDLIBRARY)
2530
2546
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
2531
2547
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2532
2548
2549
+ # iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
2550
+ # framework root, no .lproj data, and only stub compilation assistance binaries
2551
+ .PHONY: frameworkinstallunversionedstructure
2552
+ frameworkinstallunversionedstructure: $(LDLIBRARY)
2553
+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2554
+ echo Not configured with --enable-framework; \
2555
+ exit 1; \
2556
+ else true; \
2557
+ fi
2558
+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; then \
2559
+ echo "Clearing stale header symlink directory"; \
2560
+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include; \
2561
+ fi
2562
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)
2563
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
2564
+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
2565
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(BINDIR)
2566
+ for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \
2567
+ $(INSTALL) -m $(EXEMODE) $$file $(DESTDIR)$(BINDIR); \
2568
+ done
2569
+
2533
2570
# This installs Mac/Lib into the framework
2534
2571
# Install a number of symlinks to keep software that expects a normal unix
2535
2572
# install (which includes python-config) happy.
@@ -2570,6 +2607,19 @@ frameworkaltinstallunixtools:
2570
2607
frameworkinstallextras:
2571
2608
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
2572
2609
2610
+ # On iOS, bin/lib can't live inside the framework; include needs to be called
2611
+ # "Headers", but *must* be in the framework, and *not* include the `python3.X`
2612
+ # subdirectory. The install has put these folders in the same folder as
2613
+ # Python.framework; Move the headers to their final framework-compatible home.
2614
+ .PHONY: frameworkinstallmobileheaders
2615
+ frameworkinstallmobileheaders:
2616
+ if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
2617
+ echo "Removing old framework headers"; \
2618
+ rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
2619
+ fi
2620
+ mv "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
2621
+ $(LN) -fs "../$(PYTHONFRAMEWORKDIR)/Headers" "$(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"
2622
+
2573
2623
# Build the toplevel Makefile
2574
2624
Makefile.pre: $(srcdir)/Makefile.pre.in config.status
2575
2625
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
0 commit comments