Add sb-mpfr contrib.
[sbcl/nyef.git] / install.sh
blob5ee1c74627e183f18af8c41e2f41097fecd62bbd
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" \
58 "$BUILD_ROOT$SBCL_HOME"/site-systems
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/$RUNTIME "$BUILD_ROOT$INSTALL_ROOT"/bin/
69 cp output/sbcl.core "$BUILD_ROOT$SBCL_HOME"/sbcl.core
71 # installing contrib
73 . ./sbcl-pwd.sh
74 sbcl_pwd
76 SBCL="$SBCL_PWD/src/runtime/sbcl --noinform --core $SBCL_PWD/output/sbcl.core --no-userinit --no-sysinit --disable-debugger"
77 SBCL_BUILDING_CONTRIB=1
78 export SBCL SBCL_BUILDING_CONTRIB SBCL_PWD
80 . ./find-gnumake.sh
81 find_gnumake
83 for i in `cd obj/asdf-cache ; echo *`; do
84 test -d obj/asdf-cache/$i && test -f obj/asdf-cache/$i/test-passed.test-report || continue;
85 INSTALL_DIR="$SBCL_HOME/contrib/"
86 export INSTALL_DIR
87 ensure_dirs "$BUILD_ROOT$INSTALL_DIR" && $GNUMAKE -C contrib/$i install < /dev/null
88 done
90 echo
91 echo "SBCL has been installed:"
92 echo " binary $BUILD_ROOT$INSTALL_ROOT/bin/$RUNTIME"
93 echo " core and contribs in $BUILD_ROOT$INSTALL_ROOT/lib/sbcl/"
95 # Installing manual & misc bits of documentation
97 # Locations based on FHS 2.3.
98 # See: <http://www.pathname.com/fhs/pub/fhs-2.3.html>
100 # share/ architecture independent read-only things
101 # share/man/ manpages, should be the same as man/
102 # share/info/ info files
103 # share/doc/ misc documentation
105 echo
106 echo "Documentation:"
108 # man
109 cp doc/sbcl.1 "$BUILD_ROOT$MAN_DIR"/man1/ && echo " man $BUILD_ROOT$MAN_DIR/man1/sbcl.1"
111 # info
112 for info in doc/manual/*.info
114 cp $info "$BUILD_ROOT$INFO_DIR"/ \
115 && BN=`basename $info` \
116 && DIRFAIL=`install-info --info-dir="$BUILD_ROOT$INFO_DIR" \
117 "$BUILD_ROOT$INFO_DIR"/$BN > /dev/null 2>&1 \
118 || echo "(could not add to system catalog)"` \
119 && echo " info $BUILD_ROOT$INFO_DIR/`basename $info` [$BUILD_ROOT$INFO_DIR/dir] $DIRFAIL"
120 done
122 for info in doc/manual/*.info-*
124 cp $info "$BUILD_ROOT$INFO_DIR"/ \
125 && echo " info $BUILD_ROOT$INFO_DIR/`basename $info`"
126 done
128 # pdf
129 for pdf in doc/manual/*.pdf
131 cp $pdf "$BUILD_ROOT$DOC_DIR"/ \
132 && echo " pdf $BUILD_ROOT$DOC_DIR/`basename $pdf`"
133 done
135 # html
136 for html in doc/manual/sbcl doc/manual/asdf
138 test -d $html && cp -R -L $html "$BUILD_ROOT$DOC_DIR"/html \
139 && echo " html $BUILD_ROOT$DOC_DIR/html/`basename $html`/index.html"
140 done
142 for html in doc/manual/sbcl.html doc/manual/asdf.html
144 cp $html "$BUILD_ROOT$DOC_DIR"/ \
145 && echo " html $BUILD_ROOT$DOC_DIR/`basename $html`"
146 done
148 for f in BUGS CREDITS COPYING NEWS
150 cp $f "$BUILD_ROOT$DOC_DIR"/
151 done