#!/bin/sh

CURDIR=`/bin/pwd`
RELDIR=$HOME/WWW/Software/cxxwrap
D8=`date +%Y%m%d`

cvs commit -m release
cvs tag -F t${D8}

# win32 executables, if present
if [ -r win32/Release/cxxwrap.exe ]; then
    /bin/cp -f win32/Release/cxxwrap.exe $RELDIR
fi

cd /tmp
cvs export -r t${D8} cxxwrap
/bin/rm -rf cxxwrap-${D8}
/bin/mv cxxwrap cxxwrap-${D8}
tar cvfz $RELDIR/download/cxxwrap-${D8}.tar.gz cxxwrap-${D8}

cd cxxwrap-${D8}
./configure
make
./run-test
/bin/cp -f CHANGELOG $RELDIR/CHANGELOG
/bin/cp -f LICENSE $RELDIR/LICENSE
nroff -man cxxwrap.man | col -b > $RELDIR/cxxwrap.1
/bin/rm -rf $RELDIR/examples $RELDIR/doc
/bin/cp -fr examples $RELDIR
/bin/cp -fr doc $RELDIR
cd ..
/bin/rm -rf cxxwrap-${D8}

cd $RELDIR/download
cat > index.html <<EOF
<html>
<head>
<title>cxxwrap download archive</title>
</head>
<body>
<dl>
EOF
for gz in `ls *.tar.gz`
do
cat >> index.html <<EOF
<dt><a href="$gz">$gz</a>
EOF
done
cat >> index.html <<EOF
</dl>
</body>
</html>
EOF

cd $CURDIR

