summaryrefslogtreecommitdiffstats
path: root/main/lua-mosquitto
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-04-06 13:40:43 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-04-06 13:40:43 +0000
commitef01bc820be68fa7c79d6bfc6e65b7d7bca3b893 (patch)
treed4bcb1f33ab14da8439f0ec2fb263a25bde1fe6b /main/lua-mosquitto
parentebb0ad8e0a71c3ca3477ad23a5fc171015ca3156 (diff)
downloadaports-ef01bc820be68fa7c79d6bfc6e65b7d7bca3b893.tar.bz2
aports-ef01bc820be68fa7c79d6bfc6e65b7d7bca3b893.tar.xz
main/lua-mosquitto: move from testing
Diffstat (limited to 'main/lua-mosquitto')
-rw-r--r--main/lua-mosquitto/APKBUILD81
-rw-r--r--main/lua-mosquitto/lua-5.3.patch96
2 files changed, 177 insertions, 0 deletions
diff --git a/main/lua-mosquitto/APKBUILD b/main/lua-mosquitto/APKBUILD
new file mode 100644
index 000000000..73522c84e
--- /dev/null
+++ b/main/lua-mosquitto/APKBUILD
@@ -0,0 +1,81 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+
+_luaversions="5.1 5.2 5.3"
+
+pkgname=lua-mosquitto
+pkgver=0.1
+pkgrel=1
+pkgdesc="Bindingd to libmosquitto for Lua"
+url="https://github.com/flukso/lua-mosquitto"
+arch="all"
+license="MIT"
+depends=""
+depends_dev=""
+makedepends="$depends_dev mosquitto-dev"
+subpackages=""
+
+for _v in $_luaversions; do
+ depends="$depends lua$_v-mosquitto"
+ makedepends="$makedepends lua$_v-dev"
+ subpackages="$subpackages lua$_v-mosquitto:split_${_v/./_}"
+done
+
+install=""
+source="lua-mosquitto-$pkgver.tar.gz::https://github.com/flukso/lua-mosquitto/archive/v$pkgver.tar.gz
+ lua-5.3.patch
+ "
+
+_builddir="$srcdir"/lua-mosquitto-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+ cd "$srcdir"
+ for i in $_luaversions; do
+ cp -r lua-mosquitto-$pkgver build-$i || return 1
+ done
+}
+
+build() {
+ for i in $_luaversions; do
+ cd "$srcdir"/build-$i
+ make LUAPKGC=lua$i || return 1
+ done
+}
+
+package() {
+ for i in $_luaversions; do
+ cd "$srcdir"/build-$i
+ make install DESTDIR="$pkgdir" LUAPKGC=lua$i \
+ LUA_LIBDIR=/usr/lib || return 1
+ done
+}
+
+_split() {
+ local d= _ver=$1
+ pkgdesc="$pkgdesc $_ver"
+ depends=
+ for d in usr/lib/lua usr/share/lua; do
+ if [ -d "$pkgdir"/$d/$_ver ]; then
+ mkdir -p "$subpkgdir"/$d
+ mv "$pkgdir"/$d/$_ver "$subpkgdir"/$d/ || return 1
+ fi
+ done
+}
+
+
+for _v in $_luaversions; do
+ eval "split_${_v/./_}() { _split $_v; }"
+done
+
+
+md5sums="fd26fa08fc855ba4a66ce521fe5aae13 lua-mosquitto-0.1.tar.gz
+f75f361ca8c540521216e59f2e0b2d2d lua-5.3.patch"
+sha256sums="9e3197fa95d97f2abfdc24a91067423b88c0bf8bbeab8a582490ba6e098187d6 lua-mosquitto-0.1.tar.gz
+19cd4ea19ccdcfeea97021cc6182828c4d7b048d504e3853bcd940f5d670932e lua-5.3.patch"
+sha512sums="1171434266601884dad9c9477c061624c84d67de3f0d92b2420fc1534e194db1a85d6c068ff3829a818206a8f243ebda115271de6dbefb145d857d995c85ee3c lua-mosquitto-0.1.tar.gz
+80144d00e4de410ff284767c9b30b2672ba2510f5125188005f527feaac7a27e7b1602a0828546e2361cd745ef383091e4db01cf23fd8c0b8438612cd5c48224 lua-5.3.patch"
diff --git a/main/lua-mosquitto/lua-5.3.patch b/main/lua-mosquitto/lua-5.3.patch
new file mode 100644
index 000000000..63fc26909
--- /dev/null
+++ b/main/lua-mosquitto/lua-5.3.patch
@@ -0,0 +1,96 @@
+From ec93445eff5ae0fae2f08fe878ef8723890446af Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 6 Apr 2015 15:01:12 +0200
+Subject: [PATCH] add support for Lua 5.3
+
+---
+ lua-mosquitto.c | 16 ++++++++--------
+ makefile | 2 +-
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/lua-mosquitto.c b/lua-mosquitto.c
+index 94da48e..a7e0751 100644
+--- a/lua-mosquitto.c
++++ b/lua-mosquitto.c
+@@ -236,7 +236,7 @@ static int ctx_will_set(lua_State *L)
+ payload = lua_tolstring(L, 3, &payloadlen);
+ };
+
+- int qos = luaL_optint(L, 4, 0);
++ int qos = luaL_optinteger(L, 4, 0);
+ bool retain = lua_toboolean(L, 5);
+
+ int rc = mosquitto_will_set(ctx->mosq, topic, payloadlen, payload, qos, retain);
+@@ -311,7 +311,7 @@ static int ctx_publish(lua_State *L)
+ payload = lua_tolstring(L, 3, &payloadlen);
+ };
+
+- int qos = luaL_optint(L, 4, 0);
++ int qos = luaL_optinteger(L, 4, 0);
+ bool retain = lua_toboolean(L, 5);
+
+ int rc = mosquitto_publish(ctx->mosq, &mid, topic, payloadlen, payload, qos, retain);
+@@ -329,7 +329,7 @@ static int ctx_subscribe(lua_State *L)
+ ctx_t *ctx = ctx_check(L, 1);
+ int mid;
+ const char *sub = luaL_checkstring(L, 2);
+- int qos = luaL_optint(L, 3, 0);
++ int qos = luaL_optinteger(L, 3, 0);
+
+ int rc = mosquitto_subscribe(ctx->mosq, &mid, sub, qos);
+
+@@ -360,8 +360,8 @@ static int ctx_unsubscribe(lua_State *L)
+ static int mosq_loop(lua_State *L, bool forever)
+ {
+ ctx_t *ctx = ctx_check(L, 1);
+- int timeout = luaL_optint(L, 2, -1);
+- int max_packets = luaL_optint(L, 3, 1);
++ int timeout = luaL_optinteger(L, 2, -1);
++ int max_packets = luaL_optinteger(L, 3, 1);
+ int rc;
+ if (forever) {
+ rc = mosquitto_loop_forever(ctx->mosq, timeout, max_packets);
+@@ -418,7 +418,7 @@ static int ctx_socket(lua_State *L)
+ static int ctx_loop_read(lua_State *L)
+ {
+ ctx_t *ctx = ctx_check(L, 1);
+- int max_packets = luaL_optint(L, 2, 1);
++ int max_packets = luaL_optinteger(L, 2, 1);
+
+ int rc = mosquitto_loop_read(ctx->mosq, max_packets);
+ return mosq__pstatus(L, rc);
+@@ -427,7 +427,7 @@ static int ctx_loop_read(lua_State *L)
+ static int ctx_loop_write(lua_State *L)
+ {
+ ctx_t *ctx = ctx_check(L, 1);
+- int max_packets = luaL_optint(L, 2, 1);
++ int max_packets = luaL_optinteger(L, 2, 1);
+
+ int rc = mosquitto_loop_write(ctx->mosq, max_packets);
+ return mosq__pstatus(L, rc);
+@@ -607,7 +607,7 @@ static int ctx_callback_set(lua_State *L)
+ if (lua_isstring(L, 2)) {
+ callback_type = callback_type_from_string(lua_tostring(L, 2));
+ } else {
+- callback_type = luaL_checkint(L, 2);
++ callback_type = luaL_checkinteger(L, 2);
+ }
+
+ if (!lua_isfunction(L, 3)) {
+diff --git a/makefile b/makefile
+index 39a5472..1c843aa 100644
+--- a/makefile
++++ b/makefile
+@@ -1,7 +1,7 @@
+ PKGC ?= pkg-config
+
+ # lua's package config can be under various names
+-LUAPKGC := $(shell for pc in lua lua5.1 lua5.2; do \
++LUAPKGC := $(shell for pc in lua lua5.1 lua5.2 lua5.3; do \
+ $(PKGC) --exists $$pc && echo $$pc && break; \
+ done)
+
+--
+2.3.5
+
+