Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/elinks/, www-client/elinks/files/
Date: Mon, 26 Mar 2018 18:07:28
Message-Id: 1522087628.951209198db135ba00611ae2b54e300e022fbd10.jer@gentoo
1 commit: 951209198db135ba00611ae2b54e300e022fbd10
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Mon Mar 26 18:02:33 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 26 18:07:08 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95120919
7
8 www-client/elinks: Fix ruby check/compat by Felix Janda (bug #649948).
9
10 Package-Manager: Portage-2.3.24, Repoman-2.3.6
11
12 .../elinks/elinks-0.13_pre_pre20180225.ebuild | 3 +-
13 www-client/elinks/files/elinks-0.13-ruby.patch | 183 +++++++++++++++++++++
14 2 files changed, 185 insertions(+), 1 deletion(-)
15
16 diff --git a/www-client/elinks/elinks-0.13_pre_pre20180225.ebuild b/www-client/elinks/elinks-0.13_pre_pre20180225.ebuild
17 index a0b8366f121..9a4f291cc06 100644
18 --- a/www-client/elinks/elinks-0.13_pre_pre20180225.ebuild
19 +++ b/www-client/elinks/elinks-0.13_pre_pre20180225.ebuild
20 @@ -43,7 +43,8 @@ RDEPEND="${DEPEND}"
21
22 PATCHES=(
23 "${FILESDIR}"/${PN}-9999-parallel-make.patch
24 - )
25 + "${FILESDIR}"/${PN}-0.13-ruby.patch
26 +)
27
28 src_prepare() {
29 default
30
31 diff --git a/www-client/elinks/files/elinks-0.13-ruby.patch b/www-client/elinks/files/elinks-0.13-ruby.patch
32 new file mode 100644
33 index 00000000000..a716439b512
34 --- /dev/null
35 +++ b/www-client/elinks/files/elinks-0.13-ruby.patch
36 @@ -0,0 +1,183 @@
37 +--- a/config/m4/ruby.m4
38 ++++ b/config/m4/ruby.m4
39 +@@ -32,36 +32,40 @@ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then
40 + if test "$CONFIG_SCRIPTING_RUBY" != "no"; then
41 +
42 + AC_MSG_CHECKING(Ruby version)
43 +- if $CONFIG_SCRIPTING_RUBY -e 'exit((VERSION or RUBY_VERSION) >= "1.6.0")' >/dev/null 2>/dev/null; then
44 ++ if $CONFIG_SCRIPTING_RUBY -e 'exit((VERSION rescue RUBY_VERSION) >= "1.6.0")' >/dev/null 2>/dev/null; then
45 + ruby_version=`$CONFIG_SCRIPTING_RUBY -e 'puts "#{VERSION rescue RUBY_VERSION}"'`
46 + AC_MSG_RESULT($ruby_version)
47 +
48 + AC_MSG_CHECKING(for Ruby header files)
49 +- rubyhdrdir=`$CONFIG_SCRIPTING_RUBY -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
50 ++ rubyhdrdir=`$CONFIG_SCRIPTING_RUBY -r mkmf -e 'print RbConfig::CONFIG[["rubyhdrdir"]] || RbConfig::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
51 +
52 + if test "X$rubyhdrdir" != "X"; then
53 + AC_MSG_RESULT($rubyhdrdir)
54 + RUBY_CFLAGS="-I$rubyhdrdir"
55 +- rubylibs=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
56 ++ rubyarch=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig::CONFIG[["arch"]]'`
57 ++ if test -d "$rubyhdrdir/$rubyarch"; then
58 ++ RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
59 ++ fi
60 ++ rubylibs=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig::CONFIG[["LIBS"]]'`
61 +
62 + if test "X$rubylibs" != "X"; then
63 + RUBY_LIBS="$rubylibs"
64 + fi
65 +
66 +- librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
67 ++ librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig.expand(RbConfig::CONFIG[["LIBRUBYARG"]])'`
68 +
69 + if test -f "$rubyhdrdir/$librubyarg"; then
70 + librubyarg="$rubyhdrdir/$librubyarg"
71 +
72 + else
73 +- rubylibdir=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
74 ++ rubylibdir=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig.expand(RbConfig::CONFIG[["libdir"]])'`
75 + if test -f "$rubylibdir/$librubyarg"; then
76 + librubyarg="$rubylibdir/$librubyarg"
77 + elif test "$librubyarg" = "libruby.a"; then
78 + dnl required on Mac OS 10.3 where libruby.a doesn't exist
79 + librubyarg="-lruby"
80 + else
81 +- librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
82 ++ librubyarg=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{RbConfig.expand(RbConfig::CONFIG[\"libdir\"])}')"`
83 + fi
84 + fi
85 +
86 +@@ -69,7 +73,7 @@ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then
87 + RUBY_LIBS="$librubyarg $RUBY_LIBS"
88 + fi
89 +
90 +- rubyldflags=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
91 ++ rubyldflags=`$CONFIG_SCRIPTING_RUBY -r rbconfig -e 'print RbConfig::CONFIG[["LDFLAGS"]]'`
92 + if test "X$rubyldflags" != "X"; then
93 + LDFLAGS="$rubyldflags $LDFLAGS"
94 + fi
95 +@@ -86,6 +90,15 @@ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then
96 + AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
97 + fi
98 + fi
99 ++ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then
100 ++ AC_MSG_CHECKING([for rb_errinfo])
101 ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ruby.h>]], [[rb_errinfo();]])],have_rb_errinfo="yes",have_rb_errinfo="no")
102 ++ AC_MSG_RESULT($have_rb_errinfo)
103 ++ if test "$have_rb_errinfo" = "yes"; then
104 ++ AC_DEFINE([HAVE_RB_ERRINFO], [1],
105 ++ [Define to 1 if you have the `rb_errinfo' function.])
106 ++ fi
107 ++ fi
108 + fi
109 +
110 + EL_RESTORE_FLAGS
111 +--- a/src/scripting/ruby/core.c
112 ++++ b/src/scripting/ruby/core.c
113 +@@ -76,10 +76,10 @@ erb_report_error(struct session *ses, int error)
114 + break;
115 + case TAG_RAISE:
116 + case TAG_FATAL:
117 +- eclass = CLASS_OF(ruby_errinfo);
118 +- einfo = rb_obj_as_string(ruby_errinfo);
119 ++ eclass = CLASS_OF(RB_ERRINFO);
120 ++ einfo = rb_obj_as_string(RB_ERRINFO);
121 +
122 +- if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) {
123 ++ if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
124 + msg = "unhandled exception";
125 +
126 + } else {
127 +@@ -88,7 +88,7 @@ erb_report_error(struct session *ses, int error)
128 +
129 + epath = rb_class_path(eclass);
130 + snprintf(buff, MAX_STR_LEN, "%s: %s",
131 +- RSTRING(epath)->ptr, RSTRING(einfo)->ptr);
132 ++ RSTRING_PTR(epath), RSTRING_PTR(einfo));
133 +
134 + p = strchr((const char *)buff, '\n');
135 + if (p) *p = '\0';
136 +@@ -116,7 +116,7 @@ erb_module_message(VALUE self, VALUE str)
137 + struct terminal *term;
138 +
139 + str = rb_obj_as_string(str);
140 +- message = memacpy(RSTRING(str)->ptr, RSTRING(str)->len);
141 ++ message = memacpy(RSTRING_PTR(str), RSTRING_PTR(str));
142 + if (!message) return Qnil;
143 +
144 + line_end = strchr((const char *)message, '\n');
145 +@@ -165,8 +165,8 @@ erb_stdout_p(int argc, VALUE *argv, VALUE self)
146 + * the inspect() method, which adds quotes to the strings, so
147 + * gently ignore them. */
148 +
149 +- ptr = RSTRING(substr)->ptr;
150 +- len = RSTRING(substr)->len;
151 ++ ptr = RSTRING_PTR(substr);
152 ++ len = RSTRING_LEN(substr);
153 +
154 + if (*ptr == '"')
155 + ptr++, len--;
156 +--- a/src/scripting/ruby/core.h
157 ++++ b/src/scripting/ruby/core.h
158 +@@ -7,6 +7,20 @@ struct session;
159 +
160 + #include <ruby.h> /* for VALUE */
161 +
162 ++#ifndef RSTRING_LEN
163 ++#define RSTRING_LEN(string) (RSTRING(string)->len)
164 ++#endif
165 ++
166 ++#ifndef RSTRING_PTR
167 ++#define RSTRING_PTR(string) (RSTRING(string)->ptr)
168 ++#endif
169 ++
170 ++#ifdef HAVE_RB_ERRINFO
171 ++#define RB_ERRINFO (rb_errinfo())
172 ++#else
173 ++#define RB_ERRINFO (ruby_errinfo)
174 ++#endif
175 ++
176 + VALUE erb_module;
177 +
178 + void alert_ruby_error(struct session *ses, unsigned char *msg);
179 +--- a/src/scripting/ruby/hooks.c
180 ++++ b/src/scripting/ruby/hooks.c
181 +@@ -83,7 +83,7 @@ script_hook_goto_url(va_list ap, void *data)
182 + {
183 + unsigned char *new_url;
184 +
185 +- new_url = memacpy(RSTRING(result)->ptr, RSTRING(result)->len);
186 ++ new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result));
187 + if (new_url) {
188 + mem_free_set(url, new_url);
189 + }
190 +@@ -126,7 +126,7 @@ script_hook_follow_url(va_list ap, void *data)
191 + {
192 + unsigned char *new_url;
193 +
194 +- new_url = memacpy(RSTRING(result)->ptr, RSTRING(result)->len);
195 ++ new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result));
196 + if (new_url) {
197 + mem_free_set(url, new_url);
198 + }
199 +@@ -170,9 +170,9 @@ script_hook_pre_format_html(va_list ap, void *data)
200 + switch (rb_type(result)) {
201 + case T_STRING:
202 + {
203 +- int len = RSTRING(result)->len;
204 ++ int len = RSTRING_LEN(result);
205 +
206 +- add_fragment(cached, 0, RSTRING(result)->ptr, len);
207 ++ add_fragment(cached, 0, RSTRING_PTR(result), len);
208 + normalize_cache_entry(cached, len);
209 +
210 + break;
211 +@@ -216,7 +216,7 @@ script_hook_get_proxy(va_list ap, void *data)
212 + {
213 + unsigned char *proxy;
214 +
215 +- proxy = memacpy(RSTRING(result)->ptr, RSTRING(result)->len);
216 ++ proxy = memacpy(RSTRING_PTR(result), RSTRING_LEN(result));
217 + if (proxy) {
218 + mem_free_set(new_proxy_url, proxy);
219 + }