larme revised this gist . Go to revision
1 file changed, 80 insertions
build-emacs.sh(file created)
| @@ -0,0 +1,80 @@ | |||
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | set -euo pipefail | |
| 3 | + | ||
| 4 | + | EMACS_VER="${EMACS_VER:-30.2}" | |
| 5 | + | ||
| 6 | + | TARBALL="emacs-${EMACS_VER}.tar.gz" | |
| 7 | + | URL="https://ftp.gnu.org/gnu/emacs/${TARBALL}" | |
| 8 | + | SRC_DIR="emacs-${EMACS_VER}" | |
| 9 | + | ||
| 10 | + | install_deps() { | |
| 11 | + | echo "==> Installing build dependencies (Debian/Ubuntu)" | |
| 12 | + | sudo apt update | |
| 13 | + | sudo apt install -y \ | |
| 14 | + | build-essential \ | |
| 15 | + | autoconf \ | |
| 16 | + | texinfo \ | |
| 17 | + | curl \ | |
| 18 | + | libsystemd-dev \ | |
| 19 | + | libmailutils-dev \ | |
| 20 | + | libtree-sitter-dev \ | |
| 21 | + | libxml2-dev \ | |
| 22 | + | libjansson-dev \ | |
| 23 | + | libsqlite3-dev \ | |
| 24 | + | libgnutls28-dev \ | |
| 25 | + | libncurses-dev \ | |
| 26 | + | pkg-config | |
| 27 | + | } | |
| 28 | + | ||
| 29 | + | echo "==> Building Emacs ${EMACS_VER} (nox-style) under /usr/local" | |
| 30 | + | ||
| 31 | + | install_deps | |
| 32 | + | ||
| 33 | + | if [[ -e "${SRC_DIR}" ]]; then | |
| 34 | + | echo "Error: source directory '${SRC_DIR}' already exists." | |
| 35 | + | echo "Please remove it first, or build a different version." | |
| 36 | + | exit 1 | |
| 37 | + | fi | |
| 38 | + | ||
| 39 | + | if [[ ! -f "${TARBALL}" ]]; then | |
| 40 | + | echo "==> Downloading ${URL}" | |
| 41 | + | curl -fLO "${URL}" | |
| 42 | + | else | |
| 43 | + | echo "==> Reusing existing tarball ${TARBALL}" | |
| 44 | + | fi | |
| 45 | + | ||
| 46 | + | echo "==> Extracting ${TARBALL}" | |
| 47 | + | tar xf "${TARBALL}" | |
| 48 | + | ||
| 49 | + | cd "${SRC_DIR}" | |
| 50 | + | ||
| 51 | + | echo "==> Configuring Emacs ${EMACS_VER}" | |
| 52 | + | ./configure \ | |
| 53 | + | --prefix=/usr/local \ | |
| 54 | + | --with-libsystemd \ | |
| 55 | + | --with-pop=yes \ | |
| 56 | + | --enable-locallisppath="/etc/emacs:/usr/local/share/emacs/${EMACS_VER}/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/${EMACS_VER}/site-lisp" \ | |
| 57 | + | --without-sound \ | |
| 58 | + | --without-gconf \ | |
| 59 | + | --with-mailutils \ | |
| 60 | + | --with-native-compilation=no \ | |
| 61 | + | --with-x=no \ | |
| 62 | + | --without-gsettings \ | |
| 63 | + | --with-tree-sitter \ | |
| 64 | + | --with-xml2 | |
| 65 | + | ||
| 66 | + | echo "==> Building Emacs ${EMACS_VER}" | |
| 67 | + | make -j"$(nproc)" | |
| 68 | + | ||
| 69 | + | cat <<EOF | |
| 70 | + | ||
| 71 | + | Build finished successfully. | |
| 72 | + | ||
| 73 | + | Next step: | |
| 74 | + | cd ${PWD} | |
| 75 | + | sudo make install | |
| 76 | + | ||
| 77 | + | Optional verification before install: | |
| 78 | + | ./src/emacs --version | |
| 79 | + | ||
| 80 | + | EOF | |
Newer
Older