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