# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka pkgname=moonscript pkgver=0.5.0 pkgrel=3 pkgdesc="A language that compiles to Lua" url="https://moonscript.org" arch="noarch" license="MIT" depends="lua-alt-getopt lua-filesystem lua-lpeg" checkdepends="lua-busted" makedepends="luarocks" source="$pkgname-$pkgver.tar.gz::https://github.com/leafo/moonscript/archive/v$pkgver.tar.gz" _luaversions="5.1 5.2 5.3 5.4" for _v in $_luaversions; do subpackages="$subpackages lua$_v-$pkgname:_subpackage" checkdepends="$checkdepends lua$_v lua$_v-busted lua$_v-loadkit" done prepare() { default_prepare local lver; for lver in $_luaversions; do local name; for name in moon moonc; do sed "s|^#!/usr/bin/env lua|#!/usr/bin/lua$lver|" \ bin/$name > bin/$name-$lver done done } check() { local lver; for lver in $_luaversions; do msg "Testing on lua$lver" lua$lver /usr/bin/busted done } package() { local name; for name in moon moonc; do install -D -m 755 bin/$name "$pkgdir"/usr/bin/$name done } _subpackage() { local lver="${subpkgname:3:3}" pkgdesc="$pkgdesc (for Lua $lver)" depends="lua$lver ${depends//lua-/lua$lver-}" install_if="$pkgname=$pkgver-r$pkgrel lua$lver" local lmod_dir="$subpkgdir/usr/share/lua/$lver" cd "$builddir" mkdir -p "$lmod_dir" cp -r moon moonscript moon.lua moonscript.lua "$lmod_dir"/ find "$lmod_dir" -name "*.moon" -delete local name; for name in moon moonc; do install -D -m 755 bin/$name-$lver "$subpkgdir"/usr/bin/$name-$lver done } sha512sums=" f573f9a96502662987de637f7f62b935fab93aa775122c9ae20d98029394e3136e6b519908ce76e1e77c51fbcee162c3ad0aa58eeb1ee56a2b07951437987941 moonscript-0.5.0.tar.gz "