#!/bin/sh

if [ $# -ne 1 ] && [ $# -ne 2 ]; then
	echo "Simple packaging file for the source."
	echo ""
	echo "Use in the root directory of the game, like so:"
	echo "   scripts/pkg_src <name of of release, e.g. angband-4.0.1> [<output filename>]"
	echo ""

	exit 1
fi
  
DIR=$1
if [ $# -eq 1 ]; then
	OUT=$1.tar.gz
else
	OUT=$2
fi

svn export . $DIR &&
	cd $DIR &&
	rm -rf debian &&
	./autogen.sh &&
	rm -rf autogen.sh autom4te.cache &&
	cd .. &&
	tar czvf $OUT $DIR
