#!/bin/sh
#
# Slackware build script for kasound
# BuildRequires:
# Distribution: Slackware Linux 12.1
# Packager baldelario ~at~ gmail ~dot~ com
# http://www.slacky.it
# Url: http://sourceforge.net/projects/kasound/


CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package-kasound
rm -rf $PKG
mkdir -p $PKG

NAME=kasound
VERSION=0.5b
TARGET=i486
ARCH=${ARCH:-i486}
BUILD=2bj

cd $TMP
tar xjvf $CWD/$NAME-$VERSION.tar.bz2
cd $NAME-0.5
chown -R root:root .

make -f admin/Makefile.common
CFLAGS="-O2 -march=i486 -mcpu=i686" ./configure --prefix=/usr \
						--disable-debug \
						--program-prefix= \
						--program-suffix= \
						--build=$TARGET-slackware-linux
make
make install DESTDIR=$PKG
strip $PKG/usr/bin/*

mkdir -p $PKG/usr/doc/$NAME-$VERSION
cp -a \
AUTHORS COPYING ChangeLog INSTALL README TODO \
 $PKG/usr/doc/$NAME-$VERSION

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
requiredbuilder -y -v -s $CWD $PKG
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

if [ "$1" = "--cleanup" ]; then
 rm -rf $TMP/$NAME-$VERSION
 rm -rf $PKG
fi
