Source: elinks
Source-Version: 0.12~pre5-7
Severity: normal
Tags: patch

Hi!

This is one of the only two remaining programs using Lua 5.0, it would
be nice to switch it to Lua 5.1 to reduce the amount of Lua instances
in the archive.

Attached a patch fixing this.

thanks,
guillem
>From 90ec58a744a970419bd2737558d0364640a95230 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Sat, 26 May 2012 01:46:40 +0200
Subject: [PATCH] Switch to use lua 5.1

---
 configure.in              |   10 ++++++++++
 debian/control            |    2 +-
 src/scripting/lua/core.c  |   10 +++-------
 src/scripting/lua/hooks.c |    2 +-
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/configure.in b/configure.in
index 155358e..56a4d9d 100644
--- a/configure.in
+++ b/configure.in
@@ -883,6 +883,16 @@ if test -z "$disable_lua"; then
 	if test ! -d "$withval"; then
 		withval="";
 	fi
+	if pkg-config lua5.1; then
+		LUA_CFLAGS=`pkg-config --cflags lua5.1`
+		LUA_LIBS=`pkg-config --libs lua5.1`
+
+		LIBS="$LUA_LIBS $LIBS_X"
+		CFLAGS="$CFLAGS_X $LUA_CFLAGS"
+		CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
+
+		cf_result=yes
+	fi
 	for luadir in "$withval" "" /usr /usr/local; do
 		for suffix in "" 50; do
 			if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
diff --git a/debian/control b/debian/control
index 4881906..af082e2 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Maintainer: Y Giridhar Appaji Nag <app...@debian.org>
 Uploaders: Moritz Muehlenhoff <j...@debian.org>
 Build-Depends: debhelper (>= 6.0.7~), libtre-dev, libgnutls-dev, libidn11-dev,
 	libfsplib-dev, libgpm-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64],
-	liblua50-dev, liblualib50-dev, libbz2-dev, libexpat1-dev (>= 1.95.6),
+	liblua5.1-dev, libbz2-dev, libexpat1-dev (>= 1.95.6),
 	libperl-dev, ruby, ruby1.8-dev, libkrb5-dev, gettext,
 	autotools-dev, python, xmlto, docbook-utils, pkg-config
 Standards-Version: 3.9.2
diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c
index 8aec3a9..2fc534c 100644
--- a/src/scripting/lua/core.c
+++ b/src/scripting/lua/core.c
@@ -658,7 +658,7 @@ do_hooks_file(LS, unsigned char *prefix, unsigned char *filename)
 	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);
 	}
@@ -671,11 +671,7 @@ init_lua(struct module *module)
 {
 	L = lua_open();
 
-	luaopen_base(L);
-	luaopen_table(L);
-	luaopen_io(L);
-	luaopen_string(L);
-	luaopen_math(L);
+	luaL_openlibs(L);
 
 	lua_register(L, LUA_ALERT, l_alert);
 	lua_register(L, "current_url", l_current_url);
@@ -780,7 +776,7 @@ handle_ret_eval(struct session *ses)
 		int oldtop = lua_gettop(L);
 
 		if (prepare_lua(ses) == 0) {
-			lua_dostring(L, expr);
+			(void) luaL_dostring(L, expr);
 			lua_settop(L, oldtop);
 			finish_lua();
 		}
diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c
index d79ad80..6613c50 100644
--- a/src/scripting/lua/hooks.c
+++ b/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");
+		(void) luaL_dostring(lua_state, "if quit_hook then quit_hook() end");
 		finish_lua();
 	}
 
-- 
1.7.10

Reply via email to