-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_emacs_macos
executable file
·67 lines (52 loc) · 1.7 KB
/
install_emacs_macos
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
64
65
66
67
#!/bin/sh
set -e
set -u
if [ "$#" -gt 1 ]; then
printf "usage: %s [branch]\n" "$0" 1>&2
exit 1
fi
branch="${1:-master}"
rootdir="${HOME}"/opt/local/src/emacs
if [ ! -e "${rootdir}" ]; then
printf "error: %s does not exist.\n" "${rootdir}" 1>&2
exit 1
fi
packages=""
packages="${packages} librsvg"
packages="${packages} gnutls"
packages="${packages} libgccjit"
for package in ${packages} ; do
if ! (brew list --formula | grep "${package}" > /dev/null) ; then
printf "error: %s is not installed.\n" "${package}" 1>&2
exit 1
fi
done
homebrew_prefix="$(brew --prefix)"
CPPFLAGS=""
CPPFLAGS="${CPPFLAGS} -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2"
CPPFLAGS="${CPPFLAGS} -I${homebrew_prefix}/include"
CPPFLAGS="${CPPFLAGS} -I${HOME}/opt/local/include"
LDFLAGS=""
LDFLAGS="${LDFLAGS} -L${homebrew_prefix}/lib"
LDFLAGS="${LDFLAGS} -L${HOME}/opt/local/lib"
export CPPFLAGS
export LDFLAGS
git_clean_excludes=""
git_clean_excludes="${git_clean_excludes} -e GPATH"
git_clean_excludes="${git_clean_excludes} -e GRTAGS"
git_clean_excludes="${git_clean_excludes} -e GTAGS"
git -C "${rootdir}" clean -q -d -x ${git_clean_excludes} -f
git -C "${rootdir}" checkout "${branch}"
git -C "${rootdir}" clean -q -d -x ${git_clean_excludes} -f
git -C "${rootdir}" reset --hard HEAD
git -C "${rootdir}" pull --ff-only origin "${branch}"
options=""
options="${options} --with-gnutls"
options="${options} --with-xml2"
options="${options} --with-rsvg"
options="${options} --with-native-compilation"
(cd "${rootdir}" && ./autogen.sh)
(cd "${rootdir}" && ./configure ${options})
(cd "${rootdir}" && make -j 8)
(cd "${rootdir}" && make install)
# @todo install to ~/Applications