How I Compile Emacs From Source

Since I'm a Linux user, this is how I compile Emacs on Linux. First I make sure I have git installed, then I clone the repo with:

git clone https://git.savannah.gnu.org/git/emacs.git && cd emacs

I then run

./autogen.sh

to generate the configure script(s), then

./configure --with-native-compilation \
            --with-gnutls \
            --with-imagemagick \
            --with-jpeg \
            --with-png \
            --with-rsvg \
            --with-tiff \
            --with-wide-int \
            --with-xft \
            --with-xml2 \
            --with-xpm \
            --with-json \
            --with-cairo \
            --with-mailutils \
            --with-xwidgets \
            --with-dbus \
            --with-gif \
            --with-modules \
            --with-tree-sitter \
            --with-pgtk --with-selinux --with-sqlite3 --with-threads  --with-webp --with-zlib

to generate the Makefile. You'll have to install the appropriate dependencies which vary from distro to distro. The configure script should tell you what to install.

Lastly, I compile and install

make NATIVE_FULL_AOT=1 -j$(nproc) && sudo make install