slackbuilds/d/jruby/jruby.SlackBuild
2011-08-09 19:40:30 +02:00

66 lines
1.7 KiB
Bash
Executable file

#!/bin/sh
set -x -e
CWD=$(pwd)
PRGNAM=${PRGNAM:=$(basename $CWD)}
ARCH=${ARCH:=$(uname -m)}
VERSION=${VERSION:=1.6.3}
BUILD=${BUILD:=2}
TAG=${TAG:=cyco}
OUTPUT=${OUTPUT:=/tmp}
TMP=${TMP:=/tmp/$TAG}
PKG=${PKG:=$TMP/pkg-$PRGNAM}
PREFIX=${PREFIX:=/usr}
# cleaning
rm -fr $PKG
[ ! -e $CWD/$PRGNAM-bin-$VERSION.tar.gz ] && wget -c -O $CWD/$PRGNAM-bin-$VERSION.tar.gz http://jruby.org.s3.amazonaws.com/downloads/$VERSION/jruby-bin-$VERSION.tar.gz
# unpacking
mkdir -p $PKG$PREFIX/libexec/
( cd $PKG$PREFIX/libexec/
tar xf $CWD/$PRGNAM-bin-$VERSION.tar.gz
ln -s $PRGNAM-$VERSION $PRGNAM
rm $PRGNAM-$VERSION/bin/*.bat
rm -fr $PKG$PREFIX/libexec/$PRGNAM-$VERSION/lib/native/{Darwin,i386-FreeBSD,i386-OpenBSD,i386-SunOS,i386-Windows,ppc-AIX,sparc-SunOS,sparcv9-SunOS,x86_64-FreeBSD,x86_64-OpenBSD,x86_64-SunOS,x86_64-Windows}
if [ "x$ARCH" == "xx86_64" ]; then
rm -fr $PKG$PREFIX/libexec/$PRGNAM-$VERSION/lib/native/i386-Linux/
else
rm -fr $PKG$PREFIX/libexec/$PRGNAM-$VERSION/lib/native/x86_64-Linux/
fi
)
# installation
mkdir -p $PKG/etc/profile.d
cat <<EOF > $PKG/etc/profile.d/$PRGNAM.sh
#!/bin/sh
export PATH=\$PATH:$PKG$PREFIX/libexec/$PRGNAM-$VERSION/bin/
EOF
cat <<EOF > $PKG/etc/profile.d/$PRGNAM.csh
#!/bin/csh
setenv PATH \$PATH:$PKG$PREFIX/libexec/$PRGNAM-$VERSION/bin/
EOF
chmod +x $PKG/etc/profile.d/$PRGNAM.*sh
# packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (Ruby on the JVM)
$PRGNAM:
$PRGNAM: 100% Pure-Java Implementation of the Ruby Programming Language
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: http://www.jruby.org/
$PRGNAM:
EOF
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz