-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
gh-114099: Add configure and Makefile targets to support iOS compilation. #115390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
dfd97f8
Add configure and Makefile targets to support iOS compilation.
freakboy3742 838713d
Improve error handling and reuse in configure.ac.
freakboy3742 5b54336
Clarifications to iOS README from review.
freakboy3742 9a5f851
Normalize usage of arm64 in iOS README.
freakboy3742 8c763af
Move the future location of the iOS testbed project to the iOS folder.
freakboy3742 95275c1
Corrections to iOS README.
freakboy3742 9f851b0
Merge branch 'main' into iOS-configure-targets
freakboy3742 302a5b0
Add note about Command Line Tools, and the need for a Simulator platf…
freakboy3742 ba946fb
Modify compiler utility scripts to avoid bash, and allow for SDK vers…
freakboy3742 24b3770
Added support for DESTDIR to iOS framework targets.
freakboy3742 3a1a6fb
Correct dependency issue with parallel builds.
freakboy3742 6247052
Correct issue with finding resources when not building from the root …
freakboy3742 ee41015
Merge branch 'main' into ios-configure-targets
freakboy3742 49778fe
Removed an unnecessary srcdir usage.
freakboy3742 8a3cbeb
Clarified the restriction on host python compatibility.
freakboy3742 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -912,6 +912,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \ | |
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK) | ||
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources | ||
|
||
# This rule is for iOS, which requires an annoyingly just slighly different | ||
# format for frameworks to macOS. It *doesn't* use a versioned framework, and | ||
# the Info.plist must be in the root of the framework. | ||
$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \ | ||
$(LIBRARY) \ | ||
$(RESSRCDIR)/Info.plist | ||
$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR) | ||
$(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \ | ||
-all_load $(LIBRARY) \ | ||
-install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \ | ||
-compatibility_version $(VERSION) \ | ||
-current_version $(VERSION) \ | ||
-framework CoreFoundation $(LIBS); | ||
$(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist | ||
|
||
# This rule builds the Cygwin Python DLL and import library if configured | ||
# for a shared core library; otherwise, this rule is a noop. | ||
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS) | ||
|
@@ -2607,10 +2622,11 @@ frameworkinstall: install | |
# only have to cater for the structural bits of the framework. | ||
|
||
.PHONY: frameworkinstallframework | ||
frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib | ||
frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib | ||
|
||
.PHONY: frameworkinstallstructure | ||
frameworkinstallstructure: $(LDLIBRARY) | ||
# macOS uses a versioned frameworks structure that includes a full install | ||
.PHONY: frameworkinstallversionedstructure | ||
frameworkinstallversionedstructure: $(LDLIBRARY) | ||
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ | ||
echo Not configured with --enable-framework; \ | ||
exit 1; \ | ||
|
@@ -2631,6 +2647,27 @@ frameworkinstallstructure: $(LDLIBRARY) | |
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources | ||
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) | ||
|
||
# iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the | ||
# framework root, no .lproj data, and only stub compilation assistance binaries | ||
.PHONY: frameworkinstallunversionedstructure | ||
frameworkinstallunversionedstructure: $(LDLIBRARY) | ||
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ | ||
echo Not configured with --enable-framework; \ | ||
exit 1; \ | ||
else true; \ | ||
fi | ||
if test -d $(PYTHONFRAMEWORKPREFIX)/include; then \ | ||
echo "Clearing stale header symlink directory"; \ | ||
rm -rf $(PYTHONFRAMEWORKPREFIX)/include; \ | ||
fi | ||
$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKINSTALLDIR) | ||
sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(PYTHONFRAMEWORKINSTALLDIR)/Info.plist | ||
$(INSTALL_SHARED) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) | ||
$(INSTALL) -d -m $(DIRMODE) $(BINDIR) | ||
for file in $(RESSRCDIR)/bin/* ; do \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When building outside of the source directory, the copy operation of the stub scripts to the bin directory fails because they are only in the source directory.
|
||
$(INSTALL) -m $(EXEMODE) $$file $(BINDIR); \ | ||
done | ||
|
||
# This installs Mac/Lib into the framework | ||
# Install a number of symlinks to keep software that expects a normal unix | ||
# install (which includes python-config) happy. | ||
|
@@ -2671,6 +2708,19 @@ frameworkaltinstallunixtools: | |
frameworkinstallextras: | ||
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)" | ||
|
||
# On iOS, bin/lib can't live inside the framework; include needs to be called | ||
# "Headers", but *must* be in the framework, and *not* include the `python3.X` | ||
# subdirectory. The install has put these folders in the same folder as | ||
# Python.framework; Move the headers to their final framework-compatible home. | ||
.PHONY: frameworkinstallmobileheaders | ||
frameworkinstallmobileheaders: | ||
if test -d $(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \ | ||
echo "Removing old framework headers"; \ | ||
rm -rf $(PYTHONFRAMEWORKINSTALLDIR)/Headers; \ | ||
fi | ||
mv "$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(PYTHONFRAMEWORKINSTALLDIR)/Headers" | ||
$(LN) -fs "$(PYTHONFRAMEWORKDIR)" "$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" | ||
|
||
# Build the toplevel Makefile | ||
Makefile.pre: $(srcdir)/Makefile.pre.in config.status | ||
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status | ||
|
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Build/2024-02-13-14-52-59.gh-issue-114099.zjXsQr.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Makefile targets were added to support compiling an iOS-compatible framework | ||
build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.