#!/bin/sh

WEBDIR=/www/spamassassin.apache.org
vers=3.0.x

if [ -z "$PERL" ]; then
  if [ -x /home/jm/perl584/bin/perl ]; then
    PERL=/home/jm/perl584/bin/perl
  else
    PERL=perl
  fi
fi

find . -name '.#*' -print | xargs rm -f # delete old CVS files

[ -d $WEBDIR/full/$vers ] || mkdir -p $WEBDIR/full/$vers
$PERL Makefile.PL PERL=$PERL < /dev/null
make; make text_html_doc 

rm -rf $WEBDIR/full/dist
mkdir $WEBDIR/full/dist
tar cf - --exclude=CVS --exclude='.#*'  \
         --exclude='logs' --exclude='*.tar.gz' --exclude='*.zip' \
         --exclude='*.log' --exclude='*.o' \
         --exclude='o' --exclude='out' \
         --exclude='tst' \
         --exclude='blib' --exclude='Mail-SpamAssassin-*' \
         . | ( cd $WEBDIR/full/dist ; tar xf - )
        
rm -rf $WEBDIR/full/$vers/dist
mv $WEBDIR/full/dist $WEBDIR/full/$vers/dist

( cd $WEBDIR/full/$vers/dist;
  tar cf docbak doc;
  make clean distclean;
  tar xvf docbak ; rm -f docbak
)

