Skip to content

Instantly share code, notes, and snippets.

@pivaldi
Created November 22, 2024 15:28
Show Gist options
  • Save pivaldi/116c22742040834316c90e938411c082 to your computer and use it in GitHub Desktop.
Save pivaldi/116c22742040834316c90e938411c082 to your computer and use it in GitHub Desktop.
Optimized Emacs Compilation With Tree-sitter Support
#!/bin/bash
# See
# - https://www.emacswiki.org/emacs/GccEmacs
# - https://www.masteringemacs.org/article/speed-up-emacs-libjansson-native-elisp-compilation
# - https://www.masteringemacs.org/article/how-to-get-started-tree-sitter
SOURCE_DIR="$HOME/code/emacs_hd/"
INSTALL_DIR="/opt/emacs"
cd "$SOURCE_DIR" || exit 1
locate libtree-sitter.so > /dev/null || {
echo "You must install the libtree-sitter.so :
git clone [email protected]:tree-sitter/tree-sitter.git
cd tree-sitter && make && make install"
exit 1
}
sudo apt-get install libjansson4 libjansson-dev || exit 1
sudo apt-get build-dep emacs || exit 1
./autogen.sh && \
./configure --prefix="$INSTALL_DIR" --with-native-compilation --with-tree-sitter --with-json --with-mailutils && \
make -j"$(nproc)" && \
sudo make install
@pivaldi
Copy link
Author

pivaldi commented Jan 4, 2025

See also this more complete Gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment