aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-mpack/APKBUILD
blob: 01d0892622c3013154ba825531fbbcb0b79e4ea0 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Contributor: Daniel Sabogal <dsabogalcc@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-mpack
_rockname=mpack
_pkgname=libmpack-lua
pkgver=1.0.7
pkgrel=0
pkgdesc="Libmpack bindings for Lua"
url="https://github.com/libmpack/libmpack-lua"
arch="all"
license="MIT"
makedepends="libmpack-dev>=1.0.5"
checkdepends="lua-busted"
subpackages=""
source="$_pkgname-$pkgver.tar.gz::https://github.com/libmpack/$_pkgname/archive/$pkgver.tar.gz
	skip-memleak-test.patch
	dont-install-busted.patch"
builddir="$srcdir/$_pkgname-$pkgver"

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

prepare() {
	default_prepare

	local lver; for lver in $_luaversions; do
		cp -r "$builddir" "$builddir-$lver"
	done
}

build() {
	local lver; for lver in $_luaversions; do
		msg "Building for Lua $lver..."
		make -C "$builddir-$lver" \
			FETCH=false \
			USE_SYSTEM_LUA=yes \
			USE_SYSTEM_MPACK=yes \
			LUA_INCLUDE="$(pkg-config --cflags lua$lver)" \
			LUA_LIB="$(pkg-config --libs lua$lver)"
	done
}

check() {
	local lver; for lver in $_luaversions; do
		msg "Testing on Lua $lver..."
		make -C "$builddir-$lver" \
			USE_SYSTEM_LUA=yes \
			USE_SYSTEM_MPACK=yes \
			LUA=/usr/bin/lua$lver \
			BUSTED=/usr/bin/busted-$lver \
			test
	done
}

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

_subpackage() {
	local lver="${subpkgname:3:3}"
	pkgdesc="$pkgdesc $lver"
	install_if="$pkgname=$pkgver-r$pkgrel lua$lver"
	local rockdir="$subpkgdir/usr/lib/luarocks/rocks-$lver/$_rockname/$pkgver-0"

	make -C "$builddir-$lver" \
		USE_SYSTEM_LUA=yes \
		USE_SYSTEM_MPACK=yes \
		LUA_CMOD_INSTALLDIR="$(pkg-config --variable=INSTALL_CMOD lua$lver)" \
		DESTDIR="$subpkgdir" \
		install

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

sha512sums="301eb78ca22a75bcabc61eebf6d67f6e5a2d3535d34c0ab6e034495e5bdd0571842397a8f36d42abbdfacf240860f807c93e3ace8ed42543e2322914d84c1a36  libmpack-lua-1.0.7.tar.gz
af6b670c1007aa86b696798ede30d17addc45d27dd7e78be6e7bd4a3eac931a9ce47b8e12d8146dadf44c80d21917983a836915dd8f0c33abf3be0381a24a642  skip-memleak-test.patch
f688f34c6893dbb4590b93e14de459c33d8efe621a41699a36286b117b874fac37fe473ef46ad2f2855c4672d90defb600c7e93555989d0c45a4964fda49c5a9  dont-install-busted.patch"