0.8.2.7:
[sbcl.git] / install.sh
1 #!/bin/sh
2
3 # Install SBCL files into the usual places.
4
5 ensure_dirs () 
6 {
7     for j in $*; do 
8         test -d $j || mkdir $j
9     done;
10 }
11
12 INSTALL_ROOT=${INSTALL_ROOT-/usr/local}
13 SBCL_SOURCE=`pwd`
14 if [ -n "$SBCL_HOME" -a "$INSTALL_ROOT/lib/sbcl" != "$SBCL_HOME" ];then
15    echo SBCL_HOME environment variable is set, and conflicts with INSTALL_ROOT.
16    echo Aborting installation.  Unset one or reset the other, then try again
17    echo INSTALL_ROOT="$INSTALL_ROOT"
18    echo SBCL_HOME="$SBCL_HOME"
19    exit 1
20 fi
21 SBCL_HOME=$INSTALL_ROOT/lib/sbcl
22 export SBCL_HOME
23 ensure_dirs $INSTALL_ROOT $INSTALL_ROOT/bin $INSTALL_ROOT/lib \
24     $INSTALL_ROOT/man $INSTALL_ROOT/man/man1 \
25     $SBCL_HOME $SBCL_HOME/systems $SBCL_HOME/site-systems
26
27 # move old versions out of the way.  Safer than copying: don't want to
28 # break any running instances that have these files mapped
29 test -f $INSTALL_ROOT/bin/sbcl && \
30     mv $INSTALL_ROOT/bin/sbcl $INSTALL_ROOT/bin/sbcl.old
31 test -f $SBCL_HOME/sbcl.core && \
32     mv $SBCL_HOME/sbcl.core $SBCL_HOME/sbcl.core.old
33
34 cp src/runtime/sbcl $INSTALL_ROOT/bin/
35 cp output/sbcl.core $SBCL_HOME/sbcl.core
36 cp doc/sbcl.1 $INSTALL_ROOT/man/man1/
37
38 # installing contrib 
39
40 SBCL="`pwd`/src/runtime/sbcl --noinform --core `pwd`/output/sbcl.core --userinit /dev/null --sysinit /dev/null --disable-debugger"
41 SBCL_BUILDING_CONTRIB=1
42 export SBCL SBCL_BUILDING_CONTRIB
43
44 . ./find-gnumake.sh
45 find_gnumake
46
47 for i in contrib/*; do
48     test -d $i && test -f $i/test-passed || continue;
49     INSTALL_DIR=$SBCL_HOME/`basename $i `
50     export INSTALL_DIR
51     ensure_dirs $INSTALL_DIR && $GNUMAKE -C $i install
52 done