#!/bin/bash

source /usr/share/slackdev/buildkit.sh

# Package metadata:
export PKGNAM=netpbm
#export VERSION=10.35.22
export VERSION=10.18.12
export ARCH=arm
export BUILD=2
export PKGSERIES=l
export SLACKPACKAGE=$PKGNAM-$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:
# Also depends on l/svgalib but this is does not exist for ARM.
# However, ARMedslack now uses the svgalib-dummy package from Debian.
slackcheckpkgdeps svgalib || installpkg $PKGSTORE/l/svgalib-*.tgz
slackcheckpkgdeps libjpeg || installpkg $PKGSTORE/l/libjpeg-*.tgz
slackcheckpkgdeps libpng  || installpkg $PKGSTORE/l/libpng-*.tgz
slackcheckpkgdeps libtiff || installpkg $PKGSTORE/l/libtiff-*.tgz
slackcheckpkgdeps svgalib,libjpeg,libpng,libtiff || exit 99

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

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