SUMMARY="A turn-based strategy engine"
DESCRIPTION="LGeneral is a turn-based strategy engine heavily inspired by Panzer General. \
You play single scenarios or whole campaigns turn by turn against a human \
player or the AI. Entrenchment, rugged defense, defensive fire, surprise \
contacts, surrender, unit supply, weather influence, reinforcements and other \
implementations contribute to the tactical and strategic depth of the game."
HOMEPAGE="http://lgames.sourceforge.net/"
COPYRIGHT="2000, 2001 Michael Speck, Leo Savernik, Peter Ivanyi"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="http://downloads.sourceforge.net/project/lgeneral/lgeneral/lgeneral-1.2.3.tar.gz"
CHECKSUM_SHA256="55d17bb173c956c705b94bc8a6399d5311b3ec82c9f1821a97fe9ec45da0d9a1"
SOURCE_URI_2="http://prdownloads.sourceforge.net/lgeneral/pg-data.tar.gz"
CHECKSUM_SHA256_2="cc6fa5d263d1d5824d706517958b1bb09b405ba0ed21e63e4a4d38e2727d7a04"
PATCHES="lgeneral-1.2.3.patchset"

ARCHITECTURES="?all x86_gcc2"

PROVIDES="
	lgeneral = $portVersion
	cmd:lgc_pg = $portVersion
	cmd:lged = $portVersion
	cmd:lgeneral = $portVersion
	cmd:ltrextract = $portVersion
	cmd:shptool = $portVersion
	"
REQUIRES="
	haiku
	lib:libsdl
	lib:libsdl_mixer
	lib:libsdl_net_1.2
	"

BUILD_REQUIRES="
	haiku_devel
	devel:libintl
	devel:libsdl
	devel:libsdl_mixer
	devel:libsdl_net_1.2
	"
BUILD_PREREQUIRES="
	cmd:gcc
	cmd:ld
	cmd:libtoolize
	cmd:make
	"

BUILD()
{
	libtoolize --force --copy --install
	runConfigure ./configure --disable-nls

	mkdir -p pg-data
	cp ../../sources-2/pg-data/* ./pg-data/

	make $jobArgs
}

INSTALL()
{
	make install

	rm -rf $dataDir/applications
	rm -rf $dataDir/icons

	$binDir/lgc-pg -s ./pg-data
	addAppDeskbarSymlink $binDir/lgeneral LGeneral
}
