elinks-0.11.1: patches for compilation against lua-5.1.1

Thomas Klausner <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
Hi!

lua 5.1.1 has some API changes compared to 5.0 that break elinks-0.11.1.
One of them is that liblualib was been folded into liblua.

configure breaks with:
conftest.c: In function 'main':
conftest.c:130: warning: implicit declaration of function 'luaL_newstate'
conftest.c:130: warning: initialization makes pointer from integer without a cast
conftest.c:131: warning: implicit declaration of function 'lua_baselibopen'
conftest.c:132: warning: implicit declaration of function 'lua_mathlibopen'
conftest.c:133: warning: implicit declaration of function 'lua_strlibopen'
conftest.c:134: warning: implicit declaration of function 'lua_tablibopen'
/var/tmp//ccYrS9zX.o: In function `main':
conftest.c:(.text+0x1b): undefined reference to `lua_baselibopen'
conftest.c:(.text+0x23): undefined reference to `lua_mathlibopen'
conftest.c:(.text+0x2b): undefined reference to `lua_strlibopen'
conftest.c:(.text+0x33): undefined reference to `lua_tablibopen'

patch-aa solves this one and the removed library.

Later, linking fails with:
lib.o: In function `handle_ret_eval':
core.c:(.text+0x5907b): undefined reference to `lua_dostring'
lib.o: In function `do_hooks_file':
core.c:(.text+0x59144): undefined reference to `lua_dofile'
lib.o: In function `script_hook_quit':
hooks.c:(.text+0x5a997): undefined reference to `lua_dostring'

patch-ab and patch-ac solve these.

Please test and integrate them in some way!

Thanks,
 Thomas

P.S.: Please cc me any replies, I'm not on this list.

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
patch-aa (text/plain, 742 B)
$NetBSD$

--- configure.orig	2006-01-29 13:10:47.000000000 +0000
+++ configure
@@ -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);
   ;
patch-ab (text/plain, 613 B)
$NetBSD$

--- src/scripting/lua/core.c.orig	2006-01-29 13:10:39.000000000 +0000
+++ src/scripting/lua/core.c
@@ -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);
 	}
@@ -755,7 +755,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();
 		}
patch-ac (text/plain, 384 B)
$NetBSD$

--- src/scripting/lua/hooks.c.orig	2006-01-29 13:10:39.000000000 +0000
+++ src/scripting/lua/hooks.c
@@ -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();
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.