Skip to content

Instantly share code, notes, and snippets.

@gmmoreira
Created April 1, 2021 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmmoreira/921c0e811f0531937d56e65f0c0d3499 to your computer and use it in GitHub Desktop.
Save gmmoreira/921c0e811f0531937d56e65f0c0d3499 to your computer and use it in GitHub Desktop.
Emacs
#!/usr/bin/env bash
set -euox pipefail
# Build Emacs 28 with GTK and native compilation.
# The pure GTK implementation enable native support in Wayland.
# Apt dependencies are for Ubuntu 20.04.
march=${1:-native}
mtune=${1:-native}
emacs_git_dir=emacs-pgtk-nativecomp
ccache_dir=/usr/lib/ccache
echo "Compiling with march=$march and mtune=$mtune"
sudo apt install --no-install-recommends -y \
make \
autoconf \
gcc-10 \
g++-10 \
texinfo \
pkg-config \
libjansson-dev \
zlib1g-dev \
libgccjit-10-dev \
libgnutls28-dev \
libncurses5-dev \
libx11-dev \
libgtk-3-dev \
libjpeg-dev \
libgif-dev \
libtiff-dev \
libxpm-dev \
libwebkit2gtk-4.0-dev
(
export CC="gcc-10"
export CXX="gcc-10"
export CFLAGS="-O3 -march=${march} -mtune=${mtune} -pipe -fomit-frame-pointer"
export CXXFLAGS="${CFLAGS}"
if [[ -d $ccache_dir ]]; then
export PATH="$ccache_dir:$PATH"
fi
echo "CFLAGS options: $CFLAGS"
[[ -d $emacs_git_dir ]] || git clone https://github.com/flatwhatson/emacs.git $emacs_git_dir -b pgtk-nativecomp
pushd $emacs_git_dir
git fetch origin --prune
git pull
./autogen.sh
./configure --with-dbus \
--with-cairo \
--with-json \
--with-harfbuzz \
--with-xwidgets \
--with-modules \
--with-native-compilation \
--with-pgtk
make bootstrap
make -j "$(nproc)"
popd
echo "Finish installation with 'sudo make install'"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment