#!/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=pcre
export VERSION=${VERSION:-8.45}
export BUILD=${BUILD:-1}
export PKGSERIES=${PKGSERIES:-l}
export SLACKPACKAGE=$PKGNAM-$VERSION-$PKGARCH-$BUILD.txz

## ******************************************************************* ##
# For test packages - best to store in another location rather than
# overwriting the working copy in the main tree:
# export PKGSTORE=/tmp/
# mkdir -vpm755 $PKGSTORE/$PKGSERIES
## ******************************************************************* ##

# Ensure base ARM packages are installed first:
slackbasedeps

# Ensure $PKGNAM isn't already installed:
# Actually no, because there are too many things linked against this which break
# once the library is removed: grep is one of them, so pkgtools breaks.
# Now that we rebuild all package batches 4 times, I'm no longer concerned about removing
# packages prior to building.
#slackfailpkgdeps $PKGNAM || removepkg $PKGNAM

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

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