Install dependencies
First of all, make sure to enable deb-src in /etc/apt/sources.list.d/ubuntu.sources (Types: deb deb-src), then run apt update.
Install build dependencies:
sudo apt build-dep -y emacs
sudo apt install libtree-sitter-devClone the source repo
If you only want version 30:
git clone --depth 1 --branch emacs-30 git://git.savannah.gnu.org/emacs.git
cd ./emacsIf you want the entire emacs repo (beware, it's fairly large!):
git clone git://git.savannah.gnu.org/emacs.git
cd ./emacs
git worktree add ../emacs-30 origin/emacs-30Configure
Run autogen:
./autogen.shRun ./configure:
CFLAGS="-march=native -pipe" \
./configure \
--prefix=/opt/emacs30 \
--with-cairo --with-libsystemd --with-modules \
--with-tree-sitter \
--with-x-toolkit=gtk3- Set
--prefixto the desired install location - If you don't want X support, remove the
--with-x-toolkitoption, add--without-x --without-sound - See
./configure --helpfor other options
<!> Warning
The -march=native flag will tell gcc to make the resulting executable compatible only with the architecture of the current CPU. Remove (or modify) it if you need to redistribute the executable.
See also -march on the Gentoo wiki.
Build
make -j24- Adjust the
-joption based on the number of cores on your machine
Install
make installRun
/opt/emacs30/bin/emacs
/opt/emacs30/bin/emacsclientAdd to path:
PATH="/opt/emacs30/bin:${PATH}"