# Template file for 'lua54-MessagePack'
pkgname=lua54-MessagePack
version=0.5.2
revision=3
wrksrc="lua-MessagePack-${version}"
depends="lua54"
_desc="Pure Lua implementation of msgpack.org"
short_desc="${_desc} (5.4.x)"
maintainer="Tj Vanderpoel (bougyman) <tj@rubyists.com>"
license="MIT"
homepage="https://framagit.org/fperrad/lua-MessagePack"
distfiles="${homepage}/-/archive/${version}/${wrksrc}.tar.gz"
checksum=e8285b1c574fca279e7ec8c09b49073ef48a13c4a12d8db920ca50be34b07394
replaces="lua-MessagePack>=0"

do_install() {
	# Once the 5.3 version is confirmed to work completely with 5.4,
	# adjust so that we install the 5.3 version for 5.4 as well
	for luaver in 5.1 5.2 5.3 5.4; do
		vmkdir usr/share/lua/${luaver}
		if [ "$luaver" = "5.3" ]; then
			vinstall src5.3/MessagePack.lua 644 usr/share/lua/${luaver}
		else
			vinstall src/MessagePack.lua 644 usr/share/lua/${luaver}
		fi
	done
	vlicense COPYRIGHT LICENSE
}

lua51-MessagePack_package() {
	depends="lua51"
	short_desc="${_desc} (5.1.x)"
	pkg_install() {
		vlicense "${wrksrc}/COPYRIGHT" LICENSE
		vmove usr/share/lua/5.1
	}
}

lua52-MessagePack_package() {
	depends="lua52"
	short_desc="${_desc} (5.2.x)"
	pkg_install() {
		vlicense "${wrksrc}/COPYRIGHT" LICENSE
		vmove usr/share/lua/5.2
	}
}

lua53-MessagePack_package() {
	depends="lua53"
	short_desc="${_desc} (5.3.x)"
	pkg_install() {
		vlicense "${wrksrc}/COPYRIGHT" LICENSE
		vmove usr/share/lua/5.3
	}
}
