#!/bin/sh

#
# Modification History
#
# 2007-November-12   Jason Rohrer
# Copied from Cultivation build.
#


if [ $# -lt 3 ] ; then
   echo "Usage: $0 release_name unix_platform_name path_to_SDL.framework"
   exit 1
fi


rm -rf mac/OneLife_$1


./makeBaseDistributionFolder $1


mv base/* mac


cd ../gameSource
sh makeRegenerateCaches

cd ../build/mac/OneLife_$1


# mac version now defaults to windowed mode
# too many problems and crashes will fullscreen
echo "0" > settings/fullscreen.ini


../../../gameSource/regenerateCaches

# don't ever include bin_cache in bundles, because they are large
# and change every update
rm */bin_*cache.fcz

cd ../..


cp -r macOSX/OneLife.app mac/OneLife_$1/OneLife_$1.app
cp ../gameSource/OneLife mac/OneLife_$1/OneLife_$1.app/Contents/MacOS

rm -r mac/OneLife_$1/OneLife_$1.app/Contents/MacOS/empty.txt
rm -r mac/OneLife_$1/OneLife_$1.app/Contents/Frameworks/empty.txt

# install SDL framework
cp -r $3 mac/OneLife_$1/OneLife_$1.app/Contents/Frameworks/

cd mac


d=`date`

echo "$1 built on $d" > OneLife_$1/binary.txt


tar cf "OneLife_$1_$2.tar" OneLife_$1
gzip "OneLife_$1_$2.tar"






