Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2f07786

Browse filesBrowse files
authored
gh-114099: Refactor configure and Makefile to accomodate non-macOS frameworks (#115120)
Part of the PEP 730 work to add iOS support. This change lays the groundwork for introducing iOS/tvOS/watchOS frameworks; it includes the structural refactoring needed so that iOS branches can be added into in a subsequent PR. Summary of changes: * Updates config.sub to the 2024-01-01 release. This is the "as released" version of config.sub. * Adds a RESSRCDIR variable to allow sharing of macOS and iOS Makefile steps. * Adds an INSTALLTARGETS variable so platforms can customise which targets are actually installed. This will be used to exclude certain targets (e.g., binaries, manfiles) from iOS framework installs. * Adds a PYTHONFRAMEWORKINSTALLNAMEPREFIX variable; this is used as the install name for the library. This is needed to allow for iOS frameworks to specify an @rpath-based install name. * Evaluates MACHDEP earlier in the configure process so that ac_sys_system is available. * Modifies _PYTHON_HOST_PLATFORM evaluation for cross-platform builds so that the CPU architecture is differentiated from the host identifier. This will be used to generate a _PYTHON_HOST_PLATFORM definition that includes ABI information, not just CPU architecture. * Differentiates between SOABI_PLATFORM and PLATFORM_TRIPLET. SOABI_PLATFORM is used in binary module names, and includes the ABI, but not the OS or CPU architecture (e.g., math.cpython-313-iphonesimulator.dylib). PLATFORM_TRIPLET is used as the sys._multiarch value, and on iOS will contains the ABI and architecture (e.g., iphoneos-arm64). This differentiation hasn't historically been needed because while macOS is a multiarch platform, it uses a bare darwin as PLATFORM_TRIPLE. * Removes the use of the deprecated -Wl,-single_module flag when compiling macOS frameworks. * Some whitespace normalisation where there was a mix of spaces and tabs in a single block.
1 parent 10756b1 commit 2f07786
Copy full SHA for 2f07786

File tree

Expand file treeCollapse file tree

5 files changed

+600
-432
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+600
-432
lines changed

‎Makefile.pre.in

Copy file name to clipboardExpand all lines: Makefile.pre.in
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
184184
PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
185185
PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
186186
PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
187+
PYTHONFRAMEWORKINSTALLNAMEPREFIX= @PYTHONFRAMEWORKINSTALLNAMEPREFIX@
188+
RESSRCDIR= @RESSRCDIR@
187189
# Deployment target selected during configure, to be checked
188190
# by distutils. The export statement is needed to ensure that the
189191
# deployment target is active during build.
@@ -866,7 +868,7 @@ libpython3.so: libpython$(LDVERSION).so
866868
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
867869

868870
libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
869-
$(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
871+
$(CC) -dynamiclib $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
870872

871873

872874
libpython$(VERSION).sl: $(LIBRARY_OBJS)
@@ -891,14 +893,13 @@ $(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
891893
# This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
892894
# minimal framework (not including the Lib directory and such) in the current
893895
# directory.
894-
RESSRCDIR=Mac/Resources/framework
895896
$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
896897
$(LIBRARY) \
897898
$(RESSRCDIR)/Info.plist
898899
$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
899900
$(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
900-
-all_load $(LIBRARY) -Wl,-single_module \
901-
-install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
901+
-all_load $(LIBRARY) \
902+
-install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
902903
-compatibility_version $(VERSION) \
903904
-current_version $(VERSION) \
904905
-framework CoreFoundation $(LIBS);
@@ -2000,7 +2001,7 @@ multissltest: all
20002001
# which can lead to two parallel `./python setup.py build` processes that
20012002
# step on each others toes.
20022003
.PHONY: install
2003-
install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
2004+
install: @FRAMEWORKINSTALLFIRST@ @INSTALLTARGETS@ @FRAMEWORKINSTALLLAST@
20042005
if test "x$(ENSUREPIP)" != "xno" ; then \
20052006
case $(ENSUREPIP) in \
20062007
upgrade) ensurepip="--upgrade" ;; \
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
configure and Makefile were refactored to accomodate framework builds on
2+
Apple platforms other than macOS.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.