mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-24 23:47:14 -08:00
dev-db/redis: build fix for luajit-2.1
luajit-2.1 integrated few extensions from lua5.2 [1] luaL_setfuncs being one of them. The same function is implemented in bundled lua-cjson for lua5.1 but is not properly guarded for luajit-2.1. This change backports the fix [2,3] from https://github.com/openresty/lua-cjson. [1] https://github.com/LuaJIT/LuaJIT/commit/de97b9d52bbc42effeaf1180764053a912526873 [2] https://github.com/openresty/lua-cjson/commit/638ac2741a7f274979ac3fe2e1ea5fd6487702fe [3] https://github.com/openresty/lua-cjson/pull/32 Closes: https://bugs.gentoo.org/842444 Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
Backported from https://github.com/openresty/lua-cjson
|
||||
|
||||
Upstream-commit: 638ac2741a7f ("optimize: improved forward-compatibility with older versions of Lua/LuaJIT.")
|
||||
Link: https://github.com/openresty/lua-cjson/commit/638ac2741a7f274979ac3fe2e1ea5fd6487702fe
|
||||
Upstream-PR: https://github.com/openresty/lua-cjson/pull/32
|
||||
See-also: https://www.freelists.org/post/luajit/ANN-LuaJIT210beta3,3
|
||||
|
||||
diff --git a/deps/lua/src/lua_cjson.c b/deps/lua/src/lua_cjson.c
|
||||
index c26c0d7b8..af9e4ca54 100644
|
||||
--- a/deps/lua/src/lua_cjson.c
|
||||
+++ b/deps/lua/src/lua_cjson.c
|
||||
@@ -1293,11 +1293,13 @@ static int json_decode(lua_State *l)
|
||||
/* ===== INITIALISATION ===== */
|
||||
|
||||
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
|
||||
-/* Compatibility for Lua 5.1.
|
||||
+/* Compatibility for Lua 5.1 and older LuaJIT.
|
||||
*
|
||||
- * luaL_setfuncs() is used to create a module table where the functions have
|
||||
- * json_config_t as their first upvalue. Code borrowed from Lua 5.2 source. */
|
||||
-static void luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
|
||||
+ * compat_luaL_setfuncs() is used to create a module table where the functions
|
||||
+ * have json_config_t as their first upvalue. Code borrowed from Lua 5.2
|
||||
+ * source's luaL_setfuncs().
|
||||
+ */
|
||||
+static void compat_luaL_setfuncs(lua_State *l, const luaL_Reg *reg, int nup)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1310,6 +1312,8 @@ static void luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
|
||||
}
|
||||
lua_pop(l, nup); /* remove upvalues */
|
||||
}
|
||||
+#else
|
||||
+#define compat_luaL_setfuncs(L, reg, nup) luaL_setfuncs(L, reg, nup)
|
||||
#endif
|
||||
|
||||
/* Call target function in protected mode with all supplied args.
|
||||
@@ -1365,7 +1369,7 @@ static int lua_cjson_new(lua_State *l)
|
||||
|
||||
/* Register functions with config data as upvalue */
|
||||
json_create_config(l);
|
||||
- luaL_setfuncs(l, reg, 1);
|
||||
+ compat_luaL_setfuncs(l, reg, 1);
|
||||
|
||||
/* Set cjson.null */
|
||||
lua_pushlightuserdata(l, NULL);
|
||||
@@ -45,6 +45,7 @@ PATCHES=(
|
||||
"${FILESDIR}"/${PN}-5.0-sharedlua.patch
|
||||
"${FILESDIR}"/${PN}-5.0.8-ppc-atomic.patch
|
||||
"${FILESDIR}"/${PN}-sentinel-5.0-config.patch
|
||||
"${FILESDIR}"/${PN}-5.0-luajit-2.1-fix.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
|
||||
@@ -60,6 +60,7 @@ PATCHES=(
|
||||
"${FILESDIR}"/${PN}-6.0.12-sharedlua.patch
|
||||
"${FILESDIR}"/${PN}-5.0.8-ppc-atomic.patch
|
||||
"${FILESDIR}"/${PN}-sentinel-5.0-config.patch
|
||||
"${FILESDIR}"/${PN}-5.0-luajit-2.1-fix.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
|
||||
@@ -60,6 +60,7 @@ PATCHES=(
|
||||
"${FILESDIR}"/${PN}-6.2.1-sharedlua.patch
|
||||
"${FILESDIR}"/${PN}-6.2.3-ppc-atomic.patch
|
||||
"${FILESDIR}"/${PN}-sentinel-5.0-config.patch
|
||||
"${FILESDIR}"/${PN}-5.0-luajit-2.1-fix.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
|
||||
Reference in New Issue
Block a user