Skip to content

Instantly share code, notes, and snippets.

@kaz-yos
Created November 29, 2020 00:58
Show Gist options
  • Save kaz-yos/72f004ccfc7569e20e245f2f44afde12 to your computer and use it in GitHub Desktop.
Save kaz-yos/72f004ccfc7569e20e245f2f44afde12 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Original from http://xenodium.com/trying-out-gccemacs-on-macos/index.html
set -o nounset
set -o errexit
# Configures Emacs for building native comp support
# http://akrl.sdf.org/gccemacs.html
# Installing under homebrew's opt, but could be anywhere.
readonly GCCEMACS_PREFIX="$(realpath $(brew --prefix)/opt/gccemacs)"
# Changed from
# readonly GCC_DIR="$(realpath $(brew --prefix)/opt/gcc)"
readonly GCC_DIR="$(realpath $(brew --prefix)/opt/libgccjit)"
[[ -d $GCC_DIR ]] || { echo "${GCC_DIR} not found"; exit 1; }
readonly SED_DIR="$(realpath $(brew --prefix)/opt/gnu-sed)"
[[ -d $SED_DIR ]] || { echo "${SED_DIR} not found"; exit 1; }
readonly GCC_INCLUDE_DIR=${GCC_DIR}/include
[[ -d $GCC_INCLUDE_DIR ]] || { echo "${GCC_INCLUDE_DIR} not found"; exit 1; }
readonly GCC_LIB_DIR=${GCC_DIR}/lib/gcc/10
[[ -d $GCC_LIB_DIR ]] || { echo "${GCC_LIB_DIR} not found"; exit 1; }
# Added, following @mnewt
# https://github.com/Homebrew/homebrew-core/pull/60338#issuecomment-735275157
readonly GCC_LIBRARY_PATH="$(brew --prefix libgccjit)/lib/gcc/10"
[[ -d $GCC_LIBRARY_PATH ]] || { echo "${GCC_LIBRARY_PATH} not found"; exit 1; }
export PATH="${SED_DIR}/libexec/gnubin:${PATH}"
export CFLAGS="-I${GCC_INCLUDE_DIR}"
export LDFLAGS="-L${GCC_LIB_DIR} -I${GCC_INCLUDE_DIR}"
export DYLD_FALLBACK_LIBRARY_PATH="${GCC_LIB_DIR}"
# Added, following @mnewt
# https://github.com/Homebrew/homebrew-core/pull/60338#issuecomment-735275157
export LIBRARY_PATH="${GCC_LIBRARY_PATH}"
echo "Environment"
echo "-----------"
echo PATH: $PATH
echo CFLAGS: $CFLAGS
echo LDFLAGS: $LDFLAGS
echo DYLD_FALLBACK_LIBRARY_PATH: $DYLD_FALLBACK_LIBRARY_PATH
# Added, following @mnewt
# https://github.com/Homebrew/homebrew-core/pull/60338#issuecomment-735275157
echo LIBRARY_PATH: $LIBRARY_PATH
echo "-----------"
./autogen.sh
./configure \
--prefix="${GCCEMACS_PREFIX}" \
--enable-locallisppath="${GCCEMACS_PREFIX}/opt/gccemacs/site-lisp" \
--with-mailutils \
--with-ns \
--with-imagemagick \
--with-cairo \
--with-modules \
--with-xml2 \
--with-gnutls \
--with-json \
--with-rsvg \
--with-nativecomp \
--disable-silent-rules \
--disable-ns-self-contained \
--without-dbus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment