More fixes for lua-5.2. From https://github.com/arunpersaud/osbf-lua
with the help of John R. Shannon. Bump PKGREVISION.
This commit is contained in:
parent
8bf1d9be1c
commit
88511c8d48
5 changed files with 72 additions and 29 deletions
|
@ -1,8 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.9 2013/07/04 21:27:57 adam Exp $
|
||||
# $NetBSD: Makefile,v 1.10 2013/10/11 20:25:34 wiz Exp $
|
||||
#
|
||||
|
||||
DISTNAME= osbf-lua-2.0.4
|
||||
PKGREVISION= 2
|
||||
PKGREVISION= 3
|
||||
CATEGORIES= mail
|
||||
MASTER_SITES= http://luaforge.net/frs/download.php/2094/
|
||||
|
||||
|
@ -35,6 +35,7 @@ SUBST_FILES.path+= spamfilter/toer.lua
|
|||
SUBST_FILES.path+= spamfilter/train.sample
|
||||
SUBST_FILES.path+= docs/index.html
|
||||
SUBST_SED.path= -e 's,/usr/local,${PREFIX},g'
|
||||
SUBST_SED.path+= -e 's,lib/lua/5.1,lib/lua/5.2,g'
|
||||
|
||||
.include "../../lang/lua/buildlink3.mk"
|
||||
.include "../../mk/bsd.pkg.mk"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@comment $NetBSD: PLIST,v 1.2 2009/06/14 18:04:26 joerg Exp $
|
||||
lib/lua/5.1/libosbf.so.${PKGVERSION}
|
||||
lib/lua/5.1/osbf.so
|
||||
@comment $NetBSD: PLIST,v 1.3 2013/10/11 20:25:34 wiz Exp $
|
||||
lib/lua/5.2/libosbf.so.${PKGVERSION}
|
||||
lib/lua/5.2/osbf.so
|
||||
osbf-lua/cache_report.lua
|
||||
osbf-lua/classify.sample
|
||||
osbf-lua/create_databases.lua
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$NetBSD: distinfo,v 1.4 2013/07/05 14:31:40 wiz Exp $
|
||||
$NetBSD: distinfo,v 1.5 2013/10/11 20:25:34 wiz Exp $
|
||||
|
||||
SHA1 (osbf-lua-2.0.4.tar.gz) = 6fd4fb6496c20e9340cdcff4820c50a793e2ea27
|
||||
RMD160 (osbf-lua-2.0.4.tar.gz) = ba808072739de2bcb40ce81f0177ef7588508670
|
||||
Size (osbf-lua-2.0.4.tar.gz) = 82343 bytes
|
||||
SHA1 (patch-aa) = 25fe0abc6543893d88d147e418027cee9a544502
|
||||
SHA1 (patch-aa) = 318255203a7ce8dda28200d9405fa0e948e3d2ef
|
||||
SHA1 (patch-bb) = ead9d141481c2eabd510dd26eb39b5f88ede9e04
|
||||
SHA1 (patch-losbflib.c) = 53ef00a5db3e8f892d4edd41204dc13b8d17f32e
|
||||
SHA1 (patch-losbflib.c) = 9ee6438b61d6702d2faa6d5a3fdcf88f57555339
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$NetBSD: patch-aa,v 1.1.1.1 2008/10/13 11:29:53 shannonjr Exp $
|
||||
$NetBSD: patch-aa,v 1.2 2013/10/11 20:25:34 wiz Exp $
|
||||
|
||||
--- config.orig 2007-01-14 11:57:19.000000000 -0700
|
||||
--- config.orig 2007-01-14 18:57:19.000000000 +0000
|
||||
+++ config
|
||||
@@ -20,20 +20,8 @@ LIB_DIR= /usr/local/lib
|
||||
# OS dependent
|
||||
|
|
|
@ -1,9 +1,27 @@
|
|||
$NetBSD: patch-losbflib.c,v 1.1 2013/07/05 14:31:40 wiz Exp $
|
||||
$NetBSD: patch-losbflib.c,v 1.2 2013/10/11 20:25:34 wiz Exp $
|
||||
|
||||
Fix build with lua-5.2.
|
||||
|
||||
--- losbflib.c.orig 2007-01-14 18:57:19.000000000 +0000
|
||||
+++ losbflib.c
|
||||
@@ -170,7 +170,7 @@ lua_osbf_createdb (lua_State * L)
|
||||
luaL_checktype (L, 1, LUA_TTABLE);
|
||||
|
||||
/* get the number of classes to create */
|
||||
- num_classes = luaL_getn (L, 1);
|
||||
+ num_classes = (int) lua_rawlen (L, 1);
|
||||
|
||||
/* get number of buckets */
|
||||
buckets = luaL_checknumber (L, 2);
|
||||
@@ -214,7 +214,7 @@ lua_osbf_removedb (lua_State * L)
|
||||
luaL_checktype (L, 1, LUA_TTABLE);
|
||||
|
||||
/* get the number of classes to remove */
|
||||
- num_classes = luaL_getn (L, 1);
|
||||
+ num_classes = (int) lua_rawlen (L, 1);
|
||||
removed = 0;
|
||||
lua_pushnil (L); /* first key */
|
||||
while (lua_next (L, 1) != 0)
|
||||
@@ -743,7 +743,7 @@ dir_gc (lua_State * L)
|
||||
|
||||
/**********************************************************/
|
||||
|
@ -13,3 +31,27 @@ Fix build with lua-5.2.
|
|||
{"create_db", lua_osbf_createdb},
|
||||
{"remove_db", lua_osbf_removedb},
|
||||
{"config", lua_osbf_config},
|
||||
@@ -767,6 +767,8 @@ static const struct luaL_reg osbf[] = {
|
||||
int
|
||||
luaopen_osbf (lua_State * L)
|
||||
{
|
||||
+ size_t n_funcs;
|
||||
+
|
||||
/* Open dir function */
|
||||
luaL_newmetatable (L, "LuaBook.dir");
|
||||
/* set its __gc field */
|
||||
@@ -774,7 +776,13 @@ luaopen_osbf (lua_State * L)
|
||||
lua_pushcfunction (L, dir_gc);
|
||||
lua_settable (L, -3);
|
||||
|
||||
- luaL_register (L, "osbf", osbf);
|
||||
+ n_funcs = sizeof(osbf)/sizeof(*osbf) - 1;
|
||||
+ lua_createtable( L, 0, n_funcs );
|
||||
+ luaL_setfuncs( L, osbf, 0 );
|
||||
+
|
||||
+ lua_pushvalue( L, -1 );
|
||||
+ lua_setglobal( L, "osbf" );
|
||||
+
|
||||
set_info (L);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue