aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-jsonschema/APKBUILD
blob: ae8373142eccbd6dbb5dee1616e05fa2cd800e1e (plain) (blame)
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
# Maintainer: Guilherme Felipe da Silva <gfsilva.eng@gmail.com>
pkgname=lua-jsonschema
_rockname=${pkgname#lua-}
pkgver=0.9
pkgrel=0
pkgdesc="Pure Lua JSON schema validator for Lua/LuaJIT"
url="https://github.com/iresty/jsonschema"
license="MIT"
arch="noarch"
depends="lua-net-url lua-rex-pcre"
makedepends="luarocks"
options="!check" # Test dependencies not available
source="$_rockname-$pkgver.tar.gz::https://github.com/iresty/jsonschema/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_rockname-$pkgver"
_luaversions="5.1 5.2 5.3"

for _luaversion in $_luaversions; do
	makedepends="$makedepends lua$_luaversion-dev"
	subpackages="$subpackages lua$_luaversion-$_rockname:_subpackage"
done

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		luarocks-$lver \
		               --deps-mode=none \
		               LUA_INCDIR="$(pkg-config --variable=includedir lua$lver)" \
		               LUA_LIBDIR="$(pkg-config --variable=libdir lua$lver)" \
		               make --tree="./build" \
		               "rockspec/$_rockname-master-"*".rockspec"

		rm "./build/lib/luarocks/rocks-$lver/manifest"
	done
}

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

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc (for Lua $lver)"
	depends="lua$lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"

	local path; for path in "lib/luarocks/rocks-$lver" "share/lua/$lver"; do
		mkdir -p "$subpkgdir/usr/${path%/*}"
		mv "$builddir/build/$path" "$subpkgdir/usr/$path/"
	done
}
sha512sums="e76c1a267ffc33d5092d572e65ab0d91861c37f943e657dadd38472ae38030d0f4558e441233385799a3a5452595dfb891c42ab718806d4177fa82492d4191fe  jsonschema-0.9.tar.gz"