For many reasons one may prefer to build emacs from source. It might
be that the most recent version is not available on your distro or
you may want to compile emacs with support for specific
libraries. For example lsp-mode
users would like to have support for
the libjansson
library. In such case you can clone the emacs repo
and then build it with support for the desired libraries. This script
can be used for
out of the box and can be used for other distros by using the equivalent package names. Get the shell script here.
Read emacs.org for configuration using available packages.