Last active
May 31, 2022 10:41
-
-
Save briang/6ee9463305bb87be365a1661c87bee55 to your computer and use it in GitHub Desktop.
Emacs 28 compilation script for debian 11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit # exit on error | |
set -o pipefail # trap pipe fails | |
set -o nounset # trap unset vars | |
DEST="/usr/local" | |
SOURCE="$HOME/emacs-28.1" | |
NATIVE_FULL_AOT='' # 'NATIVE_FULL_AOT=1' # removed in emacs 28.1 | |
JOBS='-j 3' | |
function prereqs { | |
cd $HOME | |
sudo apt install \ | |
autoconf build-essential checkinstall git libgccjit-11-dev libgif-dev \ | |
libgnutls28-dev libgtk-3-dev libjansson-dev libjpeg-dev \ | |
libncurses5-dev libtiff-dev libxpm-dev texinfo | |
export PKG_CONFIG_PATH=$(find /usr /lib -name pkgconfig | paste -s -d':') | |
# [[ ! -e ~/emacs.git ]] && \ | |
# git clone --depth=1 https://github.com/emacs-mirror/emacs ~/emacs.git -b emacs-28 | |
# cd ~/emacs.git | |
# git clean -dxf | |
if [[ ! -e $SOURCE ]] ; then | |
for f in emacs-28.1.tar.gz ; do | |
[[ ! -e $f ]] && wget https://ftp.gnu.org/gnu/emacs/$f | |
tar xf $f | |
done | |
fi | |
} | |
function build { | |
cd $SOURCE | |
unset confopts | |
confopts+="--prefix $DEST " | |
confopts+="--with-cairo " | |
confopts+="--with-gnutls " | |
confopts+="--with-json " | |
confopts+="--with-mailutils " | |
confopts+="--with-native-compilation " | |
confopts+="--with-rsvg " | |
confopts+="--with-x-toolkit=gtk " | |
confopts+="--without-toolkit-scroll-bars " | |
confopts+="--without-xaw3d " | |
confopts+="--without-xwidgets " | |
# --with-pgtk --with-sqlite3 # cut from emacs-28.1 | |
./autogen.sh | |
./configure $confopts CFLAGS="-O2 -pipe" | |
make html | |
# AOT = Ahead Of Time aka native compile everything in advance | |
make $JOBS $NATIVE_FULL_AOT | |
} | |
function package { | |
cd $SOURCE | |
cat <<"EOD" > description-pak | |
GNU Emacs editor | |
GNU Emacs is the extensible self-documenting text editor. This package is | |
compiled with GTK+ GUI support and native-compilation of Elisp files. | |
EOD | |
sudo checkinstall \ | |
--backup=no \ | |
--pkgname=emacs28 \ | |
--maintainer='"Brian Greenfield <[email protected]>"' \ | |
sudo make $JOBS install install-html | |
echo "" | |
echo "install: dpkg -i *.deb" | |
echo "uninstall: dpkg -r emacs28" | |
} | |
function doit { | |
prereqs | |
build | |
package | |
} | |
time doit | |
echo "" | |
cd $SOURCE | |
for t in elc eln ; do | |
echo "$t: $(find . -name \*.$t | wc -l)" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, sorry. This is an old script. I have a newer script that I've uploaded. This one creates a .deb in the root of the emacs28 source directory. You have to press Enter a couple of times towards the end of the build.
I'm not using this script any more. Now I build emacs.deb packages using https://github.com/kelleyk/ppa-emacs. This works for both Debian and Ubuntu.