#!/bin/sh -e

CWD=`pwd`
VERSION=1.1
ARCH=${ARCH:-i486}
BUILD=1

rm -rf spkg-$VERSION
tar xzvf spkg-$VERSION.tar.gz
cd spkg-$VERSION
./configure --sysconfdir=/etc --prefix=/usr --mandir=/usr/man --enable-static-spkg=only
make
make install DESTDIR=$CWD/slack-pkg
gzip -9 $CWD/slack-pkg/usr/man/man8/spkg.8
mkdir -p $CWD/slack-pkg/install
cat slack-desc > $CWD/slack-pkg/install/slack-desc
cat slack-required > $CWD/slack-pkg/install/slack-required
cd $CWD/slack-pkg
makepkg -l y -c n $CWD/spkg-$VERSION-$ARCH-$BUILD.tgz
cd $CWD
rm -rf spkg-$VERSION slack-pkg
