aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-toml/APKBUILD
blob: fe2dfdb4c80e3ddc26bae75efb9b39bb720a2a53 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-toml
pkgver=1.0
pkgrel=5
pkgdesc="TOML decoder/encoder for Lua"
url="https://github.com/jonstoler/lua-toml"
arch="noarch"
license="Happy"
depends=""
checkdepends="lua-busted"
source="$pkgname-$pkgver.tar.gz::https://github.com/jonstoler/$pkgname/archive/v$pkgver.tar.gz
	fix-decode-arrays-and-include-testcase.patch"
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
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
	checkdepends="$checkdepends lua$_v"
done

check() {
	cd "$builddir"

	local lver; for lver in $_luaversions $_luajit; do
		msg "Testing on lua$lver"
		lua$lver /usr/bin/busted || return 1
	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"

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

sha512sums="f04ed6f26f47d6492c7a21c310da09b1091476724022c32b81a5492713340a4571bc04c51f34dded73f4f1cf1085dbe08e280356b0f1fa88ef0efefd0685c77e  lua-toml-1.0.tar.gz
8f09e578ef3e7bcc35316ca290e21a47b2d62b439a06228c7e6dcef14e3306800aa44d8b4d70ff2e1cf17211bf7e585423bb4fcd9edb4131076532d4bf5b0640  fix-decode-arrays-and-include-testcase.patch"