#!/bin/sh
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-gutenprint
VERSION=5.1.7
ARCH=alpha
BUILD=1
TARGET=$ARCH-alphaslack-linux

# Let GIMP use the plug-in it comes with or it's a messy dependancy.
# This comes with some ghostscript patches that already seem to be
# built into ghostscript now :-)

rm -rf $PKG
mkdir -p $PKG
( cd $TMP
rm -rf gutenprint-$VERSION
tar xjf $CWD/gutenprint-$VERSION.tar.bz2
cd gutenprint-$VERSION
chown -R root.root .
find . -perm 777 -exec chmod 755 {} \;
./configure \
 --prefix=/usr \
 --mandir=/usr/man \
 --with-ijs \
 --with-cups \
 --without-gimp \
 --without-samples \
 --without-user-guide \
 --enable-escputil \
 --disable-nls \
 --build=$TARGET
make -j2 || exit
make install DESTDIR=$PKG
chown -R root.bin $PKG/usr/bin
( 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
)
mkdir -p $PKG/var/log/setup
cat $CWD/setup.06.gutenprint > $PKG/var/log/setup/setup.06.gutenprint
chmod 755 $PKG/var/log/setup/setup.06.gutenprint
rm -rf $PKG/usr/lib/gimp
gzip -9 $PKG/usr/man/man?/*
cp -a ABOUT-NLS AUTHORS COPYING NEWS README $PKG/usr/share/gutenprint/doc
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/gutenprint-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/gutenprint.build.log
