SUMMARY="Open source clone of Theme Hospital"
DESCRIPTION="
CorsixTH aims to reimplement the game engine of Theme Hospital, and be able to
load the original game data files. This means that you will need a purchased
copy of Theme Hospital, or a copy of the demo, in order to use CorsixTH. After
most of the original engine has been reimplemented in open source code, the
project will serve as a base from which extensions and improvements to the
original game can be made.
"
HOMEPAGE="http://github.com/CorsixTH"
SRC_URI="https://github.com/CorsixTH/CorsixTH/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="4947ebdc50b01fde0aca797250d50b9806b9e6f3f4323872fd914f033f4c92e7"
SRC_FILENAME="CorsixTH-$portVersion.tar.gz"
REVISION="1"
ARCHITECTURES="x86"
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="
	corsix_th = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libsdl$secondaryArchSuffix
	lib:libsdl_mixer$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libluajit_5.1$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	devel:libsdl$secondaryArchSuffix
	devel:libsdl_mixer$secondaryArchSuffix
	devel:libavcodec$secondaryArchSuffix
	devel:libluajit_5.1$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:make
	cmd:cmake
	cmd:pkg_config$secondaryArchSuffix
	"

SOURCE_DIR="CorsixTH-$portVersion"
PATCHES="corsix_th-$portVersion.patchset"
BUILD()
{
	cmake . -DLUA_LIBRARY=/system/$relativeLibDir/libluajit-5.1.so.2.0.2 \
		-DCMAKE_INSTALL_PREFIX=$appsDir
	cd CorsixTH
	make $jobArgs
}

INSTALL()
{
	touch CorsixTH/LICENSE.txt
	make install

	addattr -f Icon_Haiku -t "'VICN'" "BEOS:ICON" $appsDir/CorsixTH/CorsixTH
	addAppDeskbarSymlink $appsDir/CorsixTH/CorsixTH "Corsix Theme Hospital"
}

# no TEST script available

COPYRIGHT="2005-2013 Corsix"
LICENSE="MIT"
