SUMMARY="A parody of the once popular coin-up fighting game, Mortal Kombat"
DESCRIPTION="Mortál Szombat is a parody of the popular coin-up game, Mortal \
Kombat. It is currently playable (maybe even enjoyable), although it is still \
under development. Only two-player game is supported, single-player games \
against computer opponent is not planned yet. There are currently 18 available \
characters, and several more in the making!"
HOMEPAGE="https://openmortal.sourceforge.net/"
COPYRIGHT="2003 the OpenMortal Team"
LICENSE="GNU GPL v2"
REVISION="3"
SOURCE_URI="https://downloads.sourceforge.net/openmortal/openmortal-$portVersion.tar.bz2"
CHECKSUM_SHA256="9c302560d71ddcd3473ba2a1022fd118cbce87a4cd4b3080cb46288a410bb710"
PATCHES="openmortal-$portVersion.patch"

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

PROVIDES="
	openmortal$secondaryArchSuffix = $portVersion
	app:OpenMortal = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libperl
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_gfx$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libSDL_net_1.2$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_gfx$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_mixer_1.2$secondaryArchSuffix
	devel:libSDL_net_1.2$secondaryArchSuffix
	devel:libSDL_ttf_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:sed
	"

defineDebugInfoPackage openmortal$secondaryArchSuffix \
	"$appsDir/OpenMortal"

PATCH()
{
	sed -i 's/CChallengeMenu::CChallengeMenu/CChallengeMenu/g' src/OnlineChat.cpp
	sed -i "s|require '\([A-Z].*\)'|require './\1'|g" data/script/*
	sed -i "s|require 'DataHelper.pl'|require '../script/DataHelper.pl'|g" data/characters/*.pl
}

BUILD()
{
	runConfigure --omit-dirs "docDir dataRootDir" \
		./configure --build=x86 --host=
	make $jobArgs
}

INSTALL()
{
	make install
	install -m 755 -d "$appsDir"
	mv "$binDir/openmortal" "$appsDir/OpenMortal"
	addAppDeskbarSymlink "$appsDir/OpenMortal"
}
