-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathinstall.sh
executable file
·70 lines (62 loc) · 2.3 KB
/
install.sh
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
68
69
70
#!/bin/sh
set -e
cd $(dirname "$0")
die() {
echo "install failed"
exit 1
}
install() {
local prefix="${1}"
mkdir -p "${prefix}" || die
cp -av build/* "${prefix}" || die
install_src "${prefix}" || die
mkdir -p "${prefix}/share/emacs/site-lisp" || die
cp -v etc/gerbil-mode.el "${prefix}/share/emacs/site-lisp" || die
cp -v src/gambit/misc/gambit.el "${prefix}/share/emacs/site-lisp" || die
}
install_src() {
local prefix="${1}"
mkdir -p "${prefix}/src" || die
touch "${prefix}/src/gerbil.pkg" || die
install_src_files src/gerbil/core "${prefix}" || die
install_src_files src/gerbil/runtime "${prefix}" || die
install_src_files src/gerbil/expander "${prefix}" || die
install_src_files src/gerbil/compiler "${prefix}" || die
cp -v src/gerbil/*.ss "${prefix}/src/gerbil" || die
install_src_files src/std "${prefix}" || die
install_src_files src/tools "${prefix}" || die
install_src_files src/lang/gerbil "${prefix}" || die
install_src_files src/lang/scheme "${prefix}" || die
install_src_files src/r7rs-large/scheme "${prefix}" || die
install_src_files src/srfi "${prefix}" || die
install_src_files src/tutorial "${prefix}" || die
}
install_src_files() {
local src="${1}"
local dest="${2}"
for f in $(find "${src}" -name \*.ss -o -name \*.ssi -o -name \*.scm -o -name \*.c | egrep -v "/[.]gerbil" | grep -v build.ss); do
mkdir -p $(dirname "${dest}/${f}") || die
cp -v "${f}" "${dest}/${f}" || die
done
}
link_version() {
local base="${1}"
local version="${2}"
(cd "${base}" && rm -f current && ln -sf "${version}" current) || die
(cd "${base}" && rm -f bin && ln -sf current/bin bin) || die
(cd "${base}" && rm -f lib && ln -sf current/lib lib) || die
(cd "${base}" && rm -f include && ln -sf current/include include) || die
(cd "${base}" && rm -f src && ln -sf current/src src) || die
(cd "${base}" && rm -f share && ln -sf current/share share) || die
}
if [ -e build-env.sh ]; then
. ./build-env.sh
else
echo "build-env.sh does not exist; did you run configure?"
die
fi
install "${DESTDIR}${GERBIL_PREFIX}"
GERBIL_BASE=$(dirname "${GERBIL_PREFIX}")
if [ "${GERBIL_BASE}/${GERBIL_VERSION}" = "${GERBIL_PREFIX}" ]; then
link_version "${DESTDIR}${GERBIL_BASE}" "${GERBIL_VERSION}"
fi