File use_lua-5.1.patch of Package elinks

Index: configure.in
===================================================================
--- configure.in.orig	2012-10-28 13:57:15.000000000 +0100
+++ configure.in	2016-04-26 10:16:22.984001853 +0200
@@ -834,11 +834,11 @@
 		withval="";
 	fi
 	for luadir in "$withval" "" /usr /usr/local; do
-		for suffix in "" 50; do
+		for suffix in "" 50 51; do
 			if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
 			   test -f "$luadir/include/lua$suffix/lua.h" ) ; then
-				LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
-				LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
+				LUA_LIBS=`pkg-config --libs lua`
+				LUA_CFLAGS=`pkg-config --cflags lua`
 
 				LIBS="$LUA_LIBS $LIBS_X"
 				CFLAGS="$CFLAGS_X $LUA_CFLAGS"
Index: src/scripting/lua/core.c
===================================================================
--- src/scripting/lua/core.c.orig	2012-10-28 13:57:15.000000000 +0100
+++ src/scripting/lua/core.c	2016-04-26 10:16:22.984001853 +0200
@@ -658,7 +658,7 @@
 	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 @@
 {
 	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 @@
 		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();
 		}
Index: src/scripting/lua/hooks.c
===================================================================
--- src/scripting/lua/hooks.c.orig	2012-10-28 13:57:15.000000000 +0100
+++ src/scripting/lua/hooks.c	2016-04-26 10:16:22.984001853 +0200
@@ -200,7 +200,7 @@
 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();
 	}
 
openSUSE Build Service is sponsored by