#
# This script is run from the top level scripts.  You can rely on
# the following environment variables being set:
#
#    $BMTARBALL  - relative path to the release source tarball (bz2)
#    $BMTARBASE  - basename of the source tarball (bz2)
#    $BMBUILDDIR - directory to place resulting binary package tree
#

set -e

#
# Build the local DEB's
#
rm -rf /tmp/bmbuildlocaldeb
mkdir /tmp/bmbuildlocaldeb
tar -C /tmp/bmbuildlocaldeb -xjvf "$BMTARBALL"
(cd /tmp/bmbuildlocaldeb/binary-meta* && make -j2 debian-all)
mkdir -p "$BMBUILDDIR/dists/squeeze/main/binary-i386"
mv /tmp/bmbuildlocaldeb/binary-meta*/debian/*.deb "$BMBUILDDIR/dists/squeeze/main/binary-i386"


#
# Cleanup
#
rm -rf /tmp/bmbuildlocaldeb

