slackbuilds/y/moon-buggy/moon-buggy.SlackBuild
Gwenhael Le Moine ebd76929b8 added
2011-04-07 11:58:15 +07:00

95 lines
2.4 KiB
Bash
Executable file

#!/bin/sh
set -x
WITH_SOUND=${WITH_SOUND:=YES}
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=1.0.51
BUILD=1
ARCH=$(uname -m)
TAG=cyco
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
OUTPUT=/tmp
PREFIX=/usr
# Cleaning
rm -fr $TMP/$PRGNAM-$VERSION $PKG
mkdir -p $TMP
[ ! -e $CWD/$PRGNAM-$VERSION.tar.gz ] && wget -c http://seehuhn.de/media/programs/$PRGNAM-$VERSION.tar.gz -O $CWD/$PRGNAM-$VERSION.tar.gz
if [ "x$WITH_SOUND" == "xYES" ]; then
[ ! -e $CWD/$PRGNAM-sound-$VERSION.tar.gz ] && wget -c http://seehuhn.de/media/programs/$PRGNAM-sound-$VERSION.tar.gz -O $CWD/$PRGNAM-sound-$VERSION.tar.gz
fi
# Preparation
cd $TMP
tar xf $CWD/$PRGNAM-$VERSION.tar.gz
if [ "x$WITH_SOUND" == "xYES" ]; then
tar xf $CWD/$PRGNAM-sound-$VERSION.tar.gz
fi
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
if [ "x$WITH_SOUND" == "xYES" ]; then
patch -p1 -i sound.patch
fi
./configure \
--prefix=$PREFIX \
--mandir=$PREFIX/man
make
# Installation
make install DESTDIR=$PKG
mkdir -p $PKG$PREFIX/doc/$PRGNAM
cp ANNOUNCE AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO $PKG$PREFIX/doc/$PRGNAM
# Cleaning
find $PKG | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find $PKG | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find $PKG$PREFIX/man -type f -name "*.?" -exec gzip -9 {} \;
find $PKG$PREFIX/info -type f -name "*.info" -exec gzip -9 {} \;
rm $PKG$PREFIX/info/dir
chown -R root:root $PKG
find $PKG -type f -exec chmod 644 {} \;
chmod +x $PKG$PREFIX/bin/*
# Packaging
cd $PKG
mkdir install
cat <<EOF > install/doinst.sh
#!/bin/sh
cd usr/info
install-info $PRGNAM.info.gz dir
EOF
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (CLI Moon Buggy game)
$PRGNAM:
$PRGNAM: Moon-buggy is a simple character graphics game where you drive some kind
$PRGNAM: of car across the moon's surface. Unfortunately there are dangerous craters
$PRGNAM: there. Fortunately your car can jump over them!
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: http://seehuhn.de/pages/moon-buggy
$PRGNAM:
EOF
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz