SUMMARY="A port of TyrQuake, a Quake 1 engine, to the libretro architecture"
DESCRIPTION="TyrQuake is a fork of the Quake engine, also known as ID tech 2. \
It supports Quake and Quakeworld in both software and GL versions. Its goal \
is to allow running Quake on modern systems as accurately as the original game \
but provides smoother model animations, coloured lighting, fullbrights in \
GLQuake, along other improvements."
HOMEPAGE="https://disenchant.net/tyrquake/"
COPYRIGHT="2003-2021 Kevin Shanahan, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="905e7d0b620061a0fc1ddafb4288ef2f251f021c"
SOURCE_URI="https://github.com/libretro/tyrquake/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="4d01e75dfbb439e344ea1dcdc4609e9982eaf39d8b1b7eb7fe3abb6b6e3d5f1a"
SOURCE_FILENAME="libretro-tyrquake-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="tyrquake-$srcGitRev"
PATCHES="tyrquake_libretro-0.62_20211207.patchset"
ADDITIONAL_FILES="tyrquake_libretro.info.in"

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

PROVIDES="
	tyrquake_libretro$secondaryArchSuffix = $portVersion
	addon:tyrquake_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/tyrquake_libretro.info.in \
		> tyrquake_libretro.info
	make $jobArgs clean && \
	make $jobArgs
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" readme.txt readme-id.txt
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		tyrquake_libretro.info \
		tyrquake_libretro.so
}
