# Template file for 'lua52-compat53'
pkgname=lua52-compat53
version=0.13
revision=1
hostmakedepends="lua52 lua51 luarocks-lua52"
makedepends="lua52-devel lua51-devel"
depends="lua52"
short_desc="Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1"
maintainer="Luciogi <githubvoidlinux.supremacy429@passinbox.com>"
license="MIT"
homepage="https://github.com/lunarmodules/lua-compat5.3"
distfiles="https://github.com/lunarmodules/lua-compat-5.3/archive/refs/tags/v${version}.tar.gz"
checksum=f5dc30e7b1fda856ee4d392be457642c1f0c259264a9b9bfbcb680302ce88fc2

_rockname=${pkgname#lua52-}
_rocksrel=1
_package() {
	luarocks --lua-version="$1" --tree="${PKGDESTDIR}/usr/" LUA_INCDIR="${XBPS_CROSS_BASE}/usr/include/lua$1" \
		make --deps-mode=none --no-manifest "rockspecs/${_rockname}-${version}-${_rocksrel}.rockspec"
}

do_install() {
	_package 5.2
	vlicense LICENSE
}

lua51-compat53_package() {
	build_style=meta
	depends="lua51"
	pkg_install() {
		_package 5.1
	}
}
