SUMMARY="A transportation simulation game"
DESCRIPTION="Simutrans is a freeware and open-source transportation \
simulator. Your goal is to establish a successful transport company. \
Transport passengers, mail and goods by rail, road, ship, and even air. \
Interconnect districts, cities, public buildings, industries and \
tourist attractions by building a transport network you always dreamed \
of."
HOMEPAGE="http://www.simutrans.com"
COPYRIGHT="1997-2004 Hansjörg Malthaner
	2005-2022 The Simutrans Team"
LICENSE="Artistic"
REVISION="1"
SvnRevision="10421"
SOURCE_URI="https://sourceforge.net/projects/simutrans/files/simutrans/123-0-1/simutrans-src-123-0-1.zip"
CHECKSUM_SHA256="8deb38c8de41fb5558640cdd4b9b161c38de92c077b3e506f74c34f93214f469"
SOURCE_FILENAME="simutrans-$portVersion.zip"
SOURCE_DIR=""
PATCHES="simutrans-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"

PROVIDES="
	simutrans$secondaryArchSuffix = $portVersion
	app:simutrans$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	simutrans_pakset >= 120.4
	timgmsoundfont
	lib:libbz2$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libgraphite2$secondaryArchSuffix
	lib:libharfbuzz$secondaryArchSuffix
	lib:libltdl$secondaryArchSuffix
	lib:libminiupnpc$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_mixer_2.0$secondaryArchSuffix
	lib:libtxc_dxtn$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbz2$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libgraphite2$secondaryArchSuffix
	devel:libharfbuzz$secondaryArchSuffix
	devel:libltdl$secondaryArchSuffix
	devel:libminiupnpc$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libSDL2_mixer_2.0$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:g++$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sdl2_config$secondaryArchSuffix >= 2.0
	cmd:strip$secondaryArchSuffix
	"

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

BUILD()
{
	autoreconf configure.ac
	export CFLAGS+=-DREVISION=$SvnRevision
	runConfigure ./configure
	make $jobArgs
	strip sim
}

INSTALL()
{
	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"
}
