# Template file for 'minetest'
pkgname=minetest
version=5.6.1
revision=1
_irrlichtversion=1.9.0mt8
create_wrksrc=yes
build_wrksrc="${pkgname}-${version}"
build_style=cmake
configure_args="-DBUILD_SERVER=TRUE -DVERSION_EXTRA=_${revision}"
hostmakedepends="pkg-config gettext"
makedepends="MesaLib-devel freetype-devel gmp-devel libcurl-devel
 libjpeg-turbo-devel libopenal-devel libvorbis-devel lua52-devel
 sqlite-devel libXi-devel"
depends="desktop-file-utils hicolor-icon-theme"
short_desc="InfiniMiner/Minecraft inspired game"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-or-later"
homepage="https://www.minetest.net"
changelog="https://dev.minetest.net/Changelog"
distfiles="https://github.com/minetest/minetest/archive/${version}.tar.gz
 https://github.com/minetest/minetest_game/archive/${version}.tar.gz>minetest_game-${version}.tar.gz
 https://github.com/minetest/irrlicht/archive/refs/tags/${_irrlichtversion}.tar.gz"
checksum="1440603e19dca70e2691e86a74c822ee2c4a36fceee32b2d85ae74772149e9a3
 5dc857003d24bb489f126865fcd6bf0d9c0cb146ca4c1c733570699d15abd0e3
 27594242da8c7cc1e5ef45922e1dfdd130c37d77719b5d927359eb47992051e0"

# LuaJIT enabled causes PIE to
# be broken/not-used on aarch64*
case "$XBPS_TARGET_MACHINE" in
	aarch64*) ;;
	*) makedepends+=" LuaJIT-devel" ;;
esac

post_extract() {
	mv minetest_game-${version} "${build_wrksrc}/games/minetest_game"
	mv irrlicht-${_irrlichtversion} "${build_wrksrc}/lib/irrlichtmt"
}
