Mail archive
alpine-aports

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

From: Nathan Angelacos <nangel_at_alpinelinux.org>
Date: Mon, 31 Jul 2017 19:54:39 -0400

 APKBUILD: hiredis.so now loads correctly
 0003-: spell compatibility correctly
 0004-: add backward compatibility define for luaL_checkint for Lua 5.3+
---
 .../lua-hiredis/0001-lua-5-3-compatibility.patch   | 20 -------------
 ...lity.patch => 0003-lua-5-2-compatibility.patch} |  0
 .../lua-hiredis/0004-lua-5-3-compatibility.patch   | 15 ++++++++++
 community/lua-hiredis/APKBUILD                     | 33 +++++++++++-----------
 4 files changed, 31 insertions(+), 37 deletions(-)
 delete mode 100644 community/lua-hiredis/0001-lua-5-3-compatibility.patch
 rename community/lua-hiredis/{0003-lua-5-2-compatbility.patch => 0003-lua-5-2-compatibility.patch} (100%)
 create mode 100644 community/lua-hiredis/0004-lua-5-3-compatibility.patch
diff --git a/community/lua-hiredis/0001-lua-5-3-compatibility.patch b/community/lua-hiredis/0001-lua-5-3-compatibility.patch
deleted file mode 100644
index c7bab778bb..0000000000
--- a/community/lua-hiredis/0001-lua-5-3-compatibility.patch
+++ /dev/null
_at_@ -1,20 +0,0 @@
-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
-_at_@ -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/0003-lua-5-2-compatbility.patch b/community/lua-hiredis/0003-lua-5-2-compatibility.patch
similarity index 100%
rename from community/lua-hiredis/0003-lua-5-2-compatbility.patch
rename to community/lua-hiredis/0003-lua-5-2-compatibility.patch
diff --git a/community/lua-hiredis/0004-lua-5-3-compatibility.patch b/community/lua-hiredis/0004-lua-5-3-compatibility.patch
new file mode 100644
index 0000000000..deb89e6f27
--- /dev/null
+++ b/community/lua-hiredis/0004-lua-5-3-compatibility.patch
_at_@ -0,0 +1,15 @@
+diff --git a/src/lua-hiredis.c b/src/lua-hiredis.c
+index 4a465ce..8c9541b 100644
+--- a/src/lua-hiredis.c
++++ b/src/lua-hiredis.c
+_at_@ -50,6 +50,10 @@ static void luaL_register(lua_State * L, const char * name, const luaL_Reg * l)
+ }
+ #endif
+ 
++#ifndef luaL_checkint
++#define luaL_checkint(L, n) ((int)luaL_checkinteger(L,n))
++#endif
++
+ typedef struct luahiredis_Enum
+ {
+   const char * name;
diff --git a/community/lua-hiredis/APKBUILD b/community/lua-hiredis/APKBUILD
index d399853327..73f9bc229a 100644
--- a/community/lua-hiredis/APKBUILD
+++ b/community/lua-hiredis/APKBUILD
_at_@ -4,12 +4,12 @@ _luaversions="5.1 5.2 5.3"
 
 pkgname=lua-hiredis
 pkgver=0.2.1
-pkgrel=1
-pkgdesc="Binding to libhiredis for Lua"
+pkgrel=2
+pkgdesc="Binding to hiredis for Lua"
 url="https://github.com/agladysh/lua-hiredis"
 arch="all"
 license="MIT"
-depends=""
+depends="hiredis"
 depends_dev=""
 makedepends="$depends_dev hiredis-dev"
 subpackages=""
_at_@ -23,9 +23,8 @@ done
 install=""
 source="lua-hiredis-$pkgver.tar.gz::https://github.com/agladysh/lua-hiredis/archive/v$pkgver.tar.gz
 	0002-lua-hiredis-master.patch
-	0003-lua-5-2-compatbility.patch
-	"
-#	0001-lua-5-3-compatibility.patch
+	0003-lua-5-2-compatibility.patch
+	0004-lua-5-3-compatibility.patch"
 _builddir="$srcdir"/lua-hiredis-$pkgver
 prepare() {
 	local i
_at_@ -44,6 +43,11 @@ build() {
 	cd "$_builddir"
 }
 
+check() {
+	# No check functionality yet
+	return 0
+}
+
 package() {
 	mkdir -p "$pkgdir"
 }
_at_@ -53,21 +57,16 @@ _split() {
 	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 \
+	${CC:-gcc} src/lua-hiredis.c ${CFLAGS} -shared -fPIC \
+		$(pkg-config --cflags hiredis lua$_ver) \
+		$(pkg-config --libs hiredis lua$_ver) \
 		-I/usr/include/lua$_ver -I/usr/include/hiredis \
-		-lhiredis -o hiredis.so src/lua-hiredis.c \
-		|| return 1
+		-o hiredis.so || return 1 
 	install -Dm755 hiredis.so \
 		"$subpkgdir"/usr/lib/lua/$_ver/hiredis.so || return 1
 }
 
-md5sums="edd68a6f0b39ba9cae100de275853696  lua-hiredis-0.2.1.tar.gz
-ea686bff78a4307d0f7874aa63fc0204  0002-lua-hiredis-master.patch
-44515c8cf4b2c9ece011e7af8e97aa86  0003-lua-5-2-compatbility.patch"
-sha256sums="38976799776cc702f4b8cc396babda4152975855d593a17da1343eeb2cebcb34  lua-hiredis-0.2.1.tar.gz
-b333f545078b8a42eee27135ac764ec2c436ef2d89193f8a6ba931de1061a5a9  0002-lua-hiredis-master.patch
-48cdfa61013f4c644c75bb2119224c08ef6e86d76c5e25fb7818c22ba67b3913  0003-lua-5-2-compatbility.patch"
 sha512sums="b53eea8b51ddfbfa4592e7a3bb004416edd6240a860656ec809b603349357d3e754a2b5f2a92cb33d0a46259beae86f1c99981e848193f112888982d97cb94b7  lua-hiredis-0.2.1.tar.gz
 0017a218a126e0b96a5cc4126a0b8dc7600ef6029af24f3ca685e46cabade03d25a3c318b3d80c907785f2f2abc7dfb2c9a047e6a7c53e082ab682a3ac5ca18b  0002-lua-hiredis-master.patch
-9cf63994de040d8818c3db3053d506244e7a4a647ae71609533b5c889517d6addf01dde185f83d7472f4580dea4d26dce69e5e5ad86ca7c70343eaffe0d7e137  0003-lua-5-2-compatbility.patch"
+9cf63994de040d8818c3db3053d506244e7a4a647ae71609533b5c889517d6addf01dde185f83d7472f4580dea4d26dce69e5e5ad86ca7c70343eaffe0d7e137  0003-lua-5-2-compatibility.patch
+5603ee2e6566e79c6760160082cc3fa87b44a0dc34c10932bfddcb04375c78f280742e91a343185931da8d241753c2c3e0e3514f48f1347eed8b0ee711865f1b  0004-lua-5-3-compatibility.patch"
-- 
2.13.2
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon Jul 31 2017 - 19:54:39 UTC