Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add support for "universal2" as a fat binary target on macOS
  • Loading branch information
ronaldoussoren committed Jul 20, 2020
commit 69c39f36f6efe9b13b2dc06892133ac31e6ca7bc
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
20 changes: 14 additions & 6 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 @@ -6945,7 +6945,7 @@ fi



# The -arch flags for universal builds on OSX
# The -arch flags for universal builds on macOS
UNIVERSAL_ARCH_FLAGS=


Expand Down Expand Up @@ -7472,6 +7472,11 @@ $as_echo "$CC" >&6; }
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
universal2)
UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT="true"
;;
intel)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
Expand All @@ -7493,7 +7498,7 @@ $as_echo "$CC" >&6; }
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
*)
as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
as_fn_error $? "proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way" "$LINENO" 5
;;
esac

Expand Down Expand Up @@ -9322,7 +9327,7 @@ fi
MACOSX_DEFAULT_ARCH="ppc"
;;
*)
as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
as_fn_error $? "Unexpected output of 'arch' on macOS" "$LINENO" 5
;;
esac
else
Expand All @@ -9332,9 +9337,12 @@ fi
;;
ppc)
MACOSX_DEFAULT_ARCH="ppc64"
;;
arm64)
MACOSX_DEFAULT_ARCH="arm64"
;;
*)
as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
as_fn_error $? "Unexpected output of 'arch' on macOS" "$LINENO" 5
;;
esac

Expand Down
18 changes: 13 additions & 5 deletions 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 @@ -1578,7 +1578,7 @@ AC_SUBST(BASECFLAGS)
AC_SUBST(CFLAGS_NODIST)
AC_SUBST(LDFLAGS_NODIST)

# The -arch flags for universal builds on OSX
# The -arch flags for universal builds on macOS
UNIVERSAL_ARCH_FLAGS=
AC_SUBST(UNIVERSAL_ARCH_FLAGS)

Expand Down Expand Up @@ -1879,6 +1879,11 @@ yes)
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
universal2)
UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
LIPO_32BIT_FLAGS=""
ARCH_RUN_32BIT="true"
;;
intel)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
Expand All @@ -1900,7 +1905,7 @@ yes)
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
*)
AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
AC_MSG_ERROR([proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way])
;;
esac

Expand Down Expand Up @@ -2467,7 +2472,7 @@ case $ac_sys_system/$ac_sys_release in
MACOSX_DEFAULT_ARCH="ppc"
;;
*)
AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
AC_MSG_ERROR([Unexpected output of 'arch' on macOS])
;;
esac
else
Expand All @@ -2477,9 +2482,12 @@ case $ac_sys_system/$ac_sys_release in
;;
ppc)
MACOSX_DEFAULT_ARCH="ppc64"
;;
arm64)
MACOSX_DEFAULT_ARCH="arm64"
;;
*)
AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
AC_MSG_ERROR([Unexpected output of 'arch' on macOS])
;;
esac

Expand Down