aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lua-libmodbus/APKBUILD
diff options
context:
space:
mode:
authorTobias Spieth <tobias.spieth@evbox.com>2020-02-24 14:02:45 +0100
committerLeo <thinkabit.ukim@gmail.com>2020-02-25 05:38:02 -0300
commit1011d352f4f006e9a323431fb280622f98147253 (patch)
treebfd524c6f3a32a28391fecce1d06df6a8ebe5b04 /testing/lua-libmodbus/APKBUILD
parent762b9fd601983d8a6e6a60692158f3f22b1b60fe (diff)
downloadaports-1011d352f4f006e9a323431fb280622f98147253.tar.bz2
aports-1011d352f4f006e9a323431fb280622f98147253.tar.xz
testing/lua-libmodbus: new aport
https://github.com/etactica/lua-libmodbus Lua bindings to libmodbus
Diffstat (limited to 'testing/lua-libmodbus/APKBUILD')
-rw-r--r--testing/lua-libmodbus/APKBUILD53
1 files changed, 53 insertions, 0 deletions
diff --git a/testing/lua-libmodbus/APKBUILD b/testing/lua-libmodbus/APKBUILD
new file mode 100644
index 0000000000..d3641ee047
--- /dev/null
+++ b/testing/lua-libmodbus/APKBUILD
@@ -0,0 +1,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 5.3"
+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"