Move STRING-DISPATCH definition next to its cousin ETYPECASE.
[sbcl.git] / install.sh
blobd135fa0d044e82563b460b9bc89fe8dce9dfdd6b
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 . output/prefix.def
14 DEFAULT_INSTALL_ROOT=$SBCL_PREFIX
16 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
17 RUNTIME=sbcl.exe
18 OLD_RUNTIME=sbcl.exe.old
19 else
20 RUNTIME=sbcl
21 OLD_RUNTIME=sbcl.old
23 INSTALL_ROOT=${INSTALL_ROOT-$DEFAULT_INSTALL_ROOT}
24 MAN_DIR=${MAN_DIR-"$INSTALL_ROOT"/share/man}
25 INFO_DIR=${INFO_DIR-"$INSTALL_ROOT"/share/info}
26 DOC_DIR=${DOC_DIR-"$INSTALL_ROOT"/share/doc/sbcl}
28 # Does the environment look sane?
29 if [ -n "$SBCL_HOME" -a "$INSTALL_ROOT/lib/sbcl" != "$SBCL_HOME" ];then
30 echo SBCL_HOME environment variable is set, and conflicts with INSTALL_ROOT.
31 echo Aborting installation. Unset one or reset the other, then try again
32 echo INSTALL_ROOT="$INSTALL_ROOT"
33 echo SBCL_HOME="$SBCL_HOME"
34 exit 1
37 # Before doing anything else, make sure we have an SBCL to install
38 if [ -f src/runtime/$RUNTIME ]; then
39 if [ -f output/sbcl.core ]; then
40 true
41 else
42 echo "output/sbcl.core not found, aborting installation."
43 exit 1
45 else
46 echo "src/runtime/$RUNTIME not found, aborting installation."
47 exit 1
50 SBCL_HOME="$INSTALL_ROOT"/lib/sbcl
51 export SBCL_HOME INSTALL_ROOT
52 ensure_dirs "$BUILD_ROOT$INSTALL_ROOT" "$BUILD_ROOT$INSTALL_ROOT"/bin \
53 "$BUILD_ROOT$INSTALL_ROOT"/lib \
54 "$BUILD_ROOT$MAN_DIR" "$BUILD_ROOT$MAN_DIR"/man1 \
55 "$BUILD_ROOT$INFO_DIR" "$BUILD_ROOT$DOC_DIR" \
56 "$BUILD_ROOT$DOC_DIR"/html \
57 "$BUILD_ROOT$SBCL_HOME"
59 # move old versions out of the way. Safer than copying: don't want to
60 # break any running instances that have these files mapped
61 test -f "$BUILD_ROOT$INSTALL_ROOT"/bin/$RUNTIME && \
62 mv "$BUILD_ROOT$INSTALL_ROOT"/bin/$RUNTIME \
63 "$BUILD_ROOT$INSTALL_ROOT"/bin/$OLD_RUNTIME
64 test -f "$BUILD_ROOT$SBCL_HOME"/sbcl.core && \
65 mv "$BUILD_ROOT$SBCL_HOME"/sbcl.core "$BUILD_ROOT$SBCL_HOME"/sbcl.core.old
67 cp src/runtime/$RUNTIME "$BUILD_ROOT$INSTALL_ROOT"/bin/
68 cp output/sbcl.core "$BUILD_ROOT$SBCL_HOME"/sbcl.core
70 # installing contrib
72 . ./sbcl-pwd.sh
73 sbcl_pwd
75 SBCL="$SBCL_PWD/src/runtime/sbcl --noinform --core $SBCL_PWD/output/sbcl.core --no-userinit --no-sysinit --disable-debugger"
76 SBCL_BUILDING_CONTRIB=1
77 export SBCL SBCL_BUILDING_CONTRIB SBCL_PWD
79 . ./find-gnumake.sh
80 find_gnumake
82 for i in `cd obj/asdf-cache ; echo *`; do
83 test -d obj/asdf-cache/$i && test -f obj/asdf-cache/$i/test-passed.test-report || continue;
84 INSTALL_DIR="$SBCL_HOME/contrib/"
85 export INSTALL_DIR
86 ensure_dirs "$BUILD_ROOT$INSTALL_DIR" && $GNUMAKE -C contrib/$i install < /dev/null
87 done
89 echo
90 echo "SBCL has been installed:"
91 echo " binary $BUILD_ROOT$INSTALL_ROOT/bin/$RUNTIME"
92 echo " core and contribs in $BUILD_ROOT$INSTALL_ROOT/lib/sbcl/"
94 # Installing manual & misc bits of documentation
96 # Locations based on FHS 2.3.
97 # See: <http://www.pathname.com/fhs/pub/fhs-2.3.html>
99 # share/ architecture independent read-only things
100 # share/man/ manpages, should be the same as man/
101 # share/info/ info files
102 # share/doc/ misc documentation
104 echo
105 echo "Documentation:"
107 # man
108 cp doc/sbcl.1 "$BUILD_ROOT$MAN_DIR"/man1/ && echo " man $BUILD_ROOT$MAN_DIR/man1/sbcl.1"
110 # info
111 for info in doc/manual/*.info
113 test -e $info && cp $info "$BUILD_ROOT$INFO_DIR"/ \
114 && BN=`basename $info` \
115 && DIRFAIL=`install-info --info-dir="$BUILD_ROOT$INFO_DIR" \
116 "$BUILD_ROOT$INFO_DIR"/$BN > /dev/null 2>&1 \
117 || echo "(could not add to system catalog)"` \
118 && echo " info $BUILD_ROOT$INFO_DIR/`basename $info` [$BUILD_ROOT$INFO_DIR/dir] $DIRFAIL"
119 done
121 for info in doc/manual/*.info-*
123 test -e $info && cp $info "$BUILD_ROOT$INFO_DIR"/ \
124 && echo " info $BUILD_ROOT$INFO_DIR/`basename $info`"
125 done
127 # pdf
128 for pdf in doc/manual/*.pdf
130 test -e $pdf && cp $pdf "$BUILD_ROOT$DOC_DIR"/ \
131 && echo " pdf $BUILD_ROOT$DOC_DIR/`basename $pdf`"
132 done
134 # html
135 for html in doc/manual/sbcl doc/manual/asdf
137 test -d $html && cp -R -L $html "$BUILD_ROOT$DOC_DIR"/html \
138 && echo " html $BUILD_ROOT$DOC_DIR/html/`basename $html`/index.html"
139 done
141 for html in doc/manual/sbcl.html doc/manual/asdf.html
143 test -e $html && cp $html "$BUILD_ROOT$DOC_DIR"/ \
144 && echo " html $BUILD_ROOT$DOC_DIR/`basename $html`"
145 done
147 for f in BUGS CREDITS COPYING NEWS
149 test -e $f && cp $f "$BUILD_ROOT$DOC_DIR"/
150 done