#!/bin/sh
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-jam
VERSION=2.5
ARCH=alpha
BUILD=2

rm -rf $PKG
mkdir -p $PKG
( cd $TMP
rm -rf jam-$VERSION
tar xjf $CWD/jam-$VERSION.tar.bz2
cd jam-$VERSION
chown -R root:root .
make || exit
mkdir -p $PKG/usr/doc/jam-$VERSION $PKG/usr/bin $PKG/usr/lib
cp -a *.html R* P* $PKG/usr/doc/jam-$VERSION
cd bin.linuxaxp
cp -a jam $PKG/usr/bin
chmod 755 $PKG/usr/bin/*
cp libjam.a $PKG/usr/lib
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
makepkg -l y -c n $TMP/jam-$VERSION-$ARCH-$BUILD.tgz
) 2>&1 | tee $TMP/jam.build.log
