Skip to content

Instantly share code, notes, and snippets.

@BuddhiLW
Created July 16, 2024 18:11
Show Gist options
  • Save BuddhiLW/560bb8ba87acb88cba09464ba62f7db5 to your computer and use it in GitHub Desktop.
Save BuddhiLW/560bb8ba87acb88cba09464ba62f7db5 to your computer and use it in GitHub Desktop.
Emacs source install with native compilation (up to 10x speedup)
#!/usr/bin/bash
## Change this to where you want to build fetch and build emacs at.
cd $DOTFILES/gitthings/
git clone https://github.com/emacs-mirror/emacs.git
sudo apt-get update
# add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
sudo apt-get install gcc-13 libgccjit0 libgccjit-13-dev
sudo apt-get install libjansson4 libjansson-dev
sudo apt-get install libcairo2-dev libharfbuzz-dev
sudo apt-get build-dep emacs
export CC="gcc-13"
cd emacs
./autogen.sh
./configure --without-compress-install --with-native-compilation --with-mailutils --with-gnutls=ifavailable --with-cairo --with-harfbuzz --enable-checking=yes,glyphs --enable-check-lisp-object-type --with-wide-int
## Use all your CPU cores to build
make -j $(nproc)
# Error avoidance and debugging
make clean
make distclean
export CFLAGS="-fsanitize=address -g"
export LDFLAGS="-fsanitize=address"
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment