1.0.3.10: Add -D_REENTRANT to Solaris CFLAGS
[sbcl.git] / install.sh
blob3ee1ffbc555d12b8ec6057d73acad70b698ca393
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 if [ "$OSTYPE" = "cygwin" -o "$OSTYPE" = "msys" ] ; then
14 DEFAULT_INSTALL_ROOT="$PROGRAMFILES/sbcl"
15 RUNTIME=sbcl.exe
16 OLD_RUNTIME=sbcl.exe.old
17 else
18 DEFAULT_INSTALL_ROOT=/usr/local
19 RUNTIME=sbcl
20 OLD_RUNTIME=sbcl.old
22 INSTALL_ROOT=${INSTALL_ROOT-$DEFAULT_INSTALL_ROOT}
23 MAN_DIR=${MAN_DIR-"$INSTALL_ROOT"/share/man}
24 INFO_DIR=${INFO_DIR-"$INSTALL_ROOT"/share/info}
25 DOC_DIR=${DOC_DIR-"$INSTALL_ROOT"/share/doc/sbcl}
27 # Does the environment look sane?
28 if [ -n "$SBCL_HOME" -a "$INSTALL_ROOT/lib/sbcl" != "$SBCL_HOME" ];then
29 echo SBCL_HOME environment variable is set, and conflicts with INSTALL_ROOT.
30 echo Aborting installation. Unset one or reset the other, then try again
31 echo INSTALL_ROOT="$INSTALL_ROOT"
32 echo SBCL_HOME="$SBCL_HOME"
33 exit 1
36 # Before doing anything else, make sure we have an SBCL to install
37 if [ -f src/runtime/$RUNTIME ]; then
38 if [ -f output/sbcl.core ]; then
39 true
40 else
41 echo "output/sbcl.core not found, aborting installation."
42 exit 1
44 else
45 echo "src/runtime/$RUNTIME not found, aborting installation."
46 exit 1
49 SBCL_HOME="$INSTALL_ROOT"/lib/sbcl
50 export SBCL_HOME INSTALL_ROOT
51 ensure_dirs "$BUILD_ROOT$INSTALL_ROOT" "$BUILD_ROOT$INSTALL_ROOT"/bin \
52 "$BUILD_ROOT$INSTALL_ROOT"/lib \
53 "$BUILD_ROOT$MAN_DIR" "$BUILD_ROOT$MAN_DIR"/man1 \
54 "$BUILD_ROOT$INFO_DIR" "$BUILD_ROOT$DOC_DIR" \
55 "$BUILD_ROOT$DOC_DIR"/html \
56 "$BUILD_ROOT$SBCL_HOME" \
57 "$BUILD_ROOT$SBCL_HOME"/site-systems
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
79 . ./find-gnumake.sh
80 find_gnumake
82 for i in contrib/*; do
83 test -d $i && test -f $i/test-passed || continue;
84 INSTALL_DIR="$SBCL_HOME"/`basename $i `
85 export INSTALL_DIR
86 ensure_dirs "$BUILD_ROOT$INSTALL_DIR" && $GNUMAKE -C $i install
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 doc/manual/*.info-*
113 cp $info "$BUILD_ROOT$INFO_DIR"/ \
114 && echo -n " info $BUILD_ROOT$INFO_DIR/`basename $info` $BUILD_ROOT$INFO_DIR/dir" \
115 && ( install-info "$BUILD_ROOT$INFO_DIR"/`basename $info` "$BUILD_ROOT$INFO_DIR"/dir > /dev/null 2>&1 \
116 || echo -n " (could not add to system catalog)" ) \
117 && echo
118 done
120 # pdf
121 for pdf in doc/manual/*.pdf
123 cp $pdf "$BUILD_ROOT$DOC_DIR"/ \
124 && echo " pdf $BUILD_ROOT$DOC_DIR/`basename $pdf`"
125 done
127 # html
128 for html in doc/manual/sbcl doc/manual/asdf
130 test -d $html && cp -R -L $html "$BUILD_ROOT$DOC_DIR"/html \
131 && echo " html $BUILD_ROOT$DOC_DIR/html/`basename $html`/index.html"
132 done
134 for f in BUGS SUPPORT CREDITS COPYING NEWS
136 cp $f "$BUILD_ROOT$DOC_DIR"/
137 done