#!/bin/sh
# brick-fossil-specific - Builds a specific Brick source tarball
# License:  MIT/X (for this file only)
# Revision: 110923

# This script builds a  Brick Engine source tarball for the engine and
# bindings revisions specified by  FOSREV_ENGINE and  FOSREV_BINDINGS,
# respectively.  These two parameters should be set to appropriate 10-
# hex digit codes.

FOSREV_ENGINE=14600c0438
FOSREV_BINDINGS=375f12c1f4

NUMBER=110923                   # Set this to a six-digit date
DIR=brickengine-$NUMBER
TARBALL=$DIR.tar.bz2
REPO=http://rs.tc/cgi-bin/

rm -fr $DIR                             || exit 1
mkdir  $DIR                             || exit 1
cd     $DIR                             || exit 1

fossil clone $REPO/fossil.brick-engine \
    fossil.engine                       || exit 1
fossil clone $REPO/fossil.brick-engine-bindings \
    fossil.bindings                     || exit 1

for x in engine bindings
do
    RELEASE=none
    if [ $x == engine   ]; then RELEASE=14600c0438; fi
    if [ $x == bindings ]; then RELEASE=375f12c1f4; fi

    mkdir $x                            || exit 1
    cd    $x                            || exit 1
    fossil open ../fossil.$x $RELEASE   || exit 1
    cd    ..                            || exit 1
done

rm fossil.* */_FOSSIL_                  || exit 1
cd ..                                   || exit 1

tar jcf $TARBALL $DIR                   || exit 1
rm -fr           $DIR                   || exit 1
ls -l   $TARBALL                        || exit 1
echo Done
