From b75df429dee1707412ecf44b6adae07caac060b9 Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Wed, 24 Jun 2020 14:49:17 +0200 Subject: [PATCH] BPO-41090: Add support for building "Universal 2" binaries on macOS 11. --- Lib/_osx_support.py | 2 ++ Mac/README.rst | 2 ++ .../macOS/2020-06-24-14-48-30.bpo-41090.ZxTgqS.rst | 3 +++ configure | 11 ++++++++--- configure.ac | 7 ++++++- 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/macOS/2020-06-24-14-48-30.bpo-41090.ZxTgqS.rst diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py index e9efce7d7ed5bd..8ed1eeac8525da 100644 --- a/Lib/_osx_support.py +++ b/Lib/_osx_support.py @@ -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'): diff --git a/Mac/README.rst b/Mac/README.rst index ec7d873df277d7..8bc8fdec2fb367 100644 --- a/Mac/README.rst +++ b/Mac/README.rst @@ -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`` diff --git a/Misc/NEWS.d/next/macOS/2020-06-24-14-48-30.bpo-41090.ZxTgqS.rst b/Misc/NEWS.d/next/macOS/2020-06-24-14-48-30.bpo-41090.ZxTgqS.rst new file mode 100644 index 00000000000000..970533df3d90f1 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2020-06-24-14-48-30.bpo-41090.ZxTgqS.rst @@ -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. diff --git a/configure b/configure index dc590c2e98273a..fd089994dc720d 100755 --- a/configure +++ b/configure @@ -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 @@ -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="" @@ -16806,7 +16811,7 @@ do done -SRCDIRS="Parser Parser/pegen Objects Python Modules Modules/_io Programs" +SRCDIRS="Parser Objects Python Modules Modules/_io Programs" { $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 diff --git a/configure.ac b/configure.ac index 70deefb6b9aea6..065ef87b13a6b8 100644 --- a/configure.ac +++ b/configure.ac @@ -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" @@ -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=""