#!/bin/sh

# Make the final release from a clean SVN checkout to avoid including
# unnecessary garbage!

echo clean

make -s clean

rm -rf scowl-$1
rm -f scowl-$1.*

echo levels

rm l/levels-list 2> /dev/null
ls --full-time -R -F l | sed 's/^.*kevina.*[-+]0... /  /' | sed '/total/d' > l.dir
tar -c -f l.tar l/

echo copy

mkdir scowl-$1
 
mkdir scowl-$1/r/
cp r/README scowl-$1/r/
cp -a r/special scowl-$1/r/

BASE=`pwd`

cd r/
for d in `ls -I README -I special -I ATTIC`
do
  echo ... r/$d
  cd $d
  mkdir $BASE/scowl-$1/r/$d/
  cp `cat .keep` $BASE/scowl-$1/r/$d/
  cd $BASE/r
done
cd ..

cp -a README README.in Makefile mk-list Copyright l.dir l.tar src final misc speller scowl-$1/

echo tar
tar cf scowl-$1.tar scowl-$1/
gzip -9 scowl-$1.tar

echo zip
cd scowl-$1
rm speller/final speller/misc speller/src
zip -q9lr ../scowl-$1.zip *

