Delete redundant object sizing functions
[sbcl.git] / install.sh
blobf2d8ab4fe5ef63cbe6a9344ff0b3a33862ab275f
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
69 cp src/runtime/sbcl.mk "$BUILD_ROOT$SBCL_HOME"/sbcl.mk
70 for i in $(grep '^LIBSBCL=' src/runtime/sbcl.mk | cut -d= -f2-) ; do
71 cp "src/runtime/$i" "$BUILD_ROOT$SBCL_HOME/$i"
72 done
74 # installing contrib
76 . ./sbcl-pwd.sh
77 sbcl_pwd
79 SBCL="$SBCL_PWD/src/runtime/sbcl --noinform --core $SBCL_PWD/output/sbcl.core --no-userinit --no-sysinit --disable-debugger"
80 SBCL_BUILDING_CONTRIB=1
81 export SBCL SBCL_BUILDING_CONTRIB SBCL_PWD
83 . ./find-gnumake.sh
84 find_gnumake
86 for i in `cd obj/asdf-cache ; echo *`; do
87 test -d obj/asdf-cache/$i && test -f obj/asdf-cache/$i/test-passed.test-report || continue;
88 INSTALL_DIR="$SBCL_HOME/contrib/"
89 export INSTALL_DIR
90 ensure_dirs "$BUILD_ROOT$INSTALL_DIR" && $GNUMAKE -C contrib/$i install < /dev/null
91 done
93 echo
94 echo "SBCL has been installed:"
95 echo " binary $BUILD_ROOT$INSTALL_ROOT/bin/$RUNTIME"
96 echo " core and contribs in $BUILD_ROOT$INSTALL_ROOT/lib/sbcl/"
98 # Installing manual & misc bits of documentation
100 # Locations based on FHS 2.3.
101 # See: <http://www.pathname.com/fhs/pub/fhs-2.3.html>
103 # share/ architecture independent read-only things
104 # share/man/ manpages, should be the same as man/
105 # share/info/ info files
106 # share/doc/ misc documentation
108 echo
109 echo "Documentation:"
110 CP="cp -f"
112 # man
113 $CP doc/sbcl.1 "$BUILD_ROOT$MAN_DIR"/man1/ && echo " man $BUILD_ROOT$MAN_DIR/man1/sbcl.1"
115 # info
116 for info in doc/manual/*.info
118 test -e $info && $CP $info "$BUILD_ROOT$INFO_DIR"/ \
119 && BN=`basename $info` \
120 && DIRFAIL=`install-info --info-dir="$BUILD_ROOT$INFO_DIR" \
121 "$BUILD_ROOT$INFO_DIR"/$BN > /dev/null 2>&1 \
122 || echo "(could not add to system catalog)"` \
123 && echo " info $BUILD_ROOT$INFO_DIR/`basename $info` [$BUILD_ROOT$INFO_DIR/dir] $DIRFAIL"
124 done
126 for info in doc/manual/*.info-*
128 test -e $info && $CP $info "$BUILD_ROOT$INFO_DIR"/ \
129 && echo " info $BUILD_ROOT$INFO_DIR/`basename $info`"
130 done
132 # pdf
133 for pdf in doc/manual/*.pdf
135 test -e $pdf && $CP $pdf "$BUILD_ROOT$DOC_DIR"/ \
136 && echo " pdf $BUILD_ROOT$DOC_DIR/`basename $pdf`"
137 done
139 # html
140 for html in doc/manual/sbcl doc/manual/asdf
142 test -d $html && $CP -R -L $html "$BUILD_ROOT$DOC_DIR"/html \
143 && echo " html $BUILD_ROOT$DOC_DIR/html/`basename $html`/index.html"
144 done
146 for html in doc/manual/sbcl.html doc/manual/asdf.html
148 test -e $html && $CP $html "$BUILD_ROOT$DOC_DIR"/ \
149 && echo " html $BUILD_ROOT$DOC_DIR/`basename $html`"
150 done
152 for f in BUGS CREDITS COPYING NEWS
154 test -e $f && $CP $f "$BUILD_ROOT$DOC_DIR"/
155 done