# Template file for 'lua54-cassowary'
pkgname=lua54-cassowary
version=2.3.2
revision=1
hostmakedepends="lua54 lua53 lua52 lua51 luarocks-lua54"
makedepends="lua54-devel lua53-devel lua52-devel lua51-devel"
depends="lua54 lua54-penlight"
short_desc="Cassowary constraint solver"
maintainer="Luciogi <githubvoidlinux.supremacy429@passinbox.com>"
license="MIT"
homepage="https://github.com/sile-typesetter/lua-cassowary"
distfiles="https://github.com/sile-typesetter/cassowary.lua/archive/refs/tags/v${version}.tar.gz"
checksum=20fe7309f59004ce59e6c65d69ed9993de907267fd0314fc224f40e017d59798

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

do_install() {
	_pkg 5.4
	vlicense LICENSE
}

lua51-cassowary_package() {
	metapackage=yes
	depends="lua51 lua51-penlight"
	pkg_install() {
		_pkg 5.1
		vlicense LICENSE
	}
}

lua52-cassowary_package() {
	metapackage=yes
	depends="lua52 lua52-penlight"
	pkg_install() {
		_pkg 5.2
		vlicense LICENSE
	}
}

lua53-cassowary_package() {
	metapackage=yes
	depends="lua53 lua53-penlight"
	pkg_install() {
		_pkg 5.3
		vlicense LICENSE
	}
}
