-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-emacs
63 lines (52 loc) · 1.72 KB
/
build-emacs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# `install-emacs'
# --------------------------------------------------------------------
# This script install Emacs 25+ on CI systems from official sources.
# See README.org in this directory.
if [ -z "${CI}" ]; then
printf "This script should not be used locally\n"
exit 1
fi
if [ -z "${EMACS_VERSION}" ]; then
printf "EMACS_VERSION not set\n"
exit 1
fi
if [ -z "${EMACS_DIR}" ]; then
printf "EMACS_DIR not set\n"
exit 1
fi
pushd . >/dev/null
if [ "${EMACS_VERSION}" == "snapshot" ]; then
# https://git.savannah.gnu.org/git/emacs.git
# https://github.com/emacs-mirror/emacs.git
rm -rf "${EMACS_DIR}"
git clone --depth=1 "${EMACS_GIT_URL:-https://git.savannah.gnu.org/git/emacs.git}" "${EMACS_DIR}"
printf "Received %s\n" "$(git rev-parse HEAD)"
else
# but make sure to abort if Emacs has already been created
if [ -e "${EMACS_DIR}/src/emacs" ]; then
printf "Emacs found at ${EMACS_DIR}/src/emacs; abort\n"
exit 0
fi
rm -rf "${EMACS_DIR}"
TAR_NAME="emacs-${EMACS_VERSION}.tar.xz"
REMOTE="https://ftp.gnu.org/gnu/emacs/${TAR_NAME}"
PARENT="${EMACS_DIR%/*}"
printf "Pulling Emacs from \"${REMOTE}\"\n"
curl -o "${HOME}/${TAR_NAME}" "${REMOTE}"
mkdir -p "${PARENT}"
cd "${PARENT}"
tar xf "${HOME}/${TAR_NAME}"
mv "emacs-${EMACS_VERSION}" "${EMACS_DIR##*/}"
fi
# provide default configuration flags
if [ -z "${EMACS_CONFIGURE_ARGS}" ]; then
EMACS_CONFIGURE_ARGS="--with-x-toolkit=no --without-x --without-all --with-xml2 --with-modules"
fi
cd "${EMACS_DIR}"
${MAKE:-make} configure
printf "Building Emacs with configuration: ${EMACS_CONFIGURE_ARGS}\n"
./configure ${EMACS_CONFIGURE_ARGS}
${MAKE:-make} -j4
popd >/dev/null
exit 0