aboutsummaryrefslogblamecommitdiffstats
path: root/community/moonscript/APKBUILD
blob: 9db853815cc1fac6e811748fd1b6b0d45101a63c (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                                               
        




                                                
                                




                                                                                           


                                                              
                                                                        
















                                                                          
                                                 































                                                                                                                                                                      
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=moonscript
pkgver=0.5.0
pkgrel=1
pkgdesc="A language that compiles to Lua"
url="http://moonscript.org"
arch="noarch"
license="MIT"
depends="lua-alt-getopt lua-filesystem lua-lpeg"
checkdepends="lua-busted luajit"
makedepends="luarocks"
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/leafo/$pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

_luaversions="5.1 5.2 5.3"
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

	cd "$builddir"
	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() {
	cd "$builddir"

	local lver; for lver in $_luaversions; do
		msg "Testing on lua$lver"
		lua$lver /usr/bin/busted
	done
}

package() {
	cd "$builddir"

	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"