0.8.10.61:
[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 -p $j
9     done;
10 }
11
12 INSTALL_ROOT=${INSTALL_ROOT-/usr/local}
13 MAN_DIR=${MAN_DIR-$INSTALL_ROOT/share/man}
14 INFO_DIR=${INFO_DIR-$INSTALL_ROOT/share/info}
15 DOC_DIR=${DOC_DIR-$INSTALL_ROOT/share/doc/sbcl}
16
17 SBCL_SOURCE=`pwd`
18 if [ -n "$SBCL_HOME" -a "$INSTALL_ROOT/lib/sbcl" != "$SBCL_HOME" ];then
19    echo SBCL_HOME environment variable is set, and conflicts with INSTALL_ROOT.
20    echo Aborting installation.  Unset one or reset the other, then try again
21    echo INSTALL_ROOT="$INSTALL_ROOT"
22    echo SBCL_HOME="$SBCL_HOME"
23    exit 1
24 fi
25 SBCL_HOME=$INSTALL_ROOT/lib/sbcl
26 export SBCL_HOME INSTALL_ROOT
27 ensure_dirs $BUILD_ROOT$INSTALL_ROOT $BUILD_ROOT$INSTALL_ROOT/bin \
28     $BUILD_ROOT$INSTALL_ROOT/lib  \
29     $BUILD_ROOT$MAN_DIR $BUILD_ROOT$MAN_DIR/man1 \
30     $BUILD_ROOT$INFO_DIR $BUILD_ROOT$DOC_DIR \
31     $BUILD_ROOT$SBCL_HOME $BUILD_ROOT$SBCL_HOME/systems \
32     $BUILD_ROOT$SBCL_HOME/site-systems
33
34 # move old versions out of the way.  Safer than copying: don't want to
35 # break any running instances that have these files mapped
36 test -f $BUILD_ROOT$INSTALL_ROOT/bin/sbcl && \
37     mv $BUILD_ROOT$INSTALL_ROOT/bin/sbcl $BUILD_ROOT$INSTALL_ROOT/bin/sbcl.old
38 test -f $BUILD_ROOT$SBCL_HOME/sbcl.core && \
39     mv $BUILD_ROOT$SBCL_HOME/sbcl.core $BUILD_ROOT$SBCL_HOME/sbcl.core.old
40
41 cp src/runtime/sbcl $BUILD_ROOT$INSTALL_ROOT/bin/
42 cp output/sbcl.core $BUILD_ROOT$SBCL_HOME/sbcl.core
43
44 # installing contrib 
45
46 SBCL="`pwd`/src/runtime/sbcl --noinform --core `pwd`/output/sbcl.core --userinit /dev/null --sysinit /dev/null --disable-debugger"
47 SBCL_BUILDING_CONTRIB=1
48 export SBCL SBCL_BUILDING_CONTRIB
49
50 . ./find-gnumake.sh
51 find_gnumake
52
53 for i in contrib/*; do
54     test -d $i && test -f $i/test-passed || continue;
55     INSTALL_DIR=$SBCL_HOME/`basename $i `
56     export INSTALL_DIR
57     ensure_dirs $BUILD_ROOT$INSTALL_DIR && $GNUMAKE -C $i install
58 done
59
60 echo
61 echo "SBCL has been installed:"
62 echo " binary $BUILD_ROOT$INSTALL_ROOT/bin/sbcl"
63 echo " core and contribs in $BUILD_ROOT$INSTALL_ROOT/lib/sbcl/"
64
65 # Installing manual & misc bits of documentation
66 #
67 # Locations based on FHS 2.3.
68 # See: <http://www.pathname.com/fhs/pub/fhs-2.3.html>
69 #
70 # share/       architecture independent read-only things
71 # share/man/   manpages, should be the same as man/
72 # share/info/  info files
73 # share/doc/   misc documentation
74
75 echo
76 echo "Documentation:"
77
78 # man
79 cp doc/sbcl.1 $BUILD_ROOT$MAN_DIR/man1/ && echo " man $BUILD_ROOT$MAN_DIR/man1/sbcl.1"
80
81 # info
82 INFO_FILE=doc/manual/sbcl.info
83 test -f $INFO_FILE && cp $INFO_FILE $BUILD_ROOT$INFO_DIR/ \
84     && echo -n " info $BUILD_ROOT$INFO_DIR/sbcl.info" \
85     && ( install-info $BUILD_ROOT$INFO_DIR/sbcl.info > /dev/null 2>&1 \
86          || echo -n " (could not add to system catalog)" ) \
87     && echo
88
89 # pdf
90 PDF_FILE=doc/manual/sbcl.pdf
91 test -f $PDF_FILE && cp $PDF_FILE $BUILD_ROOT$DOC_DIR/ \
92     && echo " pdf $BUILD_ROOT$DOC_DIR/sbcl.pdf"
93
94 # html
95 HTMLS=doc/manual/sbcl
96 test -d $HTMLS && cp -r $HTMLS $BUILD_ROOT$DOC_DIR/html \
97     && echo " html $BUILD_ROOT$DOC_DIR/html/index.html"
98
99 for f in BUGS SUPPORT CREDITS COPYING NEWS
100 do
101   cp $f $BUILD_ROOT$DOC_DIR/
102 done