#!/bin/sh
# Change this directory (HTDIG) to point to the CVS source tree
HTDIG=/home/lha/devel/htdig/cvs/htdig
VERSION=`cat $HTDIG/.version`
DISTDIR=/tmp/htdig-$VERSION

NO_DIST="autom4te.cache BETA.DIST htdig/*.conf htmerge/*.conf \
     htsearch/*.conf htfuzzy/*.conf */*.gz mailarchive \
     .\#* */.\#* */*/.\#* *~ */*~ \
     CVS */CVS */*/CVS */*/*/CVS"

echo "Releasing version: $VERSION"
echo "Date: " `date`

rm -rf $DISTDIR
cp -r $HTDIG $DISTDIR

(cd $DISTDIR; find . -name CVS | xargs rm -rf)
(cd $DISTDIR; rm -rf $NO_DIST)
# Remove execute from some file which don't need it  (Unnecessary, but neater)
(cd $DISTDIR; chmod 644 README ChangeLog* COPYING STATUS Makefile.* *.m4 */Makefile.* */*.{cc,h,c,cxx,lxx,yxx} */*.html */*.png */*.gif)
# set execute on files which need it  (Some, like test/t_url, broken in CVS)
(cd $DISTDIR; chmod 755 test/t_* {.,db}/{configure,config.guess,config.sub,install-sh,ltmain.sh,missing,mkinstalldirs} installdir/{rundig,HtFileType} contrib/*.pl contrib/*/*.pl )

cd $DISTDIR
cd ..
echo "Preparing tar.gz package"
tar czf htdig-$VERSION.tar.gz htdig-$VERSION
echo "Preparing tar.bz2 package"
tar cjf htdig-$VERSION.tar.bz2 htdig-$VERSION

