diff --git a/build/emacs-head.sh b/build/emacs-head.sh index 994ca7f..c6e2d8c 100644 --- a/build/emacs-head.sh +++ b/build/emacs-head.sh @@ -5,6 +5,23 @@ MACSDK=`xcrun --show-sdk-path` export LIBXML2_CFLAGS="-I${MACSDK}/usr/include/libxml2" export LIBXML2_LIBS="-lxml2" +# For Apple Silicon, Emacs version 27.2 or later supports to build. +CPUARC=`uname -m` +if [ "${CPUARC}" = "x86_64" ]; then + # Catalina or later + export MACOSX_DEPLOYMENT_TARGET=10.15 +else + # Big Sur or later + export MACOSX_DEPLOYMENT_TARGET=11.0 +fi + +# Native compilation +if [ "${CPUARC}" = "arm64" ]; then + BREW=`which brew` + BREW_LIBGCCJIT_PREFIX=`$BREW --prefix --installed libgccjit 2>/dev/null` + export CFLAGS="$CFLAGS -I${BREW_LIBGCCJIT_PREFIX}/include" +fi + export WORKING_DIR="${HOME}/Desktop" while getopts d: opt do @@ -30,7 +47,7 @@ if [ $? -ne 0 ]; then echo "FAILED"; exit 1; fi sleep 5 ./autogen.sh -./configure CC=clang --without-x --with-ns --with-modules +./configure CC=clang --without-x --with-ns --with-modules --with-native-compilation=yes CORES= #CORES=4 make bootstrap -j$CORES diff --git a/build/setup.sh b/build/setup.sh index 20c7c3d..a2994bc 100644 --- a/build/setup.sh +++ b/build/setup.sh @@ -7,6 +7,7 @@ function setup_homebrew () { function install_deps () { brew install autoconf automake pkg-config gnutls texinfo jansson + brew install gcc libgccjit } function install_tool () {