aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-libmodbus/APKBUILD
blob: 434e39210b78fad6d796625b1feba89f79915a90 (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
# Contributor: Tobias Spieth <tobias.spieth@evbox.com>
# Maintainer: Tobias Spieth <tobias.spieth@evbox.com>
pkgname=lua-libmodbus
_rockname="${pkgname#lua-}"
pkgver=0.5
pkgrel=0
pkgdesc="Lua bindings to libmodbus"
url="https://github.com/etactica/lua-libmodbus"
license="MIT"
arch="all"
makedepends="libmodbus-dev"
subpackages="$pkgname-doc"
options="!check" # Test dependencies not available
source="$_rockname-$pkgver.tar.gz::https://github.com/etactica/lua-libmodbus/archive/v$pkgver.tar.gz"

_luaversions="5.1 5.2"
for _v in $_luaversions; do
	makedepends="$makedepends lua$_v-dev luarocks$_v"
	subpackages="$subpackages lua$_v-$_rockname:_subpackage"
done

build() {
	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")" \
			LUA_VERSION="$lver" \
			make --tree="./build-$lver" \
			"luarocks/$pkgname-$pkgver-"*".rockspec"
	done
}

package() {
	mkdir -p "$pkgdir/usr/share/doc/$pkgname/"
	cp -r "docs/" "$pkgdir/usr/share/doc/$pkgname/"
}

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

	local path="lib/lua/$lver"
	mkdir -p "$subpkgdir/usr/${path%/*}"
	mv "$builddir/build-$lver/$path" "$subpkgdir/usr/$path/"
}

sha512sums="d4a800beb6bf450f796883a8c863484b7335495192889f4f9ca80141c10e9460588aff41ee3f69d9b6ef5db6788975dda809376313f4eec02e456732c6129c94  libmodbus-0.5.tar.gz"