From a2aa79626a4a3e2026e37a847c5ba0c6ea251fb9 Mon Sep 17 00:00:00 2001 From: wiz Date: Fri, 11 Oct 2013 20:25:34 +0000 Subject: More fixes for lua-5.2. From https://github.com/arunpersaud/osbf-lua with the help of John R. Shannon. Bump PKGREVISION. --- mail/OSBF-lua/Makefile | 41 +++++++++++++++---------------- mail/OSBF-lua/PLIST | 6 ++--- mail/OSBF-lua/distinfo | 6 ++--- mail/OSBF-lua/patches/patch-aa | 4 ++-- mail/OSBF-lua/patches/patch-losbflib.c | 44 +++++++++++++++++++++++++++++++++- 5 files changed, 72 insertions(+), 29 deletions(-) (limited to 'mail') diff --git a/mail/OSBF-lua/Makefile b/mail/OSBF-lua/Makefile index b3b784b2697..4bde32e05f9 100644 --- a/mail/OSBF-lua/Makefile +++ b/mail/OSBF-lua/Makefile @@ -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/ @@ -17,24 +17,25 @@ USE_TOOLS+= gmake INSTALL_TARGET= install install_spamfilter -SUBST_CLASSES+= path -SUBST_STAGE.path= post-patch -SUBST_MESSAGE.path= Fixing paths in config -SUBST_FILES.path= config -SUBST_FILES.path+= spamfilter/cache_report.lua -SUBST_FILES.path+= spamfilter/classify.sample -SUBST_FILES.path+= spamfilter/create_databases.lua -SUBST_FILES.path+= spamfilter/database_status.lua -SUBST_FILES.path+= spamfilter/getopt.lua -SUBST_FILES.path+= spamfilter/promailrc.sample -SUBST_FILES.path+= spamfilter/random.lua -SUBST_FILES.path+= spamfilter/roc.lua -SUBST_FILES.path+= spamfilter/spamfilter.lua -SUBST_FILES.path+= spamfilter/spamfilter_commands.lua -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_CLASSES+= path +SUBST_STAGE.path= post-patch +SUBST_MESSAGE.path= Fixing paths in config +SUBST_FILES.path= config +SUBST_FILES.path+= spamfilter/cache_report.lua +SUBST_FILES.path+= spamfilter/classify.sample +SUBST_FILES.path+= spamfilter/create_databases.lua +SUBST_FILES.path+= spamfilter/database_status.lua +SUBST_FILES.path+= spamfilter/getopt.lua +SUBST_FILES.path+= spamfilter/promailrc.sample +SUBST_FILES.path+= spamfilter/random.lua +SUBST_FILES.path+= spamfilter/roc.lua +SUBST_FILES.path+= spamfilter/spamfilter.lua +SUBST_FILES.path+= spamfilter/spamfilter_commands.lua +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" diff --git a/mail/OSBF-lua/PLIST b/mail/OSBF-lua/PLIST index 07a411e1cda..03e165ffec5 100644 --- a/mail/OSBF-lua/PLIST +++ b/mail/OSBF-lua/PLIST @@ -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 diff --git a/mail/OSBF-lua/distinfo b/mail/OSBF-lua/distinfo index 655a9473913..4abb760aba3 100644 --- a/mail/OSBF-lua/distinfo +++ b/mail/OSBF-lua/distinfo @@ -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 diff --git a/mail/OSBF-lua/patches/patch-aa b/mail/OSBF-lua/patches/patch-aa index a27b1644a28..d91c00c87d9 100644 --- a/mail/OSBF-lua/patches/patch-aa +++ b/mail/OSBF-lua/patches/patch-aa @@ -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 diff --git a/mail/OSBF-lua/patches/patch-losbflib.c b/mail/OSBF-lua/patches/patch-losbflib.c index 0baed0757c8..fc4cf06713c 100644 --- a/mail/OSBF-lua/patches/patch-losbflib.c +++ b/mail/OSBF-lua/patches/patch-losbflib.c @@ -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; + } -- cgit v1.2.3