#!/bin/sh
# Heavily based on the Slackware 12.2 SlackBuild
# http://bashburn.sourceforge.net
# http://www.slacky.it
# Requires: cdrdao cdrtools dvd+rw-tools lame vorbis-tools flac normalize mpg123

NAME=bashburn
VERSION=3.0
ARCH=${ARCH:-noarch}
BUILD=2bj

CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package-$NAME


rm -rf $PKG
mkdir -p -m 755 $PKG/usr/bin \
 $PKG/usr/doc/$NAME-$VERSION \
 $PKG/usr/{share/applications,share/pixmaps,share/man/man1}


cd $TMP
rm -rf $VERSION
tar -xzvf $CWD/BashBurn-$VERSION.tar.gz || exit 1
cd $VERSION
chown -R root:root .
./Install.sh --prefix=$PKG/usr


cp $CWD/$NAME.png $PKG/usr/share/pixmaps/$NAME.png 

# kde menu-entry
cat > $PKG/usr/share/applications/$NAME.desktop <<END
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=BashBurn
GenericName=Command Line Burning tool
Comment=
Exec=bashburn
Icon=/usr/share/pixmaps/$NAME.png
Terminal=1
TerminalOptions=
Categories=KDE;Application;AudioVideo;DiscBurning;
X-KDE-StartupNotify=true
X-DCOP-ServiceType=Multi
END

cd $PKG
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
requiredbuilder -y -v -s $CWD $PKG
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

if [ "$1" = "--cleanup" ]; then
 rm -rf $TMP
fi
