aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-lpeg_patterns/APKBUILD
blob: ed06c933577a07ccb8433c965d7980efe09a4f35 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-lpeg_patterns
_pkgname=lpeg_patterns
pkgver=0.5
pkgrel=1
pkgdesc="A collection of LPEG patterns"
url="https://github.com/daurnimator/lpeg_patterns"
arch="noarch"
license="MIT"
depends="lua-lpeg"
checkdepends="lua-busted"
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/daurnimator/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

# luajit is not available for selected arches
case "$CARCH" in
	s390x|aarch64) _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"

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

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

_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"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$pkgver-1"

	cd "$builddir"
	mkdir -p "$lmod_dir"
	cp -r $_pkgname "$lmod_dir"/

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

sha512sums="74e36083872cfa7ff8bb03927d075680b490b4d7ba55cee0cad7e1e27e6744809b05286a80967a19cd79f526168f53d362efa2b87c318efad726fa1ba3708f80  lua-lpeg_patterns-0.5.tar.gz"