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