#!/bin/sh

version=3-3-1

resources="paintown-$version.app/Contents/Resources"

if [ ! -f paintown-static ]; then
	echo "Cannot find the 'paintown-static' binary. Please build the static version of paintown first using scons or cmake"
	exit 0
fi
if [ ! -f editor/editor.jar ]; then
	echo "Cannot find 'editor/editor.jar'. Please build the editor using ant."
fi

cp paintown-static paintown-$version
rm -rf paintown-$version.app
fixbundle paintown-$version -v $version -V "Paintown $version"
cp scripts.zip $resources
cp editor/editor.jar $resources
cp editor/run.sh $resources
(cd $resources; svn export https://paintown.svn.sf.net/svnroot/paintown/data; rm -rf $resources/graveyard)
buildDMG.pl -compressionLevel 9 -dmgName paintown-$version paintown-$version.app/
echo "Created paintown-$version.dmg"
ls -l paintown-$version.dmg
