-
Notifications
You must be signed in to change notification settings - Fork 0
/
elinks-0.13.20160821.diff
219 lines (190 loc) · 8.37 KB
/
elinks-0.13.20160821.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# Patch to fix cofiguring and building with Ruby 1.9 and Lua 5.2
# See https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/elinks/files/elinks-0.12_pre5-ruby-1.9.patch
diff -urNad elinks-0.13.20160821-orig/config/m4/ruby.m4 elinks-0.13.20160821/config/m4/ruby.m4
--- elinks-0.13.20160821-orig/config/m4/ruby.m4 2016-10-25 21:39:01.000000000 +0300
+++ elinks-0.13.20160821/config/m4/ruby.m4 2016-10-25 21:52:50.000000000 +0300
@@ -32,36 +32,40 @@
if test "$CONFIG_SCRIPTING_RUBY" != "no"; then
AC_MSG_CHECKING(Ruby version)
- if $CONFIG_SCRIPTING_RUBY -e 'exit((VERSION or RUBY_VERSION) >= "1.6.0")' >/dev/null 2>/dev/null; then
+ if $CONFIG_SCRIPTING_RUBY -e 'exit((VERSION rescue RUBY_VERSION) >= "1.6.0")' >/dev/null 2>/dev/null; then
ruby_version=`$CONFIG_SCRIPTING_RUBY -e 'puts "#{VERSION rescue RUBY_VERSION}"'`
AC_MSG_RESULT($ruby_version)
AC_MSG_CHECKING(for Ruby header files)
- rubyhdrdir=`$CONFIG_SCRIPTING_RUBY -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
+ rubyhdrdir=`$CONFIG_SCRIPTING_RUBY -r mkmf -e 'print RbConfig::CONFIG[["rubyhdrdir"]] || RbConfig::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
if test "X$rubyhdrdir" != "X"; then
AC_MSG_RESULT($rubyhdrdir)
RUBY_CFLAGS="-I$rubyhdrdir"
- rubylibs=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
+ rubyarch=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig::CONFIG[["arch"]]'`
+ if test -d "$rubyhdrdir/$rubyarch"; then
+ RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
+ fi
+ rubylibs=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig::CONFIG[["LIBS"]]'`
if test "X$rubylibs" != "X"; then
RUBY_LIBS="$rubylibs"
fi
- librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
+ librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig.expand(RbConfig::CONFIG[["LIBRUBYARG"]])'`
if test -f "$rubyhdrdir/$librubyarg"; then
librubyarg="$rubyhdrdir/$librubyarg"
else
- rubylibdir=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
+ rubylibdir=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig.expand(RbConfig::CONFIG[["libdir"]])'`
if test -f "$rubylibdir/$librubyarg"; then
librubyarg="$rubylibdir/$librubyarg"
elif test "$librubyarg" = "libruby.a"; then
dnl required on Mac OS 10.3 where libruby.a doesn't exist
librubyarg="-lruby"
else
- librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
+ librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{RbConfig.expand(RbConfig::CONFIG[\"libdir\"])}')"`
fi
fi
@@ -69,7 +73,7 @@
RUBY_LIBS="$librubyarg $RUBY_LIBS"
fi
- rubyldflags=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
+ rubyldflags=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig::CONFIG[["LDFLAGS"]]'`
if test "X$rubyldflags" != "X"; then
LDFLAGS="$rubyldflags $LDFLAGS"
fi
@@ -86,6 +90,15 @@
AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
fi
fi
+ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then
+ AC_MSG_CHECKING([for rb_errinfo])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ruby.h>]], [[rb_errinfo();]])],have_rb_errinfo="yes",have_rb_errinfo="no")
+ AC_MSG_RESULT($have_rb_errinfo)
+ if test "$have_rb_errinfo" = "yes"; then
+ AC_DEFINE([HAVE_RB_ERRINFO], [1],
+ [Define to 1 if you have the `rb_errinfo' function.])
+ fi
+ fi
fi
EL_RESTORE_FLAGS
# Use Lua 5.2 and library without suffix
diff -urNad elinks-0.13.20160821-orig/configure.in elinks-0.13.20160821/configure.in
--- elinks-0.13.20160821-orig/configure.in 2016-10-25 21:39:01.000000000 +0300
+++ elinks-0.13.20160821/configure.in 2016-10-25 22:07:41.000000000 +0300
@@ -902,10 +902,10 @@
withval="";
fi
for luadir in "$withval" "" /usr /usr/local; do
- for suffix in "" 5.1 51; do
+ for suffix in "" 5.2 52; 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 -lm"
+ LUA_LIBS="-L$luadir/lib -llua -lm"
LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
LIBS="$LUA_LIBS $LIBS_X"
# Fix compile issue due to API changes in Lua 5.2
diff -urNad elinks-0.13.20160821-orig/src/scripting/lua/hooks.c elinks-0.13.20160821/src/scripting/lua/hooks.c
--- elinks-0.13.20160821-orig/src/scripting/lua/hooks.c 2016-10-25 21:40:14.000000000 +0300
+++ elinks-0.13.20160821/src/scripting/lua/hooks.c 2016-10-25 22:10:21.000000000 +0300
@@ -144,7 +144,7 @@
if (err) return EVENT_HOOK_STATUS_NEXT;
if (lua_isstring(L, -1)) {
- int len = lua_strlen(L, -1);
+ int len = lua_rawlen(L, -1);
add_fragment(cached, 0, (unsigned char *) lua_tostring(L, -1), len);
normalize_cache_entry(cached, len);
diff -urNad elinks-0.13.20160821-orig/src/scripting/ruby/core.c elinks-0.13.20160821/src/scripting/ruby/core.c
--- elinks-0.13.20160821-orig/src/scripting/ruby/core.c 2016-10-25 21:40:18.000000000 +0300
+++ elinks-0.13.20160821/src/scripting/ruby/core.c 2016-10-25 21:52:50.000000000 +0300
@@ -76,10 +76,10 @@
break;
case TAG_RAISE:
case TAG_FATAL:
- eclass = CLASS_OF(ruby_errinfo);
- einfo = rb_obj_as_string(ruby_errinfo);
+ eclass = CLASS_OF(RB_ERRINFO);
+ einfo = rb_obj_as_string(RB_ERRINFO);
- if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) {
+ if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
msg = "unhandled exception";
} else {
@@ -88,7 +88,7 @@
epath = rb_class_path(eclass);
snprintf(buff, MAX_STR_LEN, "%s: %s",
- RSTRING(epath)->ptr, RSTRING(einfo)->ptr);
+ RSTRING_PTR(epath), RSTRING_PTR(einfo));
p = strchr((const char *)buff, '\n');
if (p) *p = '\0';
@@ -116,7 +116,7 @@
struct terminal *term;
str = rb_obj_as_string(str);
- message = memacpy(RSTRING(str)->ptr, RSTRING(str)->len);
+ message = memacpy(RSTRING_PTR(str), RSTRING_LEN(str));
if (!message) return Qnil;
line_end = strchr((const char *)message, '\n');
@@ -165,8 +165,8 @@
* the inspect() method, which adds quotes to the strings, so
* gently ignore them. */
- ptr = RSTRING(substr)->ptr;
- len = RSTRING(substr)->len;
+ ptr = RSTRING_PTR(substr);
+ len = RSTRING_LEN(substr);
if (*ptr == '"')
ptr++, len--;
diff -urNad elinks-0.13.20160821-orig/src/scripting/ruby/core.h elinks-0.13.20160821/src/scripting/ruby/core.h
--- elinks-0.13.20160821-orig/src/scripting/ruby/core.h 2016-10-25 21:40:18.000000000 +0300
+++ elinks-0.13.20160821/src/scripting/ruby/core.h 2016-10-25 21:52:50.000000000 +0300
@@ -7,6 +7,20 @@
#include <ruby.h> /* for VALUE */
+#ifndef RSTRING_LEN
+#define RSTRING_LEN(string) (RSTRING(string)->len)
+#endif
+
+#ifndef RSTRING_PTR
+#define RSTRING_PTR(string) (RSTRING(string)->ptr)
+#endif
+
+#ifdef HAVE_RB_ERRINFO
+#define RB_ERRINFO (rb_errinfo())
+#else
+#define RB_ERRINFO (ruby_errinfo)
+#endif
+
VALUE erb_module;
void alert_ruby_error(struct session *ses, unsigned char *msg);
diff -urNad elinks-0.13.20160821-orig/src/scripting/ruby/hooks.c elinks-0.13.20160821/src/scripting/ruby/hooks.c
--- elinks-0.13.20160821-orig/src/scripting/ruby/hooks.c 2016-10-25 21:40:18.000000000 +0300
+++ elinks-0.13.20160821/src/scripting/ruby/hooks.c 2016-10-25 21:52:50.000000000 +0300
@@ -83,7 +83,7 @@
{
unsigned char *new_url;
- new_url = memacpy(RSTRING(result)->ptr, RSTRING(result)->len);
+ new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result));
if (new_url) {
mem_free_set(url, new_url);
}
@@ -126,7 +126,7 @@
{
unsigned char *new_url;
- new_url = memacpy(RSTRING(result)->ptr, RSTRING(result)->len);
+ new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result));
if (new_url) {
mem_free_set(url, new_url);
}
@@ -170,9 +170,9 @@
switch (rb_type(result)) {
case T_STRING:
{
- int len = RSTRING(result)->len;
+ int len = RSTRING_LEN(result);
- add_fragment(cached, 0, RSTRING(result)->ptr, len);
+ add_fragment(cached, 0, RSTRING_PTR(result), len);
normalize_cache_entry(cached, len);
break;
@@ -216,7 +216,7 @@
{
unsigned char *proxy;
- proxy = memacpy(RSTRING(result)->ptr, RSTRING(result)->len);
+ proxy = memacpy(RSTRING_PTR(result), RSTRING_LEN(result));
if (proxy) {
mem_free_set(new_proxy_url, proxy);
}