#!/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:-alpha}
BUILD=${BUILD:-2}
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=${TMP}/package-$PRGNAM

rm -rf $PKG
mkdir -p $TMP $PKG
( cd $TMP
rm -rf $PRGNAM-$VERSION
tar xjf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
chown -R root:root .
find . -perm 666 -exec chmod 644 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
find . -perm 400 -exec chmod 644 {} \;
find . -perm 440 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 511 -exec chmod 755 {} \;
find . -perm 711 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;

./configure \
 --prefix=/usr \
 --enable-static=no \
 --build=$ARCH-alphaslack-linux \
 --host=$ARCH-alphaslack-linux

make || exit 1
make install DESTDIR=$PKG

( cd $PKG
 find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
 find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

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

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

cd $PKG
makepkg -l y -c n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee /tmp/$PRGNAM.build.log
