slackbuilds/doc/sicp/sicp.SlackBuild
2011-04-02 20:45:52 +07:00

84 lines
2.4 KiB
Bash
Executable file

#!/bin/sh -x
# variables
CWD=$(pwd)
VERSION=${VERSION:-$(date +"%Y.%m.%d_%H.%M")}
BUILD=${BUILD:-3}
TAG=cyco
TMP=${TMP:-/tmp/$TAG}
OUTPUT=${OUTPUT:-/tmp}
PRGNAM=${PRGNAM:-$(basename $CWD)}
PKG=${PKG:-$TMP/pkg-$PRGNAM}
ARCH=${ARCH:-noarch}
PREFIX=${PREFIX:-/usr}
# nettoyage préalable
rm -fr $PKG
mkdir -p $PKG$PREFIX/doc/$PRGNAM
# mise en place
cd $CWD
[ -e ./sicp.texi.gz ] && mv ./sicp.texi.gz ./sicp.texi.gz.bkp
wget -c http://www.neilvandyke.org/sicp-texi/sicp.texi.gz || cp ./sicp.texi.gz.bkp ./sicp.texi.gz
[ -e ./allcode.tar.gz ] && mv ./allcode.tar.gz ./allcode.tar.gz.bkp
wget -c http://mitpress.mit.edu/sicp/code/allcode.tar.gz || cp ./allcode.tar.gz.bkp ./allcode.tar.gz
cd $PKG$PREFIX/doc/$PRGNAM
cp $CWD/sicp.texi.gz .
cp $CWD/allcode.tar.gz .
gunzip sicp.texi.gz
makeinfo sicp.texi
mkdir -p $PKG/usr/info
mv sicp sicp-* $PKG/usr/info/
# correction
cd $PKG
chown -R root:root *
[ -d $PKG/usr/info ] && find $PKG/usr/info -type f -name "*" -exec gzip -9f {} \;
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/doinst.sh
cd /usr/info
[ -e dir ] && rm dir
[ -e dir.gz ] && rm dir.gz
[ -e dir.new ] && rm dir.new
for file in \$(ls *.gz | grep -v ".*\-[0-9]\+\.gz")
do
install-info \$file ./dir
done
EOF
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (computer-science text)
$PRGNAM:
$PRGNAM: Wizard Book n. Hal Abelson's, Jerry Sussman's and Julie Sussman's
$PRGNAM: Structure and Interpretation of Computer Programs (MIT Press, 1984;
$PRGNAM: ISBN 0-262-01077-1), an excellent computer science text used in
$PRGNAM: introductory courses at MIT. So called because of the wizard on the
$PRGNAM: jacket. One of the bibles of the LISP/Scheme world. Also,
$PRGNAM: less commonly, known as the Purple Book.
$PRGNAM: http://mitpress.mit.edu/sicp/
$PRGNAM: http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
$PRGNAM: http://www.neilvandyke.org/sicp-texi/
EOF
# empaquetage
makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz