#!/bin/bash

#####################################################################
# trackbuild.liunxdoc-tools
# by Stuart Winter <mozes@slackware.com>
# Preform a few pre-build requirements then launch the build script
# through altertrack
# 05-May-2007
#####################################################################

# Build requirements:
# ap/unzip for the docbook stuff
# l/libxml for /usr/bin/xmlcatalogue
# ap/rpm to unpack some SRPMs
# d/python for AsciiDoc
# l/libxslt
# t/tetex
# Just install it on a full Slackware installation - it works for me ;-)

# Package info:
PKGNAM=linuxdoc-tools
ARCH=${ARCH:-i486}
BUILD=${BUILD:-6}
PKGVERSION=0.9.21 # use the version of linuxdoc-tools as the package version.

export CWD=$PWD
export PKGSTORE=/tmp
export TMP=/tmp/build-$PKGNAM/
rm -rf $TMP

####################### Clean up before build #####################

# It's best to clear this stuff up prior to the build.
# All of these directories (apart from /usr/share/xml/libglade) are
# created by this build script:
removepkg linuxdoc-tools
rm -rf /etc/{xml,sgml}
rm -rf /usr/share/doc/linuxdoc-tools
rm -rf /usr/share/sgml
rm -rf /usr/share/xml/{docbook,xml-iso-entities*} # can't wipe the entire dir because of libglade
rm -rf ~/.texmf-var/ # created by docbook-utils

####################################################################

######## WARNING ###################################################
# This will touch nearly every file on your expendable development
# box.  You wouldn't try this on a production system, right?
######## WARNING ###################################################

# Launch the build script:
altertrack \
   --notidy \
   --touch-filesystem-first \
   --showdeps \
   -T $TMP \
   -l $CWD/build.$ARCH.log \
   -R $CWD/postbuildfixes.sh \
   -b $PKGSTORE \
   -zIKASmg \
   -Ocp $PKGNAM-$PKGVERSION-$ARCH-$BUILD.tgz ./linuxdoc-tools.build