#!/bin/sh

# SlackBuild taken from the Slamd64 Project.  Thanks guys!  --jmd

CWD=`pwd` 
VERSION=0.22.0
ARCH=sparc
BUILD=0
# TUPLE=$ARCH-slackware-linux
TUPLE=$ARCH-splack-linux

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

PKG=/tmp/package-gdk-pixbuf
rm -rf /tmp/gdk-pixbuf-$VERSION
rm -rf $PKG

cd /tmp
tar xjvf $CWD/gdk-pixbuf-$VERSION.tar.bz2
cd gdk-pixbuf-$VERSION
CFLAGS="-O2" ./configure \
  --prefix=/usr \
  --libdir=/usr/lib
  --host=$TUPLE \
  --target=$TUPLE \
  --build=$TUPLE
make
make install DESTDIR=$PKG
mkdir -p $PKG/usr/doc/gdk-pixbuf-$VERSION
cp -a AUTHORS COPYING COPYING.LIB INSTALL NEWS README TODO \
   $PKG/usr/doc/gdk-pixbuf-$VERSION
chown -R root.root $PKG/usr/doc/gdk-pixbuf-$VERSION
chmod 644 $PKG/usr/doc/gdk-pixbuf-$VERSION/*
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n gdk-pixbuf-$VERSION-$ARCH-$BUILD.tgz
mv gdk-pixbuf-$VERSION-$ARCH-$BUILD.tgz /tmp
echo "Package in /tmp"
