aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-argparse/APKBUILD
blob: 0b95426eb6dcdab669eed098cdf52fee046e8fcc (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.6.0
pkgrel=0
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 lua$_v-busted"
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="7efdfab8ec563a9e7eddc7aff760fd4d3605df2896939af3f2c80e5ed4d4e5ba45a7815057e15446d242351a6fd139d6b8da802fe318d4a4bcd69918fece53d1  lua-argparse-0.6.0.tar.gz"