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