#!/bin/sh
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
PKG=$TMP/package-amp
VERSION=0.7.6
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
if [ ! -d $TMP ]; then
mkdir -p $TMP # location to build the source
fi
if [ ! -d $PKG ]; then
mkdir -p $PKG # place for the package to be built
fi
# Explode the package framework:
cd $PKG
explodepkg $CWD/_amp.tar.gz
echo "+===========+"
echo "| amp-$VERSION |"
echo "+===========+"
cd $TMP
tar xzvf $CWD/amp-$VERSION.tar.gz
cd amp-$VERSION
/configure --prefix=/usr ${ARCH}-slackware-linux
make
strip amp
cat amp > $PKG/usr/bin/amp
cat amp.1 | gzip -9c > $PKG/usr/man/man1/amp.1.gz
mkdir -p $PKG/usr/doc/amp-$VERSION
cp -a BUGS CHANGES README TODO doc/jukebox.txt doc/layer2.txt doc/linuxrealtime.txt doc/BeOS.txt $PKG/usr/doc/amp-$VERSION
chown -R root.root $PKG/usr/doc/amp-$VERSION
chmod 644 $PKG/usr/doc/amp-$VERSION/*
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/amp-$VERSION-$ARCH-$BUILD.tgz
# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/amp-$VERSION
rm -rf $PKG
fi