bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)

Co-authored-by:  Lawrence D’Anna <lawrence_danna@apple.com>

* Add support for macOS 11 and Apple Silicon (aka arm64)
   
  As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy

* Support building on recent versions of macOS while deploying to older versions

  This allows building installers on macOS 11 while still supporting macOS 10.9.
This commit is contained in:
Ronald Oussoren 2020-11-08 10:05:27 +01:00 committed by GitHub
parent fd6f6fa403
commit 41761933c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 1654 additions and 412 deletions

View file

@ -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"
@ -1597,7 +1597,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)
@ -1898,6 +1898,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"
@ -1919,7 +1924,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
@ -2489,7 +2494,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
@ -2499,9 +2504,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
@ -3774,6 +3782,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for _dyld_shared_cache_contains_path)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach-o/dyld.h>]], [[void *x=_dyld_shared_cache_contains_path]])],
[AC_DEFINE(HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH, 1, Define if you have the '_dyld_shared_cache_contains_path' function.)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for memfd_create)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[