Resolves: #1098392 - link against lua51 instead of lua50

This commit is contained in:
Kamil Dudka 2014-05-21 12:24:09 +02:00
parent f3464b7f8e
commit 74a4802083
2 changed files with 164 additions and 2 deletions

154
elinks-0.12pre6-lua51.patch Normal file
View File

@ -0,0 +1,154 @@
From 0b72059e1bebb52f41a93de710ae12577769fb50 Mon Sep 17 00:00:00 2001
From: Miciah Dashiel Butler Masters <miciah.masters@gmail.com>
Date: Sun, 5 Apr 2009 12:57:35 +0000
Subject: [PATCH 1/2] Lua: Report bad arguments to edit_bookmark_dialoga
If edit_bookamrk_dialogs is given the wrong number or types of
arguments, report the problem to the user instead of failing silently.
[upstream commit 6a8e0ccd9bdb06e440b7b147c61f7741dd6d1fcd]
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/scripting/lua/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c
index bff037b..7712dcd 100644
--- a/src/scripting/lua/core.c
+++ b/src/scripting/lua/core.c
@@ -369,6 +369,7 @@ l_edit_bookmark_dialog(LS)
if (!lua_isstring(S, 1) || !lua_isstring(S, 2)
|| !lua_isstring(S, 3) || !lua_isfunction(S, 4)) {
+ alert_lua_error("bad arguments to edit_bookmark_dialog");
lua_pushnil(S);
return 1;
}
--
1.8.3.1
From 8ce643a489dd8dc195aa2f8dc4029ce347093c98 Mon Sep 17 00:00:00 2001
From: Witold Filipczyk <witekfl@poczta.onet.pl>
Date: Wed, 21 Jul 2010 19:07:49 +0200
Subject: [PATCH 2/2] Link against lua51, not lua50.
[upstream commit 331a4dc62b0dbdecba3857d87dc4e12660e5d705]
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
configure.in | 16 +++++++---------
src/scripting/lua/core.c | 13 +++++--------
src/scripting/lua/hooks.c | 6 +++++-
3 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/configure.in b/configure.in
index 3ef8603..ca138ac 100644
--- a/configure.in
+++ b/configure.in
@@ -854,10 +854,10 @@ if test -z "$disable_lua"; then
withval="";
fi
for luadir in "$withval" "" /usr /usr/local; do
- for suffix in "" 50; do
+ for suffix in "" 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_LIBS="-L$luadir/lib -llua$suffix -lm"
LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
LIBS="$LUA_LIBS $LIBS_X"
@@ -865,13 +865,11 @@ if test -z "$disable_lua"; then
CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
# Check that it is a compatible Lua version
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lua.h>
- #include <lualib.h>]], [[ lua_State *L = lua_open();
- luaopen_base(L);
- luaopen_table(L);
- luaopen_io(L);
- luaopen_string(L);
- luaopen_math(L);
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lauxlib.h>]
+ #include <lua.h>
+ #include <lualib.h>
+ ], [[ lua_State *L = luaL_newstate();
+ luaL_openlibs(L);
lua_pushboolean(L, 1);
lua_close(L);]])],[cf_result=yes],[cf_result=no])
fi
diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c
index 7712dcd..1c4dbbc 100644
--- a/src/scripting/lua/core.c
+++ b/src/scripting/lua/core.c
@@ -12,6 +12,7 @@
#include <unistd.h>
#endif
+#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
@@ -659,7 +660,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);
}
@@ -670,13 +671,9 @@ do_hooks_file(LS, unsigned char *prefix, unsigned char *filename)
void
init_lua(struct module *module)
{
- L = lua_open();
+ L = luaL_newstate();
- 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);
@@ -781,7 +778,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();
}
diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c
index d79ad80..49b6414 100644
--- a/src/scripting/lua/hooks.c
+++ b/src/scripting/lua/hooks.c
@@ -4,6 +4,10 @@
#include "config.h"
#endif
+#include <lauxlib.h>
+#include <lua.h>
+#include <lualib.h>
+
#include "elinks.h"
#include "cache/cache.h"
@@ -200,7 +204,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();
}
--
1.8.3.1

View File

@ -3,7 +3,7 @@
Name: elinks
Summary: A text-mode Web browser
Version: 0.12
Release: 0.38.%{prerel}%{?dist}
Release: 0.39.%{prerel}%{?dist}
License: GPLv2
URL: http://elinks.or.cz
Group: Applications/Internet
@ -17,6 +17,7 @@ BuildRequires: gpm-devel
BuildRequires: js-devel
BuildRequires: krb5-devel
BuildRequires: libidn-devel
BuildRequires: lua-devel
BuildRequires: nss_compat_ossl-devel
BuildRequires: pkgconfig
BuildRequires: zlib-devel
@ -43,6 +44,7 @@ Patch12: elinks-0.12pre5-ddg-search.patch
Patch13: elinks-0.12pre6-autoconf.patch
Patch14: elinks-0.12pre6-ssl-hostname.patch
Patch15: elinks-0.12pre6-list_is_singleton.patch
Patch16: elinks-0.12pre6-lua51.patch
%description
Elinks is a text-based Web browser. Elinks does not display any images,
@ -95,6 +97,9 @@ quickly and swiftly displays Web pages.
# let list_is_singleton() return false for an empty list (#1075415)
%patch15 -p1
# use later versions of lua since lua50 is not available (#1098392)
%patch16 -p1
# remove bogus serial numbers
sed -i 's/^# *serial [AM0-9]*$//' acinclude.m4 config/m4/*.m4
@ -107,7 +112,7 @@ autoheader
export CFLAGS="$RPM_OPT_FLAGS $(getconf LFS_CFLAGS) -D_GNU_SOURCE"
%configure %{?rescue:--without-gpm} --without-x --with-gssapi \
--enable-bittorrent --with-nss_compat_ossl --enable-256-colors \
--without-openssl --without-gnutls
--without-openssl --without-gnutls --with-lua
# uncomment to turn off optimizations
#sed -i 's/-O2/-O0/' Makefile.config
@ -163,6 +168,9 @@ exit 0
%{_mandir}/man5/*
%changelog
* Wed May 21 2014 Kamil Dudka <kdudka@redhat.com> - 0.12-0.39.pre6
- use later versions of lua since lua50 is not available (#1098392)
* Tue Apr 29 2014 Kamil Dudka <kdudka@redhat.com> - 0.12-0.38.pre6
- let list_is_singleton() return false for an empty list (#1075415)