# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-stdlib-normalize
_rockname=std.normalize
pkgver=2.0.1
pkgrel=1
pkgdesc="Normalized Lua functions"
url="https://lua-stdlib.github.io/normalize/"
arch="noarch"
license="MIT"
depends="lua lua-stdlib-debug"
provides=""
options="!check"  # FIXME: requires lua-specl that we don't have yet
source="$pkgname-$pkgver.tar.gz::https://github.com/lua-stdlib/normalize/archive/v$pkgver.tar.gz"
builddir="$srcdir/normalize-$pkgver"

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"  # for backward compatibility
done

package() {
	local lmod_dir="$pkgdir/usr/share/lua/common"
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	mkdir -p "$lmod_dir"
	cp -r "$builddir"/lib/std "$lmod_dir"/

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="a5dd11d65f613c16dfaae59703f1c296a6d74a56e6dfd12c0e288fa60bb0a344474922a0fe298a8a77d1d18672f45d21c12e1b3fb2ef6b306687975de336cb5c  lua-stdlib-normalize-2.0.1.tar.gz"
