#!/bin/bash

# arm/build
# Check package dependencies, set metadata and launch
# package build script.
# by Stuart Winter <stuart@armedslack.org>
#
source /usr/share/slackdev/buildkit.sh

# Package metadata:
export PACKAGE=xine-ui
export VERSION=0.99.4
export ARCH=arm
export BUILD=3
export PKGSERIES=xap
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 specific build dependencies (mainly libraries):
slackcheckpkgdeps gpm       || installpkg $PKGSTORE/a/gpm-*.tgz
slackcheckpkgdeps aalib     || installpkg $PKGSTORE/l/aalib-*.tgz
slackcheckpkgdeps expat     || installpkg $PKGSTORE/l/expat-*.tgz
slackcheckpkgdeps libidn    || installpkg $PKGSTORE/l/libidn-*.tgz
slackcheckpkgdeps libpng    || installpkg $PKGSTORE/l/libpng-*.tgz
slackcheckpkgdeps ncurses   || installpkg $PKGSTORE/l/ncurses-*.tgz
slackcheckpkgdeps readline  || installpkg $PKGSTORE/l/readline-*.tgz
slackcheckpkgdeps slang     || installpkg $PKGSTORE/l/slang-*.tgz
slackcheckpkgdeps curl      || installpkg $PKGSTORE/n/curl-*.tgz
slackcheckpkgdeps openssl   || installpkg $PKGSTORE/n/openssl-*.tgz
slackcheckpkgdeps x11       || installpkg $PKGSTORE/x/x11-*.tgz
slackcheckpkgdeps xine-lib  || installpkg $PKGSTORE/xap/xine-lib-*.tgz
slackcheckpkgdeps x11-devel || installpkg $PKGSTORE/x/x11-devel-*.tgz
slackcheckpkgdeps gpm,aalib,expat,libidn,libpng,ncurses,readline,slang,curl,openssl,x11,xine-lib,x11-devel || exit 99

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

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