#!/bin/sh
#
#  Generate BIRD Distribution Archive
#  (c) 2000 Martin Mares <mj@ucw.cz>
#

set -e
autoconf
./configure
make distclean
autoconf
( cd doc ; make docs ; make clean )
VERSION=`sed <sysdep/config.h '/BIRD_VERSION/!d;s/^.*"\(.*\)"$/\1/'`
REL=bird-$VERSION
DREL=bird-doc-$VERSION
echo Building $REL
rm -rf dist
mkdir -p dist/$REL dist/$DREL/doc
cp -a . dist/$REL
scp -C atrey.karlin.mff.cuni.cz:~mj/BIRD/CVSROOT/ChangeLog dist/$REL
mv dist/$REL/doc/*.ps dist/$DREL/doc
rm -f dist/$REL/bird.conf
rm -rf `find dist/$REL -name CVS -o -name tmp` dist/$REL/{dist,misc,rfc,doc/slides}
( cd dist ; tar czvvf /tmp/$REL.tar.gz $REL )
( cd dist ; tar czvvf /tmp/$DREL.tar.gz $DREL )
rm -rf dist
echo Uploading to Atrey...
scp /tmp/$REL.tar.gz /tmp/$DREL.tar.gz atrey.karlin.mff.cuni.cz:~ftp/pub/bird/
echo Uploading to Regina...
scp /tmp/$REL.tar.gz /tmp/$DREL.tar.gz regina.gin.cz:~ftp/pub/bird/
echo Done.