# Template file for 'lua54-vstruct'
pkgname=lua54-vstruct
version=2.2.0
revision=1
metapackage=yes
hostmakedepends="luarocks-lua54"
depends="lua54"
short_desc="Lua library to manipulate binary data"
maintainer="Luciogi <githubvoidlinux.supremacy429@passinbox.com>"
license="MIT"
homepage="https://github.com/ToxicFrog/vstruct"
distfiles="https://github.com/ToxicFrog/vstruct/archive/refs/tags/v${version}.tar.gz"
checksum=54ade004665b62b2253d403f3e468631caa486a45a2b873818e55097e7b679bf

_lua_versions="lua5.1 lua5.2 lua5.3 lua5.4"
for _lua_version in $_lua_versions; do
	hostmakedepends+=" ${_lua_version/./}"
	makedepends+=" ${_lua_version/./}-devel"
done

_rockname=${pkgname#lua54-}
_rocksrel=1
_pkg() {
	luarocks --lua-version="$1" --tree="${PKGDESTDIR}/usr/" \
		make --deps-mode=none --no-manifest "${_rockname}-${version}-${_rocksrel}.rockspec"
}

do_install() {
	_pkg 5.4
	vlicense COPYING
}

lua53-vstruct_package() {
	depends="lua53"
	pkg_install() {
		_pkg 5.3
		vlicense COPYING
	}
}

lua52-vstruct_package() {
	depends="lua52"
	pkg_install() {
		_pkg 5.2
		vlicense COPYING
	}
}

lua51-vstruct_package() {
	depends="lua51"
	pkg_install() {
		_pkg 5.1
		vlicense COPYING
	}
}
