#!/bin/bash set -eux make="make -j$(nproc --all)" configure_flags=( --with-cairo --with-gconf --with-sqlite3 --with-xinput2 ) is-rolling-distro () { ( . /etc/os-release case "${ID}" in opensuse-tumbleweed) return 0;; esac return 1 ) } if ! is-rolling-distro then cachedir=${XDG_CACHE_HOME:-~/.cache}/emacs test -d "${cachedir}" || mkdir -p "${cachedir}" thistree=${PWD#~} cachefile=${cachedir}/config${thistree//\//,} configure_flags=(--cache-file="${cachefile}" "${configure_flags[@]}") fi if ! test -f Makefile then ${make} configure fi check-config () { if ! test -f src/config.h then return 1 fi local pattern="#define EMACS_CONFIG_OPTIONS \"${configure_flags[@]}\"" grep "${pattern}" src/config.h } if ! check-config then ./configure "${configure_flags[@]}" fi ${make} "$@"