This update patches www/elinks to work with lang/lua-5.1.  It works
for me on i386.  Please test and commit.  Thanks!

James Prevatt
[EMAIL PROTECTED]
Index: Makefile
===================================================================
RCS file: /cvs/ports/www/elinks/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile    23 Jun 2006 12:32:33 -0000      1.5
+++ Makefile    19 Oct 2006 18:21:41 -0000
@@ -2,6 +2,7 @@
 
 COMMENT=               "full-featured text WWW browser"
 DISTNAME=              elinks-0.11.1
+PKGNAME=               ${DISTNAME}p0
 EXTRACT_SUFX=          .tar.bz2
 CATEGORIES=            www
 MASTER_SITES=          http://elinks.cz/download/
@@ -36,7 +37,7 @@
 
 .if ${FLAVOR:L:Mlua}
 CONFIGURE_ARGS+=       --with-lua
-LIB_DEPENDS+=          lua.5,lualib.5::lang/lua
+LIB_DEPENDS+=          lua.>=5.1::lang/lua
 WANTLIB+=              m
 .else
 CONFIGURE_ARGS+=       --without-lua
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/www/elinks/patches/patch-configure,v
retrieving revision 1.1
diff -u -r1.1 patch-configure
--- patches/patch-configure     29 Jan 2006 15:41:00 -0000      1.1
+++ patches/patch-configure     19 Oct 2006 18:21:41 -0000
@@ -1,7 +1,31 @@
 $OpenBSD: patch-configure,v 1.1 2006/01/29 15:41:00 sturm Exp $
---- configure.orig     Sun Jan  1 11:39:43 2006
-+++ configure  Wed Jan  4 14:18:10 2006
-@@ -22496,10 +22496,6 @@ ALL_CFLAGS="$CFLAGS $CPPFLAGS"
+--- configure.orig     Sun Jan 29 08:10:47 2006
++++ configure  Thu Oct 19 12:52:57 2006
+@@ -17103,7 +17103,7 @@ if test -z "$disable_lua"; then
+       for luadir in "$withval" "" /usr /usr/local; do
+               for suffix in "" 50 51; do
+                       if test "$cf_result" = no; then
+-                              LUA_LIBS="-llua$suffix -llualib$suffix -lm"
++                              LUA_LIBS="-llua$suffix -lm"
+ 
+                               if test ! -z "$luadir"; then
+                                       LUA_LIBS="-L$luadir/lib $LUA_LIBS"
+@@ -17127,10 +17127,10 @@ int
+ main ()
+ {
+       lua_State *L = lua_open();
+-                                              lua_baselibopen(L);
+-                                              lua_mathlibopen(L);
+-                                              lua_strlibopen(L);
+-                                              lua_tablibopen(L);
++                                              luaopen_base(L);
++                                              luaopen_math(L);
++                                              luaopen_string(L);
++                                              luaopen_table(L);
+                                               lua_pushboolean(L, 1);
+                                               lua_close(L);
+   ;
+@@ -22892,10 +22892,6 @@ ALL_CFLAGS="$CFLAGS $CPPFLAGS"
  
  
  
Index: patches/patch-src_scripting_lua_core_c
===================================================================
RCS file: patches/patch-src_scripting_lua_core_c
diff -N patches/patch-src_scripting_lua_core_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_scripting_lua_core_c      19 Oct 2006 18:21:41 -0000
@@ -0,0 +1,51 @@
+$OpenBSD$
+--- src/scripting/lua/core.c.orig      Sun Jan 29 08:10:39 2006
++++ src/scripting/lua/core.c   Thu Oct 19 14:10:34 2006
+@@ -633,7 +633,7 @@ do_hooks_file(LS, unsigned char *prefix,
+       if (file_can_read(file)) {
+               int oldtop = lua_gettop(S);
+ 
+-              if (lua_dofile(S, file) != 0)
++              if (luaL_dofile(S, file) != 0)
+                       sleep(3); /* Let some time to see error messages. */
+               lua_settop(S, oldtop);
+       }
+@@ -644,13 +644,24 @@ do_hooks_file(LS, unsigned char *prefix,
+ void
+ init_lua(struct module *module)
+ {
++      static const luaL_Reg lualibs[] = {
++              {"", luaopen_base},
++              {LUA_TABLIBNAME, luaopen_table},
++              {LUA_IOLIBNAME, luaopen_io},
++              {LUA_OSLIBNAME, luaopen_os},
++              {LUA_STRLIBNAME, luaopen_string},
++              {LUA_MATHLIBNAME, luaopen_math},
++              {NULL, NULL}
++      };
++      const luaL_Reg *lib = lualibs;
++
+       L = lua_open();
+ 
+-      luaopen_base(L);
+-      luaopen_table(L);
+-      luaopen_io(L);
+-      luaopen_string(L);
+-      luaopen_math(L);
++      for (; lib->func; lib++) {
++              lua_pushcfunction(L, lib->func);
++              lua_pushstring(L, lib->name);
++              lua_call(L, 1, 0);
++      }
+ 
+       lua_register(L, LUA_ALERT, l_alert);
+       lua_register(L, "current_url", l_current_url);
+@@ -755,7 +766,7 @@ handle_ret_eval(struct session *ses)
+               int oldtop = lua_gettop(L);
+ 
+               if (prepare_lua(ses) == 0) {
+-                      lua_dostring(L, expr);
++                      luaL_dostring(L, expr);
+                       lua_settop(L, oldtop);
+                       finish_lua();
+               }
Index: patches/patch-src_scripting_lua_hooks_c
===================================================================
RCS file: patches/patch-src_scripting_lua_hooks_c
diff -N patches/patch-src_scripting_lua_hooks_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_scripting_lua_hooks_c     19 Oct 2006 18:21:41 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- src/scripting/lua/hooks.c.orig     Thu Oct 19 12:54:09 2006
++++ src/scripting/lua/hooks.c  Thu Oct 19 12:54:25 2006
+@@ -200,7 +200,7 @@ static enum evhook_status
+ script_hook_quit(va_list ap, void *data)
+ {
+       if (!prepare_lua(NULL)) {
+-              lua_dostring(lua_state, "if quit_hook then quit_hook() end");
++              luaL_dostring(lua_state, "if quit_hook then quit_hook() end");
+               finish_lua();
+       }
+ 

Reply via email to