#!/bin/bash

# arm/build
# Check build dependencies & set package meta data
# by Stuart Winter <stuart@armedslack.org>
# 18-Sep-2004

source /usr/share/slackdev/buildkit.sh

# Package metadata:
export PACKAGE=gimp-print
export VERSION=4.2.7
export ARCH=arm
export BUILD=2
export PKGSERIES=ap
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

# We remove this package if it's already installed.  This saves me having to
# remember if I ever port Slackware to another architecture. Read notes below.
slackfailpkgdeps $PACKAGE || removepkg $PACKAGE

# needed for ijs-config. The problem is that esps depends on gimp-print
# and gimp-print depends on espgs.  See a chicken egg problem here?
# What I originally did was to build gimp-print without needing espgs;
# install the gimp-print package; 
# build espgs;
# removepkg gimp-print;
# rebuild gimp-print with espgs;
# pretend this never happened :-)
#
slackcheckpkgdeps espgs    || installpkg $PKGSTORE/ap/espgs-*.tgz
# Ensure build dependencies (mainly libraries):
slackcheckpkgdeps cups     || installpkg $PKGSTORE/a/cups-*.tgz
slackcheckpkgdeps gpm      || installpkg $PKGSTORE/a/gpm-*.tgz
slackcheckpkgdeps libjpeg  || installpkg $PKGSTORE/l/libjpeg-*.tgz
slackcheckpkgdeps libpng   || installpkg $PKGSTORE/l/libpng-*.tgz
slackcheckpkgdeps libtiff  || installpkg $PKGSTORE/l/libtiff-*.tgz
slackcheckpkgdeps readline || installpkg $PKGSTORE/l/readline-*.tgz
slackcheckpkgdeps ncurses  || installpkg $PKGSTORE/l/ncurses-*.tgz
slackcheckpkgdeps openssl  || installpkg $PKGSTORE/n/openssl-*.tgz
# I skip 'espgs' from the final check (see above):
slackcheckpkgdeps readline,ncurses,cups,gpm,libjpeg,libpng,libtiff || exit 99

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

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