aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-libmodbus/APKBUILD
blob: ab7857824012a841a8b2f9aeacfc5d9c64511c64 (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.6.1
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="99bca4898b2a6b6b94f6bab794efdfddb44f2baed552344ddda912a3154be15d2f01e021df7fe8231252359e2fbd5ad8a3db129d0c658b49ded6f74ad531231f  libmodbus-0.6.1.tar.gz"