0.8.13.75: MORE MANUALS
[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 for info in doc/manual/*.info
83 do
84   cp $info $BUILD_ROOT$INFO_DIR/ \
85       && echo -n " info $BUILD_ROOT$INFO_DIR/`basename $info`" \
86       && ( install-info $BUILD_ROOT$INFO_DIR/`basename $info` > /dev/null 2>&1 \
87            || echo -n " (could not add to system catalog)" ) \
88       && echo
89 done
90
91 # pdf
92 for pdf in doc/manual/*.pdf
93 do
94   cp $pdf $BUILD_ROOT$DOC_DIR/ \
95       && echo " pdf $BUILD_ROOT$DOC_DIR/`basename $pdf`"
96 done
97
98 # html
99 for html in doc/manual/sbcl doc/manual/asdf
100 do
101   test -d $html && cp -r $html $BUILD_ROOT$DOC_DIR/`basename $html` \
102       && echo " html $BUILD_ROOT$DOC_DIR/`basename $html`/index.html"
103 done
104
105 for f in BUGS SUPPORT CREDITS COPYING NEWS
106 do
107   cp $f $BUILD_ROOT$DOC_DIR/
108 done