#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/install-emacs emacs_src=https://git.savannah.gnu.org/git/emacs.git src_dir=~/src emacs_dir=${src_dir}/emacs emacs-version () { emacs --version | head -n 1 } emacs-install-prepare () { sudo apt-get -qq update sudo apt-get install build-essential debian-goodies libgccjit-12-dev sudo apt-get build-dep emacs mkdir -p $emacs_dir } emacs-src-get () { emacs-install-prepare cd $src_dir git clone $emacs_src } emacs-src-reset () { emacs-install-prepare cd $emacs_dir git reset --hard git clean -d -f -x git config pull.rebase false git pull $emacs_src } emacs-src-update () { cd $emacs_dir git pull } emacs-install () { local reset=$1 (( ${+reset} )) && emacs-src-reset || emacs-src-update local old=$(emacs-version) cd $emacs_dir autogen.sh configure \ --enable-link-time-optimization \ --with-native-compilation=aot \ --without-compress-install local cpus=0-1 taskset -c $cpus make sudo taskset -c $cpus make install local new=$(emacs-version) echo "version: $old -> $new" } alias emacs-upgrade=emacs-install alias upgrade-emacs=emacs-install