#!/bin/sh
# Heavily based on the Slackware 11.0 SlackBuild
# http://www.abisource.com/
# Packager Vincenzi Loris - slacky@slacky.it

CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package-abiword-docs
NAME=abiword-docs
VERSION=2.5.1
ARCH=${ARCH:-noarch}
BUILD=1sl

if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi

cd $TMP
tar xzvf $CWD/$NAME-$VERSION.tar.gz
cd $NAME-$VERSION
chown -R root:root .
./configure --prefix=/usr \
make
make install DESTDIR=$PKG
mkdir -p $PKG/usr/doc/$NAME-$VERSION
mkdir -p $PKG/install
cat $CWD/slack-desc-docs > $PKG/install/slack-desc
cat $CWD/slack-desc-docs > $PKG/usr/doc/$NAME-$VERSION/slack-desc-docs
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild
cd $PKG
requiredbuilder -v -y -s $CWD $PKG
makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz

if [ "$1" = "--cleanup" ]; then
  rm -rf $TMP
fi