Skip to content

bpo-41090: Add support for building "Universal 2" binaries on macOS 11. #21115

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/_osx_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ def get_platform_osx(_config_vars, osname, release, machine):

if len(archs) == 1:
machine = archs[0]
elif archs == ('arm64', 'x86_64'):
machine = 'universal2'
elif archs == ('i386', 'ppc'):
machine = 'fat'
elif archs == ('i386', 'x86_64'):
Expand Down
2 changes: 2 additions & 0 deletions Mac/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ support ppc (Xcode 4 on 10.6 and later systems). The flavor can be specified
using the configure option ``--with-universal-archs=VALUE``. The following
values are available:

* ``universal2``: ``arm64``, ``x86_64``

* ``intel``: ``i386``, ``x86_64``

* ``intel-32``: ``i386``
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Support building "Universal 2" binaries on macOS 11 using
"--with-universal-archs=universal2". This results in binaries that contain
both x86_64 and arm64 code.
11 changes: 8 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1509,8 +1509,8 @@ Optional Packages:
specify the kind of universal binary that should be
created. this option is only valid when
--enable-universalsdk is set; options are:
("32-bit", "64-bit", "3-way", "intel", "intel-32",
"intel-64", or "all") see Mac/README.rst
("universal2", "32-bit", "64-bit", "3-way", "intel",
"intel-32", "intel-64", or "all") see Mac/README.rst
--with-framework-name=FRAMEWORK
specify the name for the python framework on macOS
only valid when --enable-framework is set. see
Expand Down Expand Up @@ -7457,6 +7457,11 @@ $as_echo "$CC" >&6; }
if test "${enable_universalsdk}"
then
case "$UNIVERSAL_ARCHS" in
universal2)
UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT="true"
;;
32-bit)
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
LIPO_32BIT_FLAGS=""
Expand Down Expand Up @@ -16806,7 +16811,7 @@ do
done


SRCDIRS="Parser Parser/pegen Objects Python Modules Modules/_io Programs"
SRCDIRS="Parser Objects Python Modules Modules/_io Programs"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change on purpose or bad merge?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A previous commit from another project left configure out of sync with configure.ac. While this corrects that, I'm pushing a separate PR (#21152 ) to fix it right away.

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build directories" >&5
$as_echo_n "checking for build directories... " >&6; }
for dir in $SRCDIRS; do
Expand Down
7 changes: 6 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ AC_ARG_WITH(universal-archs,
AS_HELP_STRING([--with-universal-archs=ARCH],
[specify the kind of universal binary that should be created. this option is
only valid when --enable-universalsdk is set; options are:
("32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")
("universal2", "32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")
see Mac/README.rst]),
[
UNIVERSAL_ARCHS="$withval"
Expand Down Expand Up @@ -1864,6 +1864,11 @@ yes)
if test "${enable_universalsdk}"
then
case "$UNIVERSAL_ARCHS" in
universal2)
UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT="true"
;;
32-bit)
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
LIPO_32BIT_FLAGS=""
Expand Down