aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-argparse/APKBUILD
blob: d9b9426b3ecdef09d091e7f2baa5aec75df6abdd (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
55
56
57
58
59
60
61
62
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-argparse
_pkgname=argparse
pkgver=0.5.0
pkgrel=1
pkgdesc="Feature-rich command line parser for Lua"
url="https://github.com/mpeterv/argparse"
arch="noarch"
license="MIT"
depends=""
checkdepends="lua-busted"
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/mpeterv/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

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

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

check() {
	cd "$builddir"
	mkdir .bin

	local lver; for lver in $_luaversions $_luajit; do
		msg "Testing on lua$lver"

		ln -sf /usr/bin/lua$lver .bin/lua
		LUA_PATH="$builddir/src/?.lua;;" \
			PATH="$builddir/.bin:$PATH" \
			lua /usr/bin/busted
	done
}

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

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc $lver"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"

	cd "$builddir"
	install -D -m 644 src/argparse.lua \
		"$subpkgdir"/usr/share/lua/$lver/argparse.lua

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

sha512sums="29ab0d53a985fee135ff8f4237129df338b9fcea3da7c10450bab8de4f7fde64f96bf863c97dc403388c21551a66280049c6f49531c5ea483f3fa0801e685422  lua-argparse-0.5.0.tar.gz"