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."
HOMEPAGE="http://www.simutrans.com"
SOURCE_URI="http://sourceforge.net/projects/simutrans/files/simutrans/120-0-1/simutrans-src-120-0-1.zip"
CHECKSUM_SHA256="010a6e3765891e1821364e54f6bcdfb2911b627ffca3acae8350e06e53113683"
SOURCE_FILENAME="simutrans-$portVersion.zip"
SOURCE_DIR=""
COPYRIGHT="1997-2004 Hj. Malthaner
	2005-2014 The Simutrans Team"
LICENSE="Artistic"
REVISION="1"
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"
PATCHES="simutrans-$portVersion.patchset"
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 == $portVersion
	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:make
	cmd:ld$secondaryArchSuffix
	cmd:strip$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	"

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

BUILD()
{
	chmod +x configure.sh
	runConfigure ./configure.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"
}
