# Compiling This script seems to handle most cases I care about: - a freshly cloned copy of the repository, - a repository where compilation has already happened, - a repository where I want to change the `configure` flags… ``` bash #!/bin/bash set -eux MAKE="make -j$(nproc --all)" CONFIGURE_FLAGS="--with-xwidgets --with-cairo" check-config () { local define=$(grep EMACS_CONFIG_OPTIONS src/config.h) local pattern='^#define EMACS_CONFIG_OPTIONS "(.+)"$' [[ ${define} =~ ${pattern} ]] test "${BASH_REMATCH[1]}" = "${CONFIGURE_FLAGS}" } if ! test -f src/config.h || ! check-config then ./configure ${CONFIGURE_FLAGS} fi if ! ${MAKE} then ${MAKE} bootstrap fi ```