#!/bin/sh
# Heavily based on the Slackware 12.1 SlackBuild
# http://dvdauthorwizard.sourceforge.net
# Packagers Gohanz ( gohanz@infinito.it)
# http://www.slacky.it

CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package-dvdauthorwizard
NAME=dvdauthorwizard
VERSION=1.4.6
ARCH=${ARCH:-noarch}
BUILD=2as

if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi

cd $TMP
tar xvjf $CWD/DVDAuthorWizard-$VERSION.tar.bz2

echo "+--------------------------------------------+"
echo "| Starting SlackBuild  $NAME-$VERSION |"
echo "+--------------------------------------------+"

cd DVDAuthorWizard-$VERSION

mkdir -p $PKG/usr/bin
mkdir -p $PKG/usr/share/applications/kde
mkdir -p $PKG/usr/share/kommander/dvdauthorwizard/Pictures
mkdir -p $PKG/usr/doc/$NAME-$VERSION

cp -a $CWD/kdvdauthoringwizard.desktop \
$PKG/usr/share/applications/kde
cp -a share/apps/dvdauthorwizard/Pictures/* \
$PKG/usr/share/kommander/dvdauthorwizard/Pictures
cp -a bin/DVDAuthorWizard.kmdr \
$PKG/usr/share/kommander/dvdauthorwizard
cp -a bin/DVDAuthorWizard-Builder.sh \
$PKG/usr/share/kommander/dvdauthorwizard
cp -a Creating*.txt Changelog README \
$PKG/usr/doc/$NAME-$VERSION
cp -a $CWD/dvdauthorwizard $PKG/usr/bin
chmod 755 $PKG/usr/bin/dvdauthorwizard

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

cd $PKG
chown -R root:root .
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

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