#!/bin/bash

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

# Package metadata:
export PKGNAM=libassuan
export VERSION=3.0.2
export BUILD=1
export PKGSERIES=n
export SLACKPACKAGE=$PKGNAM-$VERSION-$ARCH-$BUILD.txz

# 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 $PKGNAM isn't already installed:
slackfailpkgdeps $PKGNAM || removepkg $PKGNAM

# Ensure build dependencies are met.
# There aren't any linked library dependencies on pth for this, but when
# I was building gnupg2 without libassuan installed, I got this from ./configure:
#*** You need libassuan with Pth support to build this program.
# so..
{ slackcheckpkgdeps pth || installpkg $PKGSTORE/n/npth-*.t?z || exit 99 ; }

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

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

