SUMMARY="A port of Star Control II"
DESCRIPTION="The project started in August 2002, when Toys For Bob released \
the partially ported sources of Star Control 2 3DO version to the fan \
community. Our goal is to port this wonderful game to current personal \
computers and operating systems.
It is and will remain 100% free of charge, and anyone can contribute to the \
project and thus help make it even better. For more information, look at \ ourinfo page."
HOMEPAGE="http://sc2.sourceforge.net/"
COPYRIGHT="2005-2013 VCMI Team"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://prdownloads.sourceforge.net/sc2/uqm-0.7.0-source.tgz"
CHECKSUM_SHA256="a3695c5f7f0be7ec9c0f80ec569907b382023a1fee6e635532bd53b7b53bb221"
PATCHES="uqm-$portVersion.patchset"

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"

PROVIDES="
	uqm$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libsdl_image$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libmikmod$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libSDL$secondaryArchSuffix
	devel:libsdl_image$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libmikmod$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:as$secondaryArchSuffix
	cmd:sed
	cmd:make
	cmd:tr
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	sed -i -e"s!PREFIX_HERE!$prefix!" config.state
	./build.sh uqm reprocess_config
	./build.sh uqm
}

INSTALL()
{
	./build.sh uqm install
}
