#!/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=kde
export VERSION=4.5.5 ## master version for KDE - also update KDE.options file
                     ## since this will be sourced from the build scripts.
export ARCH=arm
export PKGSERIES=kde
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

# Remove the KDE packages first:
# If this is commented, it's because during the initial KDE build,
# at least one of the packages failed, so I restarted it again where it left off.
#
# It needs uncommenting for an upgrade/full rebuild!
#
#echo "Removing KDE & related packages - this may take a while if you have a full installation..."
#( # Remove Core apps:
#  eval $( sed -n '/KDEMODS=/{:1;s/\\$//;T2;N;b1;:2;p;q}' KDE.SlackBuild )
#  removepkg $KDEMODS
#  # Remove extra apps:
#  eval $( sed -n '/KDEMODS=/{:1;s/\\$//;T2;N;b1;:2;p;q}'  KDE_extra.SlackBuild )
#  removepkg $KDEMODS ) > /dev/null 2>&1

# Ensure specific build dependencies (mainly libraries):
# These are just the ones Pat says we need in order to get going.
#
#slackcheckpkgdeps cups    || installpkg $PKGSTORE/a/cups-*.tgz
#slackcheckpkgdeps pcre    || installpkg $PKGSTORE/l/pcre-*.tgz
#slackcheckpkgdeps libxml2 || installpkg $PKGSTORE/l/libxml2-*.tgz
#slackcheckpkgdeps libxslt || installpkg $PKGSTORE/l/libxslt-*.tgz
#slackcheckpkgdeps cups,pcre,libxml2,libxslt || exit 99
# l/libdbusmenu-qt

# Launch the package build script.
# There is no build script for this one - we have the individual
# logs for each build script.  Although that might make tracking down
# a problem harder, I'll think about that when I come to it.
#
# Launch the package build script:
BUILDLOG=kde-all.build.log
( ./KDE.SlackBuild ) >& /dev/stdout | tee $BUILDLOG

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