#!/bin/sh
#
# Slackware build script for svgDeco
# BuildRequires: 
# Distribution: Slackware Linux 12.0
# Packager baldelario ~at~ gmail ~dot~ com
# http://www.slacky.it
# Source location: http://www.kde-look.org/content/show.php?content=23764

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

NAME=svgdeco
VERSION=beta1
TARGET=i486
ARCH=${ARCH:-i486}
BUILD=1bj

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

cd $TMP
rm -rf svgDeco-$VERSION
tar xvjf $CWD/svgDeco-$VERSION.tar.bz2
cd svgDeco-$VERSION
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure --prefix=/usr \
--disable-debug \
--enable-final \
--program-prefix= \
--program-suffix= \
--build=$TARGET-slackware-linux-gnu
make
make install DESTDIR=$PKG
mkdir -p $PKG/usr/doc/$NAME-$VERSION
cp -a AUTHORS ChangeLog COPYING INSTALL README CREDITS NEWS TODO \
$PKG/usr/doc/$NAME-$VERSION

cd $CWD
cp -a *.SlackBuild slack-desc $PKG/usr/doc/$NAME-$VERSION
strip --strip-unneeded $PKG/usr/lib/kde3/*.so
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

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

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