aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-brieflz/APKBUILD
blob: 92d49d7569e827f18f58242729a017e4d9f46d55 (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
63
64
65
66
67
68
69
70
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-brieflz
_pkgname=brieflz.lua
pkgver=0.1.0
pkgrel=1
pkgdesc="Lua binding for BriefLZ compression library"
url="https://github.com/jirutka/brieflz.lua"
arch="all"
license="MIT"
checkdepends="lua-basexx lua-busted moonscript"
makedepends=""
subpackages=""
source="$pkgname-$pkgver.tar.gz::https://github.com/jirutka/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

# luajit is not available for s390x
case "$CARCH" in
	s390x) _luajit="";;
	*) checkdepends="$checkdepends luajit" _luajit="jit";;
esac

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev luarocks$_v"
	subpackages="$subpackages lua$_v-${pkgname#lua-}:_subpackage"
done

build() {
	cd "$builddir"

	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."

		luarocks-$lver \
			CC="$CC" \
			CFLAGS="$CFLAGS -fPIC" \
			LUA_INCDIR="$(pkg-config --variable=includedir lua$lver)" \
			LUA_LIBDIR="$(pkg-config --variable=libdir lua$lver)" \
			make --tree=./build brieflz-dev-0.rockspec
	done
}

check() {
	cd "$builddir"

	local lver; for lver in $_luaversions $_luajit; do
		msg "Testing on lua$lver"

		ln -sf build/lib/lua/${lver/jit/5.1}/brieflz.so .
		lua$lver /usr/bin/busted
	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"

	cd "$builddir"
	install -D -m 755 build/lib/lua/$lver/brieflz.so \
		"$subpkgdir"/usr/lib/lua/$lver/brieflz.so
}

sha512sums="a6449f3ffb953adbc41335856a9b23e614ed5c1834a2c8f96553949efe3e5099a9fc5d3ede170e53dc36da2b2ec18ad6c6df0d8247c50791a978cd332d463442  lua-brieflz-0.1.0.tar.gz"