#!/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.4.3
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..."
( cd /var/log/packages
  removepkg kde-* 
  removepkg kde* polkit-kde* polkit-qt*
  # Now the additional packages:
  removepkg amarok* koffice* k3b* guidance-power-manager* kaudiocreator* koffice* konq-plugins* ktorrent* mplayerthumbs* skanlite*
) > /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

# 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 -9f $BUILDLOG 
