SUMMARY="Open-source clone of the original X-Com"
DESCRIPTION="OpenXcom is an open-source clone of the original UFO: Enemy \
Unknown (X-Com: UFO Defense in USA), licensed under the GPL and written in \
C++ / SDL. It was originally founded by SupSuper in February 2010, and has \
since grown into a small development team surrounded by a very supporting \
community."
HOMEPAGE="https://openxcom.org/"
COPYRIGHT="2010-2014 OpenXcom Developers"
LICENSE="GNU GPL v3"
REVISION="6"
SOURCE_URI="https://github.com/SupSuper/OpenXcom/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="45acb280010a01d60506b1c5f2951ae501c012cc6161aac470bd15c1e6981246"
SOURCE_FILENAME="OpenXcom-$portVersion.tar.gz"
SOURCE_DIR="OpenXcom-$portVersion"
PATCHES="openxcom-$portVersion.patchset"
ADDITIONAL_FILES="openxcom.rdef"

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

GLOBAL_WRITABLE_FILES="
	settings/OpenXcom directory keep-old
	"

PROVIDES="
	openxcom$secondaryArchSuffix = $portVersion
	app:OpenXcom
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libglu$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_gfx$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libyaml_cpp$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgl$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_gfx$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_mixer_1.2$secondaryArchSuffix
	devel:libyaml_cpp$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	cmake . -DCMAKE_BUILD_TYPE=Release
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	mkdir -p $settingsDir
	cp $sourceDir/bin/openxcom $appsDir/OpenXcom
	cp -r $sourceDir/bin/data $settingsDir/OpenXcom
	addResourcesToBinaries $portDir/additional-files/openxcom.rdef $appsDir/OpenXcom
	addAppDeskbarSymlink $appsDir/OpenXcom OpenXcom
}
