SUMMARY="Transport simulator"
DESCRIPTION="Simutrans is an open-source transportation simulation game \
available for Windows, Mac, Linux and BeOS. Your goal is to establish a \
successful transport company and build the necessary infrastructure to \
transport passengers, mail and goods between cities, factories and \
touristic attractions by land, air and water.
Nightly builds are versions only for debugging and testing. They may contain \
changes which make your savegames unreadable by any official version, or \
bugs that will destroy your game, or not even run. They are for bug testing \
only."
HOMEPAGE="http://www.simutrans.com"
SOURCE_URI="svn://tron.yamagi.org/simutrans/simutrans/trunk \
	--username=anon --password="
SOURCE_FILENAME="simutrans-$portVersion"
SOURCE_DIR="trunk"
COPYRIGHT="1997-2004 Hj. Malthaner
	2005-2015 The Simutrans Team"
LICENSE="Artistic"
REVISION="2"
ARCHITECTURES="?x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
	simutrans$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	lib:libsdl_mixer$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	simutrans_pakset$secondaryArchSuffix >= 120.0.1
	timgmsoundfont
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:svn
	cmd:curl
	cmd:autoreconf
	cmd:aclocal
	cmd:make
	cmd:ld$secondaryArchSuffix
	cmd:strip$secondaryArchSuffix
	cmd:sdl_config$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	"

GLOBAL_WRITABLE_FILES="
	non-packaged/$relativeAppsDir/simutrans/config directory keep-old
	"

BUILD()
{
	autoreconf configure.ac
	runConfigure ./configure
	./get_lang_files.sh
	make $jobArgs
	strip sim
}

INSTALL()
{
	fixPkgconfig
	cp sim simutrans/simutrans
	mkdir -p $appsDir/simutrans
	mkdir -p $prefix/non-packaged/$relativeAppsDir/simutrans/config
	cp -r  simutrans $appsDir/
	mv  $appsDir/simutrans/config \
		$prefix/non-packaged/$relativeAppsDir/simutrans/
	ln -s $prefix/non-packaged/$relativeAppsDir/simutrans/config \
		$appsDir/simutrans/config

	addAppDeskbarSymlink $appsDir/simutrans/simutrans "Simutrans"
}
