Sun Apr 12 19:48:20 2020 UTC ()
Fix missing functions with Lua 5.3. Bump revision.
(joerg)
diff -r1.29 -r1.30 pkgsrc/net/libquvi/Makefile
diff -r1.3 -r1.4 pkgsrc/net/libquvi/distinfo
diff -r0 -r1.1 pkgsrc/net/libquvi/patches/patch-src_libquvi_lua__wrap.c
--- pkgsrc/net/libquvi/Makefile 2020/03/20 11:58:08 1.29
+++ pkgsrc/net/libquvi/Makefile 2020/04/12 19:48:20 1.30
| @@ -1,18 +1,18 @@ | | | @@ -1,18 +1,18 @@ |
1 | # $NetBSD: Makefile,v 1.29 2020/03/20 11:58:08 nia Exp $ | | 1 | # $NetBSD: Makefile,v 1.30 2020/04/12 19:48:20 joerg Exp $ |
2 | # | | 2 | # |
3 | | | 3 | |
4 | DISTNAME= libquvi-0.4.1 | | 4 | DISTNAME= libquvi-0.4.1 |
5 | PKGREVISION= 22 | | 5 | PKGREVISION= 23 |
6 | CATEGORIES= net | | 6 | CATEGORIES= net |
7 | MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=quvi/} | | 7 | MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=quvi/} |
8 | EXTRACT_SUFX= .tar.bz2 | | 8 | EXTRACT_SUFX= .tar.bz2 |
9 | | | 9 | |
10 | MAINTAINER= ryoon@NetBSD.org | | 10 | MAINTAINER= ryoon@NetBSD.org |
11 | HOMEPAGE= http://quvi.sourceforge.net/ | | 11 | HOMEPAGE= http://quvi.sourceforge.net/ |
12 | COMMENT= Library for quvi | | 12 | COMMENT= Library for quvi |
13 | LICENSE= gnu-lgpl-v2.1 | | 13 | LICENSE= gnu-lgpl-v2.1 |
14 | | | 14 | |
15 | CONFLICTS+= quvi<=0.2.19 | | 15 | CONFLICTS+= quvi<=0.2.19 |
16 | | | 16 | |
17 | GNU_CONFIGURE= yes | | 17 | GNU_CONFIGURE= yes |
18 | USE_LIBTOOL= yes | | 18 | USE_LIBTOOL= yes |
--- pkgsrc/net/libquvi/distinfo 2015/11/04 00:35:09 1.3
+++ pkgsrc/net/libquvi/distinfo 2020/04/12 19:48:20 1.4
| @@ -1,6 +1,7 @@ | | | @@ -1,6 +1,7 @@ |
1 | $NetBSD: distinfo,v 1.3 2015/11/04 00:35:09 agc Exp $ | | 1 | $NetBSD: distinfo,v 1.4 2020/04/12 19:48:20 joerg Exp $ |
2 | | | 2 | |
3 | SHA1 (libquvi-0.4.1.tar.bz2) = b7ac371185c35a1a9a2135ef4ee61c86c48f78f4 | | 3 | SHA1 (libquvi-0.4.1.tar.bz2) = b7ac371185c35a1a9a2135ef4ee61c86c48f78f4 |
4 | RMD160 (libquvi-0.4.1.tar.bz2) = 38535a867bef195b32a81b5bdadf927110f79603 | | 4 | RMD160 (libquvi-0.4.1.tar.bz2) = 38535a867bef195b32a81b5bdadf927110f79603 |
5 | SHA512 (libquvi-0.4.1.tar.bz2) = a5cc2c837c1a767dc5f543c7cf0b5611a92b7e397b532c1d6afd023f10831865b793193fe1ba5d14006308f2b1f0a575447c47dd383cb307ea6130ca6fab8078 | | 5 | SHA512 (libquvi-0.4.1.tar.bz2) = a5cc2c837c1a767dc5f543c7cf0b5611a92b7e397b532c1d6afd023f10831865b793193fe1ba5d14006308f2b1f0a575447c47dd383cb307ea6130ca6fab8078 |
6 | Size (libquvi-0.4.1.tar.bz2) = 308126 bytes | | 6 | Size (libquvi-0.4.1.tar.bz2) = 308126 bytes |
| | | 7 | SHA1 (patch-src_libquvi_lua__wrap.c) = ae032ca04cdaeaf3d7025faabeedb84f5aa3399b |
$NetBSD: patch-src_libquvi_lua__wrap.c,v 1.1 2020/04/12 19:48:20 joerg Exp $
Inline part of the Lua 5.1/5.2 compat code.
--- src/libquvi/lua_wrap.c.orig 2020-04-12 16:02:28.082417799 +0000
+++ src/libquvi/lua_wrap.c
@@ -410,17 +410,58 @@ static int lua_files_only(const struct d
}
/* Init. */
+static const char *my_luaL_findtable (lua_State *L, int idx,
+ const char *fname, int szhint) {
+ const char *e;
+ if (idx) lua_pushvalue(L, idx);
+ do {
+ e = strchr(fname, '.');
+ if (e == NULL) e = fname + strlen(fname);
+ lua_pushlstring(L, fname, e - fname);
+ if (lua_rawget(L, -2) == LUA_TNIL) { /* no such field? */
+ lua_pop(L, 1); /* remove this nil */
+ lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
+ lua_pushlstring(L, fname, e - fname);
+ lua_pushvalue(L, -2);
+ lua_settable(L, -4); /* set new table into field */
+ }
+ else if (!lua_istable(L, -1)) { /* field has a non-table value? */
+ lua_pop(L, 2); /* remove table and value */
+ return fname; /* return problematic part of the name */
+ }
+ lua_remove(L, -2); /* remove previous table */
+ fname = e + 1;
+ } while (*e == '.');
+ return NULL;
+}
int init_lua(_quvi_t quvi)
{
QUVIcode rc;
+ int size;
+ const luaL_Reg *l;
quvi->lua = luaL_newstate();
if (!quvi->lua)
return (QUVI_LUAINIT);
luaL_openlibs(quvi->lua);
- luaL_openlib(quvi->lua, "quvi", reg_meth, 1);
+
+ for (l = reg_meth, size = 0; l && l->name; l++) size++;
+ my_luaL_findtable(quvi->lua, LUA_REGISTRYINDEX, LUA_LOADED_TABLE, 1);
+ if (lua_getfield(quvi->lua, -1, "quvi") != LUA_TTABLE) { /* no LOADED["quvi"]? */
+ lua_pop(quvi->lua, 1); /* remove previous result */
+ /* try global variable (and create one if it does not exist) */
+ lua_pushglobaltable(quvi->lua);
+ if (my_luaL_findtable(quvi->lua, 0, "quvi", size) != NULL)
+ luaL_error(quvi->lua, "name conflict for module '%s'", "quvi");
+ lua_pushvalue(quvi->lua, -1);
+ lua_setfield(quvi->lua, -3, "quvi"); /* LOADED["quvi"] = new table */
+ }
+ lua_remove(quvi->lua, -2); /* remove LOADED table */
+
+ lua_insert(quvi->lua, -2);
+ luaL_setfuncs(quvi->lua, reg_meth, 1);
rc = scan_known_dirs(&quvi->util_scripts, "lua/util", lua_files_only);