1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
#!/bin/sh
CLISP_LIB=$(clisp -q -norc -x '(progn (princ *lib-directory*) (values))')
LINKSET=unix-bindings-linking-set
if [ $# != 1 -a $# != 2 ] ; then
echo
echo "Meta-CVS Installer"
echo
echo "Please specify the target prefix, as a full absolute path."
echo "For example, specifying /usr/local will place files under"
echo "/usr/local/bin and /usr/local/lib."
echo
echo "You can optionally specify a destination prefix. Files will be"
echo "installed relative to this prefix. This is handy when building for"
echo "certain Linux distributions."
echo
exit 1
else
TARGET="$1"
DESTDIR="$2"
fi
space_check()
{
if [ $# -gt 1 ] ; then
echo "The path \"$*\" contains whitespace."
exit 1
fi
}
dash_check()
{
case $1 in
-* )
echo "The path $1 looks like a command line option."
exit 1
;;
esac
}
space_check "$DESTDIR$TARGET"
dash_check "$DESTDIR$TARGET"
TARGET_LIB=$TARGET/lib/clisp/meta-cvs
TARGET_BIN=$TARGET/bin
if ! mkdir -p "$DESTDIR$TARGET_LIB" ; then
echo "Unable to create $DESTDIR$TARGET_LIB directory."
exit 1
fi
if ! mkdir -p "$DESTDIR$TARGET_BIN" ; then
echo "Unable to create "$DESTDIR$TARGET_BIN" directory."
exit 1
fi
if [ ! -e $LINKSET ] ; then
export CLISP_LINKKIT="${CLISP_LIB}linkkit"
sh "${CLISP_LIB}clisp-link" add-module-set unix-bindings \
"${CLISP_LIB}base" $LINKSET
fi
LISPRUN=$LINKSET/lisp
if [ -f $LISPRUN.run ] ; then
LISPRUN=$LISPRUN.run
LISPEXE=.run
elif [ -f $LISPRUN.exe ] ; then
LISPRUN=$LISPRUN.exe
LISPEXE=.exe
else
echo "linking set failed to build."
exit 1
fi
if ! $LISPRUN -M $LINKSET/lispinit.mem -q -c mcvs-main ; then
echo "There were compilation errors."
exit 1
fi
$LISPRUN -M $LINKSET/lispinit.mem -q -i mcvs-main -x '(ext:saveinitmem "mcvs.mem" :quiet t)'
if ! cp mcvs.mem "$DESTDIR$TARGET_LIB/lispinit.mem"; then
echo "Unable to copy to $DESTDIR$TARGET_LIB."
exit 1
fi
if ! cp $LISPRUN "$DESTDIR$TARGET_LIB"; then
echo "Unable to copy to $DESTDIR$TARGET_LIB."
exit 1
fi
if ! cat > "$DESTDIR$TARGET_BIN/mcvs" <<END
#!$TARGET_LIB/lisp$LISPEXE -M$TARGET_LIB/lispinit.mem
(mcvs)
END
then
echo "Could not create mcvs script in $DESTDIR$TARGET."
exit 1
fi
if ! chmod a+x "$DESTDIR$TARGET_BIN/mcvs" ; then
echo "Could not set permissions of mcvs script in $DESTDIR$TARGET."
exit 1
fi
if ! cat > "$DESTDIR$TARGET_BIN/mcvs-upgrade" <<END
#!/bin/sh
TARGET_LIB="$TARGET_LIB"
LISPRUN="\$TARGET_LIB/lisp.run -M \$TARGET_LIB/lispinit.mem"
if [ \$# != 1 ] ; then
echo
echo "Syntax:"
echo
echo " mcvs-upgrade <path-to-source>"
echo
echo "The path specifies the directory which holds unpacked Meta-CVS source,"
echo "the place where the file mcvs-main.lisp is located."
echo
echo "This upgrade mechanism is intended to make it possible to use a"
echo "newer version of Meta-CVS without having to obtain a complete binary"
echo "distribution that includes the Lisp executable, and without having"
echo "to install the Lisp development environment to build the sources."
echo
echo "Note that it's not possible to upgrade if the newer Meta-CVS sources"
echo "rely on new C functions being linked into the Lisp system; get a"
echo "new binary distribution, or set up CLISP and compile Meta-CVS from"
echo "the sources using its install.sh script"
echo
echo "Ignore the copious compiler warnings about objects and functions"
echo "being redefined; this is what we want."
echo
exit 1
fi
SOURCE_PATH="\$1"
if ! cd "\$SOURCE_PATH" ; then
echo "unable to change to \$SOURCE_PATH"
exit 1
fi
if ! \$LISPRUN -c mcvs-main ; then
echo "unable to compile"
exit 1
fi
if ! \$LISPRUN -q -i mcvs-main -x '(ext:saveinitmem "mcvs.mem" :quiet t)' ; then
echo "unable to load and generate memory image"
exit 1
fi
if ! cp mcvs.mem \$TARGET_LIB/lispinit.mem ; then
echo "unable to copy new Meta-CVS image to \$TARGET_LIB directory."
exit 1
fi
echo
echo "It appears that Meta-CVS has been re-generated from the given sources."
echo
END
then
echo "Could not create mcvs script in $DESTDIR$TARGET."
exit 1
fi
if ! chmod a+x "$DESTDIR$TARGET_BIN/mcvs-upgrade" ; then
echo "Could not set permissions of mcvs script in $DESTDIR$TARGET."
exit 1
fi
exit 0
|