#!/bin/bash

source /usr/share/slackdev/buildkit.sh

# Package metadata:
export PACKAGE=cups
export PKGSERIES=a
export VERSION=1.1.23
export BUILD=2
export ARCH=arm
export SLACKPACKAGE=$PACKAGE-$VERSION-$ARCH-$BUILD.tgz

# Reset the ARM file system: restore it to the 'factory settings'
# as it were (this has no effect when building natively):
sboxsysrestore

# Ensure base ARM packages are installed first:
slackbasedeps

# Ensure build dependencies:
slackcheckpkgdeps libpng  || installpkg $PKGSTORE/l/libpng-*.tgz
slackcheckpkgdeps libtiff || installpkg $PKGSTORE/l/libtiff-*.tgz
slackcheckpkgdeps libjpeg || installpkg $PKGSTORE/l/libjpeg-*.tgz
slackcheckpkgdeps openssl || installpkg $PKGSTORE/n/openssl-*.tgz
slackcheckpkgdeps openssl,libpng,libtiff,libjpeg || exit 99

# Launch the package build script:
( ./$PACKAGE.SlackBuild ) >& /dev/stdout | tee build.$ARCH.log

# Compress the build log:
bzip2 -9f build.$ARCH.log
