Skip to content

Instantly share code, notes, and snippets.

@briang
Last active October 25, 2021 13:29
Show Gist options
  • Save briang/6d89bd0679833ab95cbb7f758e35d08f to your computer and use it in GitHub Desktop.
Save briang/6d89bd0679833ab95cbb7f758e35d08f to your computer and use it in GitHub Desktop.
semi-automated emacs native-comp compiler & installer
#!/bin/bash
set -e # exit on error
GCC_VER=$(gcc -dumpversion)
sudo apt install \
autoconf \
automake \
build-essential \
git \
# checkinstall \
###
sudo apt satisfy libmagickwand-dev
sudo apt install \
libgccjit-$GCC_VER-dev \
libgccjit0 \
libgif-dev \
libgnutls28-dev \
libgtk2.0-dev \
libjansson-dev \
libjansson4 \
libjpeg-dev \
libncurses5-dev \
libpng-dev \
libtiff-dev \
libx11-dev \
libxpm-dev \
texinfo \
###
cd ~/git/emacs
git clean -dfx
git pull
git pull
# export CC=/usr/bin/gcc CXX=/usr/bin/gcc
./autogen.sh
./configure \
--with-cairo \
--with-gnutls \
--with-harfbuzz \
--with-imagemagick \
--with-jpeg \
--with-json \
--with-mailutils \
--with-modules \
--with-native-compilation \
--with-png \
--with-rsvg \
--with-tiff \
--with-wide-int \
--with-x-toolkit=no \
--with-xft \
--with-xml2 \
--with-xpm \
--without-compress-install \
--without-gconf \
--without-gsettings \
--without-makeinfo \
--without-toolkit-scroll-bars \
--without-xaw3d \
--without-xwidgets \
CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer" \
prefix=/usr/local
make -j5
# sudo checkinstall -D sudo make install
@briang
Copy link
Author

briang commented Oct 25, 2021

Requires an emacs clone in ~/git/emacs/, but will update automatically. Installs to /usr/local/. Based on an r/emacs post.

Tested on Debian 11 (Bullseye) & Ubuntu 2110 (Impish).

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