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

VERSION=1.11.4
ARCH=i486
BUILD=1z26

SLKCFLAGS="-O2 -march=i486 -mtune=i686"

cd $TMP
rm -rf atk-$VERSION
tar xjvf $CWD/atk-$VERSION.tar.bz2
cd atk-$VERSION
chown -R root.root .
find . -perm 664 -exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
./configure --prefix=/usr \
            --sysconfdir=/etc
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
)
mkdir -p $PKG/usr/doc/atk-$VERSION
cp -a \
  AUTHORS COPYING ChangeLog NEWS README \
  $PKG/usr/doc/atk-$VERSION

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

mkdir -p $PKG/install
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------------------------------------------------------|
atk: atk
atk:
atk: atk is a library of accessability functions used by GNOME.
atk:
atk:
atk:
atk:
atk:
atk:
atk:
atk:
EOF

cd $TMP/package-atk
makepkg -l y -c n ../atk-$VERSION-$ARCH-$BUILD.tgz
cd ..
md5sum atk-$VERSION-$ARCH-$BUILD.tgz > atk-$VERSION-$ARCH-$BUILD.md5