SUMMARY="A port of Craft, a Minecraft clone, to the libretro architecture"
DESCRIPTION="A very performant Minecraft clone written in just a few thousand \
lines of C using modern OpenGL (shaders). Online multiplayer support is \
included using a Python-based server. Many people have used this as a base \
upon which a more complex game was built."
HOMEPAGE="https://www.michaelfogleman.com/projects/craft/"
COPYRIGHT="2014-2020 Michael Fogleman, the libretro team"
LICENSE="MIT"
REVISION="1"
srcGitRev="d0de2c6d3ff9d971d5c23c796bcb208498f635a9"
SOURCE_URI="https://github.com/libretro/Craft/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="8ecbcc926e8d01a88f3ece652c0a318753513dd357b669e50b590045e8081206"
SOURCE_FILENAME="libretro-craft-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="Craft-$srcGitRev"
ADDITIONAL_FILES="craft_libretro.info.in"

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

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

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

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/craft_libretro.info.in \
		> craft_libretro.info
	make -f Makefile.libretro $jobArgs GIT_VERSION=${srcGitRev:0:7}
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" README.md LICENSE.md
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		craft_libretro.info \
		craft_libretro.so
}
