aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-fun/APKBUILD
blob: 6865f0c2cf83e0ffe8b8211cf9ccfee7f45af0aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Contributor: Michael Zuo <muh.muhten@gmail.com>
# Maintainer: Michael Zuo <muh.muhten@gmail.com>
pkgname=lua-fun
_pkgname=luafun
pkgver=0.1.3
pkgrel=5
pkgdesc="Functional programming library"
url="http://rtsisyk.github.io/luafun/"
arch="noarch"
license="MIT"
depends=""
makedepends=""
checkdepends=""
source="$pkgname-$pkgver.tar.gz::https://github.com/rtsisyk/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

# luajit is not available for selected arches
case "$CARCH" in
	ppc64le | s390x) _luajit="";;
	*) checkdepends="$checkdepends luajit" _luajit="jit";;
esac

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

check() {
	cd "$builddir"

	local lver; for lver in $_luaversions $_luajit; do
		msg "Testing on Lua $lver"
		lua$lver tests/runtest tests/*.lua || return 1
	done
}

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc for Lua $lver"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"

	cd "$builddir"
	install -m 644 -D fun.lua "$subpkgdir"/usr/share/lua/$lver/fun.lua
}

md5sums="ab774af3d0dea06656039e5fc3ee86ad  lua-fun-0.1.3.tar.gz"
sha256sums="b17a139e94a150595ffce09e800035f71fe9e0631b54b6fbf193dfe57255e4b7  lua-fun-0.1.3.tar.gz"
sha512sums="1959c22453a6f431e4f4ee1ca1e6001c126f8857e00b128e5303049fd574150a68b71490503356f11fefcbd0ef7fbac7b0ae7c182a395ad0c92d2047dfac0662  lua-fun-0.1.3.tar.gz"