#!/bin/bash

source /usr/share/slackdev/buildkit.sh

# Package metadata:
export PKGNAM=libao
export PKGSERIES=l
export VERSION=0.8.8
export BUILD=1
export ARCH=arm
export SLACKPACKAGE=$PKGNAM-$VERSION-$ARCH-$BUILD.tgz

# Reset the ARM file system: restore it to the 'factory settings'
# as it were:
sboxsysrestore

# Ensure base ARM packages are installed first:
slackbasedeps

# Ensure additional dependencies:
{ slackcheckpkgdeps alsa-lib    || installpkg $PKGSTORE/l/alsa-lib-[0-9]*.t?z || exit 99 ; }
{ slackcheckpkgdeps audiofile   || installpkg $PKGSTORE/l/audiofile-[0-9]*.t?z || exit 99 ; }
{ slackcheckpkgdeps esound      || installpkg $PKGSTORE/l/esound-[0-9]*.t?z || exit 99 ; }
{ slackcheckpkgdeps glib2       || installpkg $PKGSTORE/l/glib2-[0-9]*.t?z || exit 99 ; }

# Launch the package build script:
BUILDLOG=$( basename $SLACKPACKAGE .tgz ).build.log
( ./$PKGNAM.SlackBuild ) >& /dev/stdout | tee $BUILDLOG

# Compress the build log:
bzip2 -9f $BUILDLOG
