CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-pango
rm -rf $PKG
mkdir -p $PKG/usr

VERSION=1.20.5
ARCH=${ARCH:-i486}
BUILD=1

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

cd $TMP
rm -rf pango-$VERSION
tar xjvf $CWD/pango-$VERSION.tar.bz2 || exit 1
cd pango-$VERSION
chown -R root:root .
find . -perm 664 -exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --mandir=/usr/man \
  --build=$ARCH-slackware-linux
make -j4 || exit 1
make install DESTDIR=$PKG
# Spamming your root partition:
make install
mkdir -p $PKG/etc/pango
cp -a /etc/pango/* $PKG/etc/pango
strip $PKG/usr/bin/*
( cd $PKG
  find . -type f | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded
)
gzip -9 $PKG/usr/man/man?/*
mkdir -p $PKG/usr/doc/pango-$VERSION
cp -a \
  AUTHORS COPYING* NEWS README TODO \
  $PKG/usr/doc/pango-$VERSION
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $TMP/package-pango
makepkg -l y -c n ../pango-$VERSION-$ARCH-$BUILD.tgz