Compiling Emacs 27.1 on Fedora 32

Emacs 27.1 is out! It’s another great release and has been behaving rather well from my experience. If you’re curious about giving it a go, here’s how to install on Fedora 32, assuming you’re running Fedora Workstation and building the GTK+ frontend:

Getting the release

cd ~/Downloads # or any folder of your choice
curl -L -O https://ftpmirror.gnu.org/emacs/emacs-27.1.tar.xz
tar xf emacs-27.1.tar.xz && cd emacs-27.1

Installing deps

Emacs requires some basic libraries installed, which I’ve ironed out to these:

sudo dnf install -y \
        make \
        automake \
        gcc \
        gcc-c++ \
        kernel-devel \
        gtk3-devel \
        libjpeg-devel \
        libXpm-devel \
        giflib-devel \
        libtiff-devel \
        gnutls-devel \
        ncurses-devel

Configuration flags

--with-cairo

Emacs can use Cairo for drawing; it’s disabled by default because considered experimental but a thread from last year was already considering making it the default. I use it without problems.

--with-json

Emacs ships with much faster JSON handling, through the jansson library. It’s enabled by default (so we don’t actually need to specify it) but if you dont’ have the library installed, it will silently skip it.

sudo dnf install -y jansson-devel

--with-librsvg

In a similar fashion to JSON, Emacs enables support for SVG by default but will not install it if you’re missing the underlying library.

sudo dnf install -y librsvg2-devel

Configure & install

That’s enough for me, so we just need to go ahead and install it.

./configure --with-json --with-cairo --with-librsvg
make
sudo make install

Run emacs --version, make sure you’re on 27.1 and off you go!

If you want to check the features you’re packing, don’t forget you can use describe-variable and inspect system-configuration-features. Mine reads:

"XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB
NOTIFY INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD
JSON PDUMPER LCMS2 GMP"

Enjoy Emacs.


Afterword

To make sure I got this right without relying on my current system (which is full of bits and bobs) I built a simple Docker image from Fedora 32 (with the added Workstation group) and checked my instructions there. For reference:

FROM fedora:32

WORKDIR /tmp/emacs

RUN dnf update -y

RUN dnf group install "Fedora Workstation" --skip-broken -y

RUN dnf install -y \
        make \
        automake \
        gcc \
        gcc-c++ \
        kernel-devel \
        gtk3-devel \
        libjpeg-devel \
        libXpm-devel \
        giflib-devel \
        libtiff-devel \
        gnutls-devel \
        ncurses-devel \
        jansson-devel \
        librsvg2-devel

RUN curl -L -O https://ftpmirror.gnu.org/emacs/emacs-27.1.tar.xz && \
        tar  xf emacs-27.1.tar.xz && \
        cd emacs-27.1

WORKDIR ./emacs-27.1

RUN ./configure --with-cairo --with-json --with-librsvg

RUN make
RUN make install

CMD emacs

Revision history

[2020-08-12 Wed]

Someone on Reddit kindly suggested librsvg as well.

[2020-08-12 Wed]

Added the system-configuration-features trick.

Date: 2020-08-11 Tue 00:00

Created: 2020-08-12 Wed 16:26