#!/bin/sh
CWD=`pwd`
PKG=/tmp/package-libgsf

VERSION=1.14.1
ARCH=i486
BUILD=1z26

rm -rf $PKG
mkdir -p $PKG
cd /tmp
rm -rf libgsf-$VERSION
tar xjvf $CWD/libgsf-$VERSION.tar.bz2
cd libgsf-$VERSION
chown -R root.root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
./configure \
  --prefix=/usr \
  $ARCH-zenwalk-linux
make
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
)
mv $PKG/usr/share/doc $PKG/usr

mkdir -p $PKG/usr/src/libgsf-$VERSION
cp $CWD/build-libgsf.sh $PKG/usr/src/libgsf-$VERSION/

mkdir -p $PKG/install

#
# make a slack-desc file
#
cat <<"EOF" > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in.  You must make
# exactly 11 lines for the formatting to be correct.  It's also customary to
# leave one space after the ':'.

      |-----handy-ruler------------------------------------------------------|
libgsf:  libgsf
libgsf:
libgsf:  libgsf aims to provide an efficient extensible i/o abstraction for
libgsf:  dealing with different structured file formats.
libgsf:
libgsf:  libgsf is used by librsvg, AbiWord, Gnumeric, and KWord.
libgsf:
libgsf:
libgsf:
libgsf:
libgsf:
EOF

cd $PKG
makepkg -l y -c n ../libgsf-$VERSION-$ARCH-$BUILD.tgz
cd ..
md5sum libgsf-$VERSION-$ARCH-$BUILD.tgz > libgsf-$VERSION-$ARCH-$BUILD.md5
