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