WORKSPACE

Build Emacs 28 on branch feature/native-comp

Add JIT support to GCC

curl https://raw.githubusercontent.com/vritser/dotfiles/master/gcc.jit.patch --output gcc.jit.patch
cd ${brew --repo}/Library/Taps/homebrew/homebrew-core
git apply /path/to/gcc.jit.patch
brew install --build-from-source gcc

Clone Emacs feature/native-comp branch

git clone -b feature/native-comp https://github.com/emacs-mirror/emacs.git --depth=1

Build

cd emacs
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:${PATH}"
export LDFLAGS="-L/usr/local/lib/gcc/your version"
git clean -fdx

./autogen.sh
CC='clang' \
  ./configure \
  --disable-silent-rules \
  --enable-locallisppath=/usr/local/share/emacs/site-lisp \
  --prefix=${HOME}/gccemacs \
  --with-nativecomp \
  --with-ns \
  --disable-ns-self-contained \
#  --with-mailutils
make -j8

make install -j8
cp -rf nextstep/Emacs.app  /Applications/Emacs.app
ln -s ${prefix}/gccemacs/share/emacs/28.0.50/lisp /Applications/Emacs.app/Contents/lisp

References