slackbuilds/d/clojure/clojure.SlackBuild
Gwenhael Le Moine fd3b4eb2f7 output
2010-12-03 14:58:03 +07:00

77 lines
1.8 KiB
Bash
Executable file

#!/bin/sh
set -x -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=${VERSION:-1.2.0}
ARCH=${ARCH:-java}
BUILD=${BUILD:-1}
PACKAGER=${PACKAGER:-cyco}
TMP=${TMP:-/tmp/$PACKAGER}
OUTPUT=${OUTPUT:-/tmp}
PKG=$TMP/pkg-$PRGNAM
PREFIX=${PREFIX:-/usr}
# cleaning
rm -fr $PKG
# do we have the sources?
if [ ! -e $CWD/$PRGNAM-$VERSION.zip ] ; then
( cd $CWD
wget -c --no-check-certificate http://github.com/downloads/clojure/clojure/$PRGNAM-$VERSION.zip
)
fi
# unpacking
mkdir -p $PKG$PREFIX/libexec
( cd $PKG$PREFIX/libexec
unzip $CWD/${PRGNAM}-$VERSION.zip
)
# compilation
( cd $PKG$PREFIX/libexec/$PRGNAM-$VERSION
ant
)
# installation
mkdir -p $PKG$PREFIX/{bin,doc/$PRGNAM-$VERSION}
cat <<EOF > $PKG$PREFIX/bin/$PRGNAM
#!/bin/sh
java -jar $PREFIX/libexec/$PRGNAM-$VERSION/clojure.jar \$@
EOF
chmod +x $PKG$PREFIX/bin/$PRGNAM
( cd $PKG$PREFIX/libexec/$PRGNAM-$VERSION
mv *.html *.txt test/ $PKG$PREFIX/doc/$PRGNAM-$VERSION
rm *.xml .gitignore
rm -r classes src
rm $PRGNAM.jar
ln -s $PRGNAM-$VERSION.jar $PRGNAM.jar
rm $PRGNAM-sources.jar
ln -s $PRGNAM-sources-$VERSION.jar $PRGNAM-sources.jar
rm $PRGNAM-slim.jar
ln -s $PRGNAM-slim-$VERSION.jar $PRGNAM-slim.jar
)
# packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (JVM targetting Lisp dialect)
$PRGNAM:
$PRGNAM: Clojure is a dynamic programming language that targets the Java Virtual
$PRGNAM: Machine (and the CLR ). It is designed to be a general-purpose language,
$PRGNAM: combining the approachability and interactive development of a scripting
$PRGNAM: language with an efficient and robust infrastructure for multithreaded
$PRGNAM: programming.
$PRGNAM:
$PRGNAM: see $PREFIX/doc/$PRGNAM-$VERSION
$PRGNAM:
$PRGNAM: http://clojure.org
EOF
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d - )-$ARCH-$BUILD$PACKAGER.txz