112807bceb6283e07f9987d533411c19035100e3
[mes.git] / install.sh
1 #! /bin/sh
2
3 set -e
4
5 export PREFIX
6 SHELL=${SHELL-$(command -v sh)}
7 PREFIX=${PREFIX-/usr/local}
8 MES_PREFIX=${MES_PREFIX-$PREFIX/share/mes}
9 MES_SEED=${MES_SEED-../mes-seed}
10 TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
11
12 mkdir -p $PREFIX/bin
13 cp src/mes $PREFIX/bin/mes
14
15 mkdir -p $PREFIX/lib
16 mkdir -p $MES_PREFIX/lib
17 cp scripts/mescc $PREFIX/bin/mescc
18
19 mkdir -p $MES_PREFIX
20 tar -cf- doc guile include lib module scaffold | tar -xf- -C $MES_PREFIX
21
22 GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2}
23 DATADIR=${MODULEDIR-$PREFIX/share/mes}
24 DOCDIR=${MODULEDIR-$PREFIX/share/doc/mes}
25 MODULEDIR=${MODULEDIR-$DATADIR/module}
26 GUILEDIR=${MODULEDIR-$PREFIX/share/guile/site/$GUILE_EFFECTIVE_VERSION}
27 GODIR=${GODIR-$PREFIX/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}
28 DOCDIR=${MODULEDIR-$PREFIX/share/doc/mes}
29
30 chmod +w $PREFIX/bin/mescc
31 sed \
32     -e "s,^#! /bin/sh,#! $SHELL," \
33     -e "s,module/,$MODULEDIR/," \
34     -e "s,@DATADIR@,$DATADIR,g" \
35     -e "s,@DOCDIR@,$DOCDIR,g" \
36     -e "s,@GODIR@,$GODIR,g" \
37     -e "s,@GUILEDIR@,$GUILEDIR,g" \
38     -e "s,@MODULEDIR@,$MODULEDIR,g" \
39     -e "s,@PREFIX@,$PREFIX,g" \
40     -e "s,@VERSION@,$VERSION,g" \
41     scripts/mescc > $PREFIX/bin/mescc
42 chmod +w $MODULEDIR/mes/boot-0.scm
43 sed \
44     -e "s,^#! /bin/sh,#! $SHELL," \
45     -e "s,module/,$MODULEDIR/," \
46     -e "s,@DATADIR@,$DATADIR,g" \
47     -e "s,@DOCDIR@,$DOCDIR,g" \
48     -e "s,@GODIR@,$GODIR,g" \
49     -e "s,@GUILEDIR@,$GUILEDIR,g" \
50     -e "s,@MODULEDIR@,$MODULEDIR,g" \
51     -e "s,@PREFIX@,$PREFIX,g" \
52     -e "s,@VERSION@,$VERSION,g" \
53     module/mes/boot-0.scm > $MODULEDIR/mes/boot-0.scm
54
55 sed \
56     -e "s,^#! /bin/sh,#! $SHELL," \
57     scripts/diff.scm > $PREFIX/bin/diff.scm
58 chmod -w+x $PREFIX/bin/diff.scm