Subject: [alpine-aports] [PATCH] community/lua-hiredis

From: Nathan Angelacos <[email-masked]>
Date: Tue, 6 Oct 2015 12:51:39 +0000

Redis binary protocol bindings for lua
---
 .../lua-hiredis/0001-lua-5-3-compatibility.patch   | 20 +++++++
 community/lua-hiredis/APKBUILD                     | 69 ++++++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 community/lua-hiredis/0001-lua-5-3-compatibility.patch
 create mode 100644 community/lua-hiredis/APKBUILD

diff --git a/community/lua-hiredis/0001-lua-5-3-compatibility.patch b/community/lua-hiredis/0001-lua-5-3-compatibility.patch
new file mode 100644
index 0000000..c7bab77
--- /dev/null
+++ b/community/lua-hiredis/0001-lua-5-3-compatibility.patch
@@ -0,0 +1,20 @@
+diff --git a/src/lua-hiredis.c b/src/lua-hiredis.c
+index f8b2fdf..8cd7c56 100644
+--- a/src/lua-hiredis.c
++++ b/src/lua-hiredis.c
+@@ -8,6 +8,15 @@ extern "C" {
+ #endif
+ 
+ #include <lua.h>
++
++// Lua 5.2 compatibility 
++#if LUA_VERSION_NUM > 501
++#define luaL_reg luaL_Reg
++#define LUA_COMPAT_MODULE
++#define LUA_COMPAT_APIINTCASTS
++#endif
++
++
+ #include <lauxlib.h>
+ 
+ #if defined (__cplusplus)
diff --git a/community/lua-hiredis/APKBUILD b/community/lua-hiredis/APKBUILD
new file mode 100644
index 0000000..190ce31
--- /dev/null
+++ b/community/lua-hiredis/APKBUILD
@@ -0,0 +1,69 @@
+# Maintainer: Nathan Angelacos <[email-masked]>
+
+_luaversions="5.1 5.2 5.3"
+
+pkgname=lua-hiredis
+pkgver=0.2.1
+pkgrel=0
+pkgdesc="Binding to libhiredis for Lua"
+url="https://github.com/agladysh/lua-hiredis"
+arch="all"
+license="MIT"
+depends=""
+depends_dev=""
+makedepends="$depends_dev hiredis-dev"
+subpackages=""
+
+for _v in $_luaversions; do
+	makedepends="$makedepends lua$_v-dev"
+	subpackages="$subpackages lua$_v-${pkgname#*lua-}:split_${_v/./_}"
+	eval "split_${_v/./_}() { _split $_v; }"
+done
+
+install=""
+source="lua-hiredis-$pkgver.tar.gz::https://github.com/agladysh/lua-hiredis/archive/v$pkgver.tar.gz
+	0001-lua-5-3-compatibility.patch
+	"
+
+_builddir="$srcdir"/lua-hiredis-$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
+	for _v in $_luaversions; do
+		cp -r $_builddir "$srcdir"/$pkgname-$_v
+	done
+}
+
+build() {
+	cd "$_builddir"
+}
+
+package() {
+	mkdir -p "$pkgdir"
+}
+
+_split() {
+	local _ver="$1"
+	cd "$srcdir"/$pkgname-$_ver || return 1
+	pkgdesc="$pkgdesc (Lua $_ver)"
+	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
+	${CC:-gcc} ${CFLAGS} $(pkg-config --cflags hiredis) \
+		$(pkg-config --cflags lua$_ver) -shared -fPIC \
+		-I/usr/include/lua$_ver -I/usr/include/hiredis \
+		-o hiredis.so src/lua-hiredis.c \
+		|| return 1
+	install -Dm755 hiredis.so \
+		"$subpkgdir"/usr/lib/lua/$_ver/hiredis.so || return 1
+}
+
+md5sums="edd68a6f0b39ba9cae100de275853696  lua-hiredis-0.2.1.tar.gz
+acf9dc5b26d8ce3fa341099467ae8776  0001-lua-5-3-compatibility.patch"
+sha256sums="38976799776cc702f4b8cc396babda4152975855d593a17da1343eeb2cebcb34  lua-hiredis-0.2.1.tar.gz
+de2edefec93d90adf2b594e81a284b82f4b5712e9422fd3e4d41f84afdae9a80  0001-lua-5-3-compatibility.patch"
+sha512sums="b53eea8b51ddfbfa4592e7a3bb004416edd6240a860656ec809b603349357d3e754a2b5f2a92cb33d0a46259beae86f1c99981e848193f112888982d97cb94b7  lua-hiredis-0.2.1.tar.gz
+78f15aac6088dd37de5d462e9ac26c1c3d0ea3d5e783df155f4be5b5415113eb0954feea499335003e89c40768d8005b0d158101acc197aa80aa57109c32ffca  0001-lua-5-3-compatibility.patch"
-- 
2.6.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---