0.9.12.21:
[sbcl/tcr.git] / install.sh
blob51f86348e3bb5f68c9099edee72d62a9a8b84981
1 #!/bin/sh
2 set -e
4 # Install SBCL files into the usual places.
6 ensure_dirs ()
8 for j in $*; do
9 test -d $j || mkdir -p $j
10 done;
13 INSTALL_ROOT=${INSTALL_ROOT-/usr/local}
14 MAN_DIR=${MAN_DIR-$INSTALL_ROOT/share/man}
15 INFO_DIR=${INFO_DIR-$INSTALL_ROOT/share/info}
16 DOC_DIR=${DOC_DIR-$INSTALL_ROOT/share/doc/sbcl}
18 # Does the environment look sane?
19 SBCL_SOURCE=`pwd`
20 if [ -n "$SBCL_HOME" -a "$INSTALL_ROOT/lib/sbcl" != "$SBCL_HOME" ];then
21 echo SBCL_HOME environment variable is set, and conflicts with INSTALL_ROOT.
22 echo Aborting installation. Unset one or reset the other, then try again
23 echo INSTALL_ROOT="$INSTALL_ROOT"
24 echo SBCL_HOME="$SBCL_HOME"
25 exit 1
28 # Before doing anything else, make sure we have an SBCL to install
29 if [ -f src/runtime/sbcl ]; then
30 if [ -f output/sbcl.core ]; then
31 true
32 else
33 echo "output/sbcl.core not found, aborting installation."
34 exit 1
36 else
37 echo "src/runtime/sbcl not found, aborting installation."
38 exit 1
41 SBCL_HOME=$INSTALL_ROOT/lib/sbcl
42 export SBCL_HOME INSTALL_ROOT
43 ensure_dirs $BUILD_ROOT$INSTALL_ROOT $BUILD_ROOT$INSTALL_ROOT/bin \
44 $BUILD_ROOT$INSTALL_ROOT/lib \
45 $BUILD_ROOT$MAN_DIR $BUILD_ROOT$MAN_DIR/man1 \
46 $BUILD_ROOT$INFO_DIR $BUILD_ROOT$DOC_DIR \
47 $BUILD_ROOT$DOC_DIR/html \
48 $BUILD_ROOT$SBCL_HOME \
49 $BUILD_ROOT$SBCL_HOME/site-systems
51 if [ "$OSTYPE" = "msys" ]
52 then
53 RUNTIME=sbcl.exe
54 OLD_RUNTIME=sbcl_old.exe
55 else
56 RUNTIME=sbcl
57 OLD_RUNTIME=sbcl.old
60 # move old versions out of the way. Safer than copying: don't want to
61 # break any running instances that have these files mapped
62 test -f $BUILD_ROOT$INSTALL_ROOT/bin/$RUNTIME && \
63 mv $BUILD_ROOT$INSTALL_ROOT/bin/$RUNTIME \
64 $BUILD_ROOT$INSTALL_ROOT/bin/$OLD_RUNTIME
65 test -f $BUILD_ROOT$SBCL_HOME/sbcl.core && \
66 mv $BUILD_ROOT$SBCL_HOME/sbcl.core $BUILD_ROOT$SBCL_HOME/sbcl.core.old
68 cp src/runtime/sbcl $BUILD_ROOT$INSTALL_ROOT/bin/
69 cp output/sbcl.core $BUILD_ROOT$SBCL_HOME/sbcl.core
71 # installing contrib
73 SBCL="`pwd`/src/runtime/sbcl --noinform --core `pwd`/output/sbcl.core --userinit /dev/null --sysinit /dev/null --disable-debugger"
74 SBCL_BUILDING_CONTRIB=1
75 export SBCL SBCL_BUILDING_CONTRIB
77 . ./find-gnumake.sh
78 find_gnumake
80 for i in contrib/*; do
81 test -d $i && test -f $i/test-passed || continue;
82 INSTALL_DIR=$SBCL_HOME/`basename $i `
83 export INSTALL_DIR
84 ensure_dirs $BUILD_ROOT$INSTALL_DIR && $GNUMAKE -C $i install
85 done
87 echo
88 echo "SBCL has been installed:"
89 echo " binary $BUILD_ROOT$INSTALL_ROOT/bin/sbcl"
90 echo " core and contribs in $BUILD_ROOT$INSTALL_ROOT/lib/sbcl/"
92 # Installing manual & misc bits of documentation
94 # Locations based on FHS 2.3.
95 # See: <http://www.pathname.com/fhs/pub/fhs-2.3.html>
97 # share/ architecture independent read-only things
98 # share/man/ manpages, should be the same as man/
99 # share/info/ info files
100 # share/doc/ misc documentation
102 echo
103 echo "Documentation:"
105 # man
106 cp doc/sbcl.1 $BUILD_ROOT$MAN_DIR/man1/ && echo " man $BUILD_ROOT$MAN_DIR/man1/sbcl.1"
108 # info
109 for info in doc/manual/*.info
111 cp $info $BUILD_ROOT$INFO_DIR/ \
112 && echo -n " info $BUILD_ROOT$INFO_DIR/`basename $info` $BUILD_ROOT$INFO_DIR/dir" \
113 && ( install-info $BUILD_ROOT$INFO_DIR/`basename $info` $BUILD_ROOT$INFO_DIR/dir > /dev/null 2>&1 \
114 || echo -n " (could not add to system catalog)" ) \
115 && echo
116 done
118 # pdf
119 for pdf in doc/manual/*.pdf
121 cp $pdf $BUILD_ROOT$DOC_DIR/ \
122 && echo " pdf $BUILD_ROOT$DOC_DIR/`basename $pdf`"
123 done
125 # html
126 for html in doc/manual/sbcl doc/manual/asdf
128 test -d $html && cp -R -L $html $BUILD_ROOT$DOC_DIR/html \
129 && echo " html $BUILD_ROOT$DOC_DIR/html/`basename $html`/index.html"
130 done
132 for f in BUGS SUPPORT CREDITS COPYING NEWS
134 cp $f $BUILD_ROOT$DOC_DIR/
135 done