SUMMARY="City simulation game"
DESCRIPTION="LinCity-NG is a city simulation game. It is a polished and \
improved version of the classic LinCity game. In the game, you are required to \
build and maintain a city. You can win the game either by building a \
sustainable economy or by evacuating all citizens with spaceships."
HOMEPAGE="https://github.com/lincity-ng/lincity-ng"
COPYRIGHT="1995-1997 I J Peters
	1997-2001 Greg Sharp
	2004 Corey Keasling
	2005-2019 Matthias Braun"
LICENSE="GNU GPL v2"
REVISION="2"
srcGitRev="35ffbacb5308a8e825fd737bd08d95032d6c4c8c"
SOURCE_URI="$HOMEPAGE/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="8cb5ce1d98374a656d36c7feb7764a6275e6a6840dc0c5630a997e0a1edbbe43"
SOURCE_FILENAME="lincity_ng-$srcGitRev.tar.gz"
SOURCE_DIR="lincity-ng-$srcGitRev"
PATCHES="lincity_ng-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	lincity_ng$secondaryArchSuffix = $portVersion
	app:Lincity_NG = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libphysfs$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_gfx$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libphysfs$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_gfx$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_mixer_1.2$secondaryArchSuffix
	devel:libSDL_ttf_2.0$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:jam
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage lincity_ng$secondaryArchSuffix \
	"$appsDir/LinCity-NG"

BUILD()
{
	grep -v "@" data/gui/creditslist.xml |
		cut -d\> -f2 | cut -d\< -f1 >CREDITS
	echo "# automatically generated from data/gui/creditslist.xml." \
		"Do not edit. #" >>CREDITS
	./autogen.sh
	runConfigure ./configure --build=x86
	jam $jobArgs
}

INSTALL()
{
	jam install

	install -m 755 -d "$appsDir" "$docDir"
	mv "$binDir/lincity-ng" "$appsDir/LinCity-NG"
	mv "$dataDir/doc"/*/* "$docDir"
	rm -rf "$binDir" \
		"$dataDir/doc" "$dataDir/applications" "$dataDir/pixmaps"
	addAppDeskbarSymlink "$appsDir/LinCity-NG"
}
