0.8.15.20: Fix HTML installation
[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$DOC_DIR/html \
32     $BUILD_ROOT$SBCL_HOME $BUILD_ROOT$SBCL_HOME/systems \
33     $BUILD_ROOT$SBCL_HOME/site-systems
34
35 # move old versions out of the way.  Safer than copying: don't want to
36 # break any running instances that have these files mapped
37 test -f $BUILD_ROOT$INSTALL_ROOT/bin/sbcl && \
38     mv $BUILD_ROOT$INSTALL_ROOT/bin/sbcl $BUILD_ROOT$INSTALL_ROOT/bin/sbcl.old
39 test -f $BUILD_ROOT$SBCL_HOME/sbcl.core && \
40     mv $BUILD_ROOT$SBCL_HOME/sbcl.core $BUILD_ROOT$SBCL_HOME/sbcl.core.old
41
42 cp src/runtime/sbcl $BUILD_ROOT$INSTALL_ROOT/bin/
43 cp output/sbcl.core $BUILD_ROOT$SBCL_HOME/sbcl.core
44
45 # installing contrib 
46
47 SBCL="`pwd`/src/runtime/sbcl --noinform --core `pwd`/output/sbcl.core --userinit /dev/null --sysinit /dev/null --disable-debugger"
48 SBCL_BUILDING_CONTRIB=1
49 export SBCL SBCL_BUILDING_CONTRIB
50
51 . ./find-gnumake.sh
52 find_gnumake
53
54 for i in contrib/*; do
55     test -d $i && test -f $i/test-passed || continue;
56     INSTALL_DIR=$SBCL_HOME/`basename $i `
57     export INSTALL_DIR
58     ensure_dirs $BUILD_ROOT$INSTALL_DIR && $GNUMAKE -C $i install
59 done
60
61 echo
62 echo "SBCL has been installed:"
63 echo " binary $BUILD_ROOT$INSTALL_ROOT/bin/sbcl"
64 echo " core and contribs in $BUILD_ROOT$INSTALL_ROOT/lib/sbcl/"
65
66 # Installing manual & misc bits of documentation
67 #
68 # Locations based on FHS 2.3.
69 # See: <http://www.pathname.com/fhs/pub/fhs-2.3.html>
70 #
71 # share/       architecture independent read-only things
72 # share/man/   manpages, should be the same as man/
73 # share/info/  info files
74 # share/doc/   misc documentation
75
76 echo
77 echo "Documentation:"
78
79 # man
80 cp doc/sbcl.1 $BUILD_ROOT$MAN_DIR/man1/ && echo " man $BUILD_ROOT$MAN_DIR/man1/sbcl.1"
81
82 # info
83 for info in doc/manual/*.info
84 do
85   cp $info $BUILD_ROOT$INFO_DIR/ \
86       && echo -n " info $BUILD_ROOT$INFO_DIR/`basename $info`" \
87       && ( install-info $BUILD_ROOT$INFO_DIR/`basename $info` > /dev/null 2>&1 \
88            || echo -n " (could not add to system catalog)" ) \
89       && echo
90 done
91
92 # pdf
93 for pdf in doc/manual/*.pdf
94 do
95   cp $pdf $BUILD_ROOT$DOC_DIR/ \
96       && echo " pdf $BUILD_ROOT$DOC_DIR/`basename $pdf`"
97 done
98
99 # html
100 for html in doc/manual/sbcl doc/manual/asdf
101 do
102   test -d $html && cp -R -L $html $BUILD_ROOT$DOC_DIR/html \
103       && echo " html $BUILD_ROOT$DOC_DIR/html/`basename $html`/index.html"
104 done
105
106 for f in BUGS SUPPORT CREDITS COPYING NEWS
107 do
108   cp $f $BUILD_ROOT$DOC_DIR/
109 done