aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-penlight/APKBUILD
blob: 641b01fd26a83860e232081d03b78610ccac5159 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-penlight
_rockname=penlight
pkgver=1.5.4
pkgrel=1
pkgdesc="Lua libraries for extended operations on tables, lists and strings"
url="http://stevedonovan.github.io/Penlight"
arch="noarch"
license="MIT"
depends="lua"
checkdepends="lua-filesystem"
provides="$pkgname-shared=$pkgver-r$pkgrel"  # for backward compatibility
replaces="$pkgname-shared"  # for backward compatibility
subpackages="$pkgname-doc"
source="$_rockname-$pkgver.tar.gz::https://github.com/stevedonovan/Penlight/archive/$pkgver.tar.gz"
builddir="$srcdir/Penlight-$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
	checkdepends="$checkdepends lua$_v"
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"  # for backward compatibility
done

check() {
	cd "$builddir"

	local lver; for lver in $_luaversions $_luajit; do
		msg "Testing on Lua $lver"
		lua$lver run.lua tests
	done
}

package() {
	local lmod_dir="$pkgdir/usr/share/lua/common"
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"
	local docdir="$pkgdir/usr/share/doc/$pkgname"

	cd "$builddir"

	mkdir -p "$lmod_dir" "$docdir"
	cp -r lua/pl "$lmod_dir"/
	cp -r examples "$docdir"/

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

sha512sums="c46e7875410a90390bfbf010a53f1d536475e2094668722618d03951caad0fcb0674c9bc7119a0753e4ed3df9e4d70fef828ba4c6c24e8ada4036948d2432519  penlight-1.5.4.tar.gz"