#!/bin/sh
#
# SlackBuild for LibSigC++
# Written by Georgi D. Sotirov <gdsotirov@dir.bg>
#

. ../slack-package.conf

NAME=libsigc++
VERSION=2.0.18
BUILD=2

cd $TMP
tar -jxvf $CWD/$NAME-$VERSION.tar.bz2
SRC=$TMP/$NAME-$VERSION
cd $SRC
fix_source

CFLAGS=$SLKCFLAGS \
CXXFLAGS=$SLKCFLAGS \
./configure --build=$ARCH-slackware-linux \
            --host=$ARCH-slackware-linux \
            --prefix=/usr \
	    --enable-shared=yes \
	    --enable-static=no

make

PKG="$TMP/package-$NAME"
mkdir -p $PKG

make DESTDIR=$PKG install

( cd $PKG; strip_lib )
( cd $SRC; create_docs $PKG $NAME-$VERSION )

mkdir -p $PKG/install
install -m 644 $CWD/slack-desc     $PKG/install
install -m 644 $CWD/slack-required $PKG/install
mkdir -p $PKG/usr/src/slackbuilds/$NAME-$VERSION
install -m 644 $CWD/slack-desc       $PKG/usr/src/slackbuilds/$NAME-$VERSION
install -m 644 $CWD/slack-required   $PKG/usr/src/slackbuilds/$NAME-$VERSION
install -m 644 $CWD/$NAME.SlackBuild $PKG/usr/src/slackbuilds/$NAME-$VERSION

cd $PKG
PKGNAME=$NAME-$VERSION-$ARCH-$BUILD$MYIN
makepkg -l y -c n $PKG_DIR/$PKGNAME.tgz
cd $PKG_DIR
md5sum $PKGNAME.tgz > $PKGNAME.tgz.md5
cat $PKG/install/slack-desc > $PKG_DIR/$PKGNAME.txt

if [ "$1" == "--cleanup" ]; then
  rm -r $SRC
  rm -r $PKG
fi

