|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Build this package with Emacs 27.2 from nix-emacs-ci. |
| 3 | +# |
| 4 | +# CI does not cover Emacs 27 (see .github/workflows/test.yml), so this is the |
| 5 | +# way to check the floor declared in Package-Requires by hand. |
| 6 | +# |
| 7 | +# nix-emacs-ci does not expose Emacs 27 on aarch64-darwin, only on |
| 8 | +# x86_64-darwin, so on Apple Silicon this runs through Rosetta. That needs |
| 9 | +# `extra-platforms = x86_64-darwin` in /etc/nix/nix.conf. Reaching the |
| 10 | +# prebuilt binaries also needs your user in `trusted-users` there, otherwise |
| 11 | +# the daemon silently ignores the substituter below and builds from source. |
| 12 | +set -euo pipefail |
| 13 | + |
| 14 | +# Pinned rather than master, so that the Emacs you get today is the Emacs you |
| 15 | +# got last time. nix-emacs-ci pins nixpkgs in its own flake.lock, so following |
| 16 | +# master would change the derivation -- and on a platform without prebuilt |
| 17 | +# binaries (see below) that means rebuilding Emacs from source. |
| 18 | +NIX_EMACS_CI_REV=${NIX_EMACS_CI_REV:-ca88f42462347e8e17859645aa59b156617e98fb} |
| 19 | +NIX_EMACS_CI=${NIX_EMACS_CI:-https://github.com/purcell/nix-emacs-ci/archive/${NIX_EMACS_CI_REV}.tar.gz} |
| 20 | +EMACS_ATTR=${EMACS_ATTR:-emacs-27-2} |
| 21 | + |
| 22 | +case "$(uname -s)/$(uname -m)" in |
| 23 | + Darwin/arm64) SYSTEM=x86_64-darwin ;; |
| 24 | + Darwin/*) SYSTEM=x86_64-darwin ;; |
| 25 | + Linux/x86_64) SYSTEM=x86_64-linux ;; |
| 26 | + Linux/aarch64) SYSTEM=aarch64-linux ;; |
| 27 | + *) echo "unsupported host: $(uname -s)/$(uname -m)" >&2; exit 1 ;; |
| 28 | +esac |
| 29 | + |
| 30 | +cd "$(dirname "$0")/.." |
| 31 | + |
| 32 | +echo "==> Fetching ${EMACS_ATTR} for ${SYSTEM}" |
| 33 | +emacs_path=$(nix-build --no-out-link \ |
| 34 | + --option system "${SYSTEM}" \ |
| 35 | + --option extra-substituters https://emacs-ci.cachix.org \ |
| 36 | + --option extra-trusted-public-keys emacs-ci.cachix.org-1:B5FVOrxhXXrOL0S+tQ7USrhjMT5iOPH+QN9q0NItom4= \ |
| 37 | + -A "${EMACS_ATTR}" \ |
| 38 | + -E "import (fetchTarball \"${NIX_EMACS_CI}\")") |
| 39 | + |
| 40 | +export PATH="${emacs_path}/bin:${PATH}" |
| 41 | +export EMACS="${emacs_path}/bin/emacs" |
| 42 | + |
| 43 | +echo "==> $("${EMACS}" --version | head -1)" |
| 44 | + |
| 45 | +# Stale .elc files silently win over newer .el, which would hide a failure. |
| 46 | +find . -maxdepth 1 -name '*.elc' -delete |
| 47 | +rm -rf .eask |
| 48 | + |
| 49 | +echo "==> eask install-deps" |
| 50 | +eask install-deps |
| 51 | + |
| 52 | +echo "==> eask compile" |
| 53 | +eask compile |
| 54 | + |
| 55 | +echo "==> OK" |
0 commit comments