#!/bin/sh

# SlackBuild script for dbus-qt3 bindings

# Written by Robby Workman <http://rlworkman.net>

# I realize that this is a very generic script, but PiterPunk deserves
# credit for it, as I just took his and changed a few things to be
# more consistent with my usual style...

# In case you're curious as to why we're not using the qt bindings 
# on the dbus.freedesktop.org page, it's because they were back-ported
# from the qt4 bindings, and they won't compile against kde-3.5.x
# See Comment #'s 5 and 6 of http://bugs.kde.org/show_bug.cgi?id=131035
# for more information. 

# Source obtained from the Gentoo repository
# http://ftp.osuosl.org/pub/gentoo/distfiles/dbus-qt3-0.70.tar.bz2

PRGNAM=dbus-qt3
VERSION=0.70
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_rlw}
CWD=`pwd`
TMP=${TMP:-/tmp}
PKG=${TMP}/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

rm -rf $PKG
mkdir -p $TMP $PKG

if [ "$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 $PRGNAM-$VERSION
tar -xvjf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION || exit 1
chown -R root.root .
chmod -R u+w,go+r-w,a-s .

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --enable-static=no \
  --build=$ARCH-slackware-linux \
  --host=$ARCH-slackware-linux \
  || exit 1

make || exit 1
make install-strip DESTDIR=$PKG || exit 1

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

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
