Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/ruby-scripts:master commit in: patchsets/patches-2.3.4-r2/, patchsets/patches-2.4.1-r2/, ...
Date: Sat, 27 May 2017 06:58:26
Message-Id: 1495868263.67be6af45f8b9730f178984f3fa7120bf560c93f.graaff@gentoo
1 commit: 67be6af45f8b9730f178984f3fa7120bf560c93f
2 Author: Hans de Graaff <hans <AT> degraaff <DOT> org>
3 AuthorDate: Sat May 27 06:57:43 2017 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Sat May 27 06:57:43 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/ruby-scripts.git/commit/?id=67be6af4
7
8 Add patchsets for -r2 revision of current ruby versions
9
10 Ruby 2.4:
11
12 Add USE=static-libs support on ruby 2.4, bug 618878
13 Allow better crossdev on windows with ruby 2.4, bug 618878
14
15 Thanks to ntzrmtthihu777 for providing patches.
16
17 Ruby 2.2, 2.3, 2.3:
18
19 Fix compilation on ia64, bug 561780
20
21 Thanks to slyfox for providing patches.
22
23 Ruby 2.2:
24
25 Backport tcl/tk security fixes, bug 605536
26
27 patchsets/patches-2.2.7-r2/001_ia64.patch | 62 ++++++++++++
28 patchsets/patches-2.2.7-r2/004_gfbsd7.patch | 37 +++++++
29 .../patches-2.2.7-r2/005_no-undefined-ext.patch | 11 ++
30 patchsets/patches-2.2.7-r2/006_tcltk1.patch | 27 +++++
31 patchsets/patches-2.2.7-r2/007_tcltk2.patch | 110 ++++++++++++++++++++
32 patchsets/patches-2.2.7-r2/009_no-gems.patch | 88 ++++++++++++++++
33 patchsets/patches-2.3.4-r2/001_ia64.patch | 62 ++++++++++++
34 patchsets/patches-2.3.4-r2/004_gfbsd7.patch | 37 +++++++
35 .../patches-2.3.4-r2/005_no-undefined-ext.patch | 11 ++
36 patchsets/patches-2.3.4-r2/009_no-gems.patch | 95 +++++++++++++++++
37 patchsets/patches-2.4.1-r2/001_ia64.patch | 62 ++++++++++++
38 .../patches-2.4.1-r2/002_windows_crossdev.patch | 64 ++++++++++++
39 .../patches-2.4.1-r2/005_no-undefined-ext.patch | 11 ++
40 patchsets/patches-2.4.1-r2/009_no-gems.patch | 112 +++++++++++++++++++++
41 14 files changed, 789 insertions(+)
42
43 diff --git a/patchsets/patches-2.2.7-r2/001_ia64.patch b/patchsets/patches-2.2.7-r2/001_ia64.patch
44 new file mode 100644
45 index 0000000..e1e9c89
46 --- /dev/null
47 +++ b/patchsets/patches-2.2.7-r2/001_ia64.patch
48 @@ -0,0 +1,62 @@
49 +Bug: https://bugs.gentoo.org/show_bug.cgi?id=561780
50 +
51 +fix crash on register stack mark/sweep pass
52 +
53 +The crash looks like
54 +
55 + Program received signal SIGSEGV, Segmentation fault.
56 + mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
57 + 3297 v = *x;
58 + (gdb) bt
59 + #0 mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
60 + #1 0x400000000014a040 in gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
61 + #2 0x400000000014b3a0 in mark_current_machine_context (objspace=0x6000000000045db0, th=0x60000000000455b0) at gc.c:3500
62 + #3 0x400000000014dfe0 in gc_mark_roots (objspace=0x6000000000045db0, full_mark=0, categoryp=0x0) at gc.c:4105
63 + #4 0x400000000014e6b0 in gc_marks_body (objspace=0x6000000000045db0, full_mark=0) at gc.c:4164
64 + #5 0x400000000014f260 in gc_marks (objspace=0x6000000000045db0, full_mark=0) at gc.c:4526
65 + #6 0x40000000001525c0 in garbage_collect_body (objspace=0x6000000000045db0, full_mark=0, immediate_sweep=0, reason=256) at gc.c:5024
66 + #7 0x400000000013c010 in heap_prepare_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1219
67 + #8 0x400000000013c140 in heap_get_freeobj_from_next_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1237
68 + #9 0x400000000013c360 in heap_get_freeobj (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1259
69 + #10 0x400000000013c950 in newobj_of (klass=0, flags=40, v1=0, v2=0, v3=0) at gc.c:1303
70 + #11 0x400000000013ccc0 in rb_newobj_of (klass=0, flags=40) at gc.c:1356
71 + #12 0x4000000000163740 in hash_alloc (klass=0) at hash.c:289
72 + #13 0x4000000000163860 in rb_hash_new () at hash.c:309
73 + #14 0x400000000050e420 in Init_BareVM () at vm.c:2822
74 + #15 0x40000000000f6b60 in ruby_setup () at eval.c:54
75 + #16 0x40000000000f6f50 in ruby_init () at eval.c:75
76 + #17 0x400000000001b010 in main (argc=9, argv=0x60000fffffffb1d8) at main.c:35
77 +
78 +The problem here is in call
79 + gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
80 +where 'start' (native_main_thread.register_stack_start)
81 +is supposed to be stack start but it's not initialized.
82 +
83 +The initialization of 'native_main_thread.register_stack_start'
84 +is supposed to be done in 'ruby_init_stack()'.
85 +
86 +But code under 'MAINSTACKADDR_AVAILABLE' exits early.
87 +The fix is to move 'register_stack_start' earlier.
88 +
89 +diff --git a/thread_pthread.c b/thread_pthread.c
90 +index c8a7a16..9ad448b 100644
91 +--- a/thread_pthread.c
92 ++++ b/thread_pthread.c
93 +@@ -722,2 +722,8 @@ ruby_init_stack(volatile VALUE *addr
94 + native_main_thread.id = pthread_self();
95 ++#ifdef __ia64
96 ++ if (!native_main_thread.register_stack_start ||
97 ++ (VALUE*)bsp < native_main_thread.register_stack_start) {
98 ++ native_main_thread.register_stack_start = (VALUE*)bsp;
99 ++ }
100 ++#endif
101 + #if MAINSTACKADDR_AVAILABLE
102 +@@ -745,8 +751,2 @@ ruby_init_stack(volatile VALUE *addr
103 + #endif
104 +-#ifdef __ia64
105 +- if (!native_main_thread.register_stack_start ||
106 +- (VALUE*)bsp < native_main_thread.register_stack_start) {
107 +- native_main_thread.register_stack_start = (VALUE*)bsp;
108 +- }
109 +-#endif
110 + {
111
112 diff --git a/patchsets/patches-2.2.7-r2/004_gfbsd7.patch b/patchsets/patches-2.2.7-r2/004_gfbsd7.patch
113 new file mode 100644
114 index 0000000..450d714
115 --- /dev/null
116 +++ b/patchsets/patches-2.2.7-r2/004_gfbsd7.patch
117 @@ -0,0 +1,37 @@
118 +--- configure.in.orig 2013-05-05 19:36:02.800254192 +0200
119 ++++ configure.in 2013-05-05 19:37:56.573346196 +0200
120 +@@ -2156,7 +2156,7 @@
121 + fi
122 +
123 + AS_CASE(["$target_os"],
124 +-[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl], [
125 ++[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl | freebsd* | dragonfly*], [
126 + if test "$rb_cv_binary_elf" = no; then
127 + with_dln_a_out=yes
128 + else
129 +@@ -2249,7 +2249,7 @@
130 + [bsdi3*], [ AS_CASE(["$CC"],
131 + [*shlicc*], [ : ${LDSHARED='$(CC) -r'}
132 + rb_cv_dlopen=yes])],
133 +- [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
134 ++ [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | freebsd7*], [
135 + : ${LDSHARED='$(CC) -shared'}
136 + if test "$rb_cv_binary_elf" = yes; then
137 + LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
138 +@@ -2262,7 +2262,6 @@
139 + [freebsd*|dragonfly*], [
140 + : ${LDSHARED='$(CC) -shared'}
141 + if test "$rb_cv_binary_elf" = yes; then
142 +- LDFLAGS="$LDFLAGS -rdynamic"
143 + DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
144 + else
145 + test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
146 +@@ -2638,7 +2637,7 @@
147 + [sunos4*], [
148 + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
149 + ],
150 +- [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [
151 ++ [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | freebsd7*], [
152 + LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'" $LDFLAGS_OPTDIR"
153 + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
154 + if test "$load_relative" = yes; then
155
156 diff --git a/patchsets/patches-2.2.7-r2/005_no-undefined-ext.patch b/patchsets/patches-2.2.7-r2/005_no-undefined-ext.patch
157 new file mode 100644
158 index 0000000..f279932
159 --- /dev/null
160 +++ b/patchsets/patches-2.2.7-r2/005_no-undefined-ext.patch
161 @@ -0,0 +1,11 @@
162 +--- ruby-1.9.3-preview1.orig/configure.in
163 ++++ ruby-1.9.3-preview1/configure.in
164 +@@ -2038,7 +2038,7 @@ if test "$with_dln_a_out" != yes; then
165 + [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
166 + : ${LDSHARED='$(CC) -shared'}
167 + if test "$rb_cv_binary_elf" = yes; then
168 +- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
169 ++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
170 + fi
171 + rb_cv_dlopen=yes],
172 + [interix*], [ : ${LDSHARED='$(CC) -shared'}
173
174 diff --git a/patchsets/patches-2.2.7-r2/006_tcltk1.patch b/patchsets/patches-2.2.7-r2/006_tcltk1.patch
175 new file mode 100644
176 index 0000000..a0e7444
177 --- /dev/null
178 +++ b/patchsets/patches-2.2.7-r2/006_tcltk1.patch
179 @@ -0,0 +1,27 @@
180 +From ebd0fc80d62eeb7b8556522256f8d035e013eb65 Mon Sep 17 00:00:00 2001
181 +From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
182 +Date: Sun, 2 Aug 2015 01:27:31 +0000
183 +Subject: [PATCH] tcltklib.c: check argument
184 +
185 +* ext/tk/tcltklib.c (ip_cancel_eval_core): check argument type and
186 + length.
187 +
188 +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
189 +---
190 + ext/tk/tcltklib.c | 3 ++-
191 + 1 file changed, 2 insertions(+), 1 deletion(-)
192 +
193 +diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
194 +index afcee3b..e305c13 100644
195 +--- a/ext/tk/tcltklib.c
196 ++++ b/ext/tk/tcltklib.c
197 +@@ -7745,7 +7745,8 @@ ip_cancel_eval_core(interp, msg, flag)
198 + if (NIL_P(msg)) {
199 + msg_obj = NULL;
200 + } else {
201 +- msg_obj = Tcl_NewStringObj(RSTRING_PTR(msg), RSTRING_LEN(msg));
202 ++ char *s = StringValuePtr(msg);
203 ++ msg_obj = Tcl_NewStringObj(s, RSTRING_LENINT(msg));
204 + Tcl_IncrRefCount(msg_obj);
205 + }
206 +
207
208 diff --git a/patchsets/patches-2.2.7-r2/007_tcltk2.patch b/patchsets/patches-2.2.7-r2/007_tcltk2.patch
209 new file mode 100644
210 index 0000000..2357898
211 --- /dev/null
212 +++ b/patchsets/patches-2.2.7-r2/007_tcltk2.patch
213 @@ -0,0 +1,110 @@
214 +From d098136e3f62a4879a7d7cd34bbd50f482ba3331 Mon Sep 17 00:00:00 2001
215 +From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
216 +Date: Tue, 9 Aug 2016 05:05:11 +0000
217 +Subject: [PATCH] tcltklib.c: use StringValueCStr [ci skip]
218 +
219 +* ext/tk/tcltklib.c (set_max_block_time, tcl_protect_core,
220 + ip_init, ip_create_slave_core, get_obj_from_str,
221 + ip_cancel_eval_core, lib_set_system_encoding,
222 + alloc_invoke_arguments, lib_merge_tklist): use StringValueCStr
223 + instead of StringValuePtr for values to be passed to Tcl
224 + interperter.
225 +
226 +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
227 +---
228 + ext/tk/tcltklib.c | 26 +++++++++++++-------------
229 + 1 file changed, 13 insertions(+), 13 deletions(-)
230 +
231 +diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
232 +index 430c934..721f497 100644
233 +--- a/ext/tk/tcltklib.c
234 ++++ b/ext/tk/tcltklib.c
235 +@@ -3303,7 +3303,7 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
236 + DUMP1("set backtrace");
237 + if (!NIL_P(backtrace = rb_funcallv(exc, ID_backtrace, 0, 0))) {
238 + backtrace = rb_ary_join(backtrace, rb_str_new2("\n"));
239 +- Tcl_AddErrorInfo(interp, StringValuePtr(backtrace));
240 ++ Tcl_AddErrorInfo(interp, StringValueCStr(backtrace));
241 + }
242 +
243 + rb_thread_critical = thr_crit_bup;
244 +@@ -6208,19 +6208,19 @@ ip_init(argc, argv, self)
245 + /* without Tk */
246 + with_tk = 0;
247 + } else {
248 +- /* Tcl_SetVar(ptr->ip, "argv", StringValuePtr(opts), 0); */
249 +- Tcl_SetVar(ptr->ip, "argv", StringValuePtr(opts), TCL_GLOBAL_ONLY);
250 ++ /* Tcl_SetVar(ptr->ip, "argv", StringValueCStr(opts), 0); */
251 ++ Tcl_SetVar(ptr->ip, "argv", StringValueCStr(opts), TCL_GLOBAL_ONLY);
252 + Tcl_Eval(ptr->ip, "set argc [llength $argv]");
253 + }
254 + case 1:
255 + /* argv0 */
256 + if (!NIL_P(argv0)) {
257 +- if (strncmp(StringValuePtr(argv0), "-e", 3) == 0
258 +- || strncmp(StringValuePtr(argv0), "-", 2) == 0) {
259 ++ if (strncmp(StringValueCStr(argv0), "-e", 3) == 0
260 ++ || strncmp(StringValueCStr(argv0), "-", 2) == 0) {
261 + Tcl_SetVar(ptr->ip, "argv0", "ruby", TCL_GLOBAL_ONLY);
262 + } else {
263 +- /* Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0), 0); */
264 +- Tcl_SetVar(ptr->ip, "argv0", StringValuePtr(argv0),
265 ++ /* Tcl_SetVar(ptr->ip, "argv0", StringValueCStr(argv0), 0); */
266 ++ Tcl_SetVar(ptr->ip, "argv0", StringValueCStr(argv0),
267 + TCL_GLOBAL_ONLY);
268 + }
269 + }
270 +@@ -6420,7 +6420,7 @@ ip_create_slave_core(interp, argc, argv)
271 + slave->allow_ruby_exit = 0;
272 + slave->return_value = 0;
273 +
274 +- slave->ip = Tcl_CreateSlave(master->ip, StringValuePtr(name), safe);
275 ++ slave->ip = Tcl_CreateSlave(master->ip, StringValueCStr(name), safe);
276 + if (slave->ip == NULL) {
277 + rb_thread_critical = thr_crit_bup;
278 + return rb_exc_new2(rb_eRuntimeError,
279 +@@ -6896,7 +6896,7 @@ static Tcl_Obj *
280 + get_obj_from_str(str)
281 + VALUE str;
282 + {
283 +- const char *s = StringValuePtr(str);
284 ++ const char *s = StringValueCStr(str);
285 +
286 + #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
287 + return Tcl_NewStringObj((char*)s, RSTRING_LEN(str));
288 +@@ -7744,7 +7744,7 @@ ip_cancel_eval_core(interp, msg, flag)
289 + if (NIL_P(msg)) {
290 + msg_obj = NULL;
291 + } else {
292 +- char *s = StringValuePtr(msg);
293 ++ char *s = StringValueCStr(msg);
294 + msg_obj = Tcl_NewStringObj(s, RSTRING_LENINT(msg));
295 + Tcl_IncrRefCount(msg_obj);
296 + }
297 +@@ -8409,7 +8409,7 @@ lib_set_system_encoding(self, enc_name)
298 +
299 + enc_name = rb_funcallv(enc_name, ID_to_s, 0, 0);
300 + if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL,
301 +- StringValuePtr(enc_name)) != TCL_OK) {
302 ++ StringValueCStr(enc_name)) != TCL_OK) {
303 + rb_raise(rb_eArgError, "unknown encoding name '%s'",
304 + RSTRING_PTR(enc_name));
305 + }
306 +@@ -8850,7 +8850,7 @@ alloc_invoke_arguments(argc, argv)
307 + Tcl_Preserve((ClientData)av); /* XXXXXXXX */
308 + #endif
309 + for (i = 0; i < argc; ++i) {
310 +- av[i] = strdup(StringValuePtr(argv[i]));
311 ++ av[i] = strdup(StringValueCStr(argv[i]));
312 + }
313 + av[argc] = NULL;
314 + #endif
315 +@@ -9854,7 +9854,7 @@ lib_merge_tklist(argc, argv, obj)
316 + len = 1;
317 + for(num = 0; num < argc; num++) {
318 + if (OBJ_TAINTED(argv[num])) taint_flag = 1;
319 +- dst = StringValuePtr(argv[num]);
320 ++ dst = StringValueCStr(argv[num]);
321 + #if TCL_MAJOR_VERSION >= 8
322 + len += Tcl_ScanCountedElement(dst, RSTRING_LENINT(argv[num]),
323 + &flagPtr[num]) + 1;
324
325 diff --git a/patchsets/patches-2.2.7-r2/009_no-gems.patch b/patchsets/patches-2.2.7-r2/009_no-gems.patch
326 new file mode 100644
327 index 0000000..a67cbf8
328 --- /dev/null
329 +++ b/patchsets/patches-2.2.7-r2/009_no-gems.patch
330 @@ -0,0 +1,88 @@
331 +--- tool/rbinstall.rb.~1~ 2015-03-25 04:33:14.000000000 +0100
332 ++++ tool/rbinstall.rb 2015-04-14 07:07:01.169073427 +0200
333 +@@ -654,83 +654,11 @@
334 + # :startdoc:
335 +
336 + install?(:ext, :comm, :gem) do
337 +- $:.unshift(File.join(srcdir, "lib"))
338 +- require("rubygems.rb")
339 +- gem_dir = Gem.default_dir
340 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
341 +- prepare "default gems", gem_dir, directories
342 +-
343 +- spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
344 +- default_spec_dir = "#{spec_dir}/default"
345 +- makedirs(default_spec_dir)
346 +-
347 +- gems = {}
348 +- File.foreach(File.join(srcdir, "defs/default_gems")) do |line|
349 +- line.chomp!
350 +- line.sub!(/\s*#.*/, '')
351 +- next if line.empty?
352 +- words = []
353 +- line.scan(/\G\s*([^\[\]\s]+|\[([^\[\]]*)\])/) do
354 +- words << ($2 ? $2.split : $1)
355 +- end
356 +- name, base_dir, src, execs = *words
357 +- next unless name and base_dir and src
358 +-
359 +- src = File.join(srcdir, src)
360 +- base_dir = File.join(srcdir, base_dir)
361 +- specgen = RbInstall::Specs::Generator.new(name, base_dir, src, execs || [])
362 +- gems[name] ||= specgen
363 +- end
364 +-
365 +- Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").each do |src|
366 +- specgen = RbInstall::Specs::Reader.new(src)
367 +- gems[specgen.gemspec.name] ||= specgen
368 +- end
369 +-
370 +- gems.sort.each do |name, specgen|
371 +- gemspec = specgen.gemspec
372 +- base_dir = specgen.src.sub(/\A#{Regexp.escape(srcdir)}\//, "")
373 +- full_name = "#{gemspec.name}-#{gemspec.version}"
374 +-
375 +- puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
376 +- gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec")
377 +- open_for_install(gemspec_path, $data_mode) do
378 +- specgen.spec_source
379 +- end
380 +-
381 +- unless gemspec.executables.empty? then
382 +- bin_dir = File.join(gem_dir, 'gems', full_name, 'bin')
383 +- makedirs(bin_dir)
384 +-
385 +- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
386 +- install(execs, bin_dir, :mode => $prog_mode)
387 +- end
388 +- end
389 ++ # gems are unbundled in Gentoo.
390 + end
391 +
392 + install?(:ext, :comm, :gem) do
393 +- begin
394 +- require "zlib"
395 +- rescue LoadError
396 +- end
397 +- if defined?(Zlib)
398 +- require 'pathname'
399 +- gem_dir = Gem.default_dir
400 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
401 +- prepare "bundle gems", gem_dir, directories
402 +- Dir.glob(srcdir+'/gems/*.gem').each do |gem|
403 +- Gem.install gem, Gem::Requirement.default, :install_dir => with_destdir(Gem.dir), :domain => :local, :ignore_dependencies => true
404 +- gemname = Pathname(gem).basename
405 +- puts "#{" "*30}#{gemname}"
406 +- end
407 +- # fix directory permissions
408 +- # TODO: Gem.install should accept :dir_mode option or something
409 +- File.chmod($dir_mode, *Dir.glob(with_destdir(Gem.dir)+"/**/"))
410 +- # fix .gemspec permissions
411 +- File.chmod($data_mode, *Dir.glob(with_destdir(Gem.dir)+"/specifications/*.gemspec"))
412 +- else
413 +- puts "skip installing bundle gems because of lacking zlib"
414 +- end
415 ++ # gems are unbundled in Gentoo.
416 + end
417 +
418 + parse_args()
419
420 diff --git a/patchsets/patches-2.3.4-r2/001_ia64.patch b/patchsets/patches-2.3.4-r2/001_ia64.patch
421 new file mode 100644
422 index 0000000..e1e9c89
423 --- /dev/null
424 +++ b/patchsets/patches-2.3.4-r2/001_ia64.patch
425 @@ -0,0 +1,62 @@
426 +Bug: https://bugs.gentoo.org/show_bug.cgi?id=561780
427 +
428 +fix crash on register stack mark/sweep pass
429 +
430 +The crash looks like
431 +
432 + Program received signal SIGSEGV, Segmentation fault.
433 + mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
434 + 3297 v = *x;
435 + (gdb) bt
436 + #0 mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
437 + #1 0x400000000014a040 in gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
438 + #2 0x400000000014b3a0 in mark_current_machine_context (objspace=0x6000000000045db0, th=0x60000000000455b0) at gc.c:3500
439 + #3 0x400000000014dfe0 in gc_mark_roots (objspace=0x6000000000045db0, full_mark=0, categoryp=0x0) at gc.c:4105
440 + #4 0x400000000014e6b0 in gc_marks_body (objspace=0x6000000000045db0, full_mark=0) at gc.c:4164
441 + #5 0x400000000014f260 in gc_marks (objspace=0x6000000000045db0, full_mark=0) at gc.c:4526
442 + #6 0x40000000001525c0 in garbage_collect_body (objspace=0x6000000000045db0, full_mark=0, immediate_sweep=0, reason=256) at gc.c:5024
443 + #7 0x400000000013c010 in heap_prepare_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1219
444 + #8 0x400000000013c140 in heap_get_freeobj_from_next_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1237
445 + #9 0x400000000013c360 in heap_get_freeobj (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1259
446 + #10 0x400000000013c950 in newobj_of (klass=0, flags=40, v1=0, v2=0, v3=0) at gc.c:1303
447 + #11 0x400000000013ccc0 in rb_newobj_of (klass=0, flags=40) at gc.c:1356
448 + #12 0x4000000000163740 in hash_alloc (klass=0) at hash.c:289
449 + #13 0x4000000000163860 in rb_hash_new () at hash.c:309
450 + #14 0x400000000050e420 in Init_BareVM () at vm.c:2822
451 + #15 0x40000000000f6b60 in ruby_setup () at eval.c:54
452 + #16 0x40000000000f6f50 in ruby_init () at eval.c:75
453 + #17 0x400000000001b010 in main (argc=9, argv=0x60000fffffffb1d8) at main.c:35
454 +
455 +The problem here is in call
456 + gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
457 +where 'start' (native_main_thread.register_stack_start)
458 +is supposed to be stack start but it's not initialized.
459 +
460 +The initialization of 'native_main_thread.register_stack_start'
461 +is supposed to be done in 'ruby_init_stack()'.
462 +
463 +But code under 'MAINSTACKADDR_AVAILABLE' exits early.
464 +The fix is to move 'register_stack_start' earlier.
465 +
466 +diff --git a/thread_pthread.c b/thread_pthread.c
467 +index c8a7a16..9ad448b 100644
468 +--- a/thread_pthread.c
469 ++++ b/thread_pthread.c
470 +@@ -722,2 +722,8 @@ ruby_init_stack(volatile VALUE *addr
471 + native_main_thread.id = pthread_self();
472 ++#ifdef __ia64
473 ++ if (!native_main_thread.register_stack_start ||
474 ++ (VALUE*)bsp < native_main_thread.register_stack_start) {
475 ++ native_main_thread.register_stack_start = (VALUE*)bsp;
476 ++ }
477 ++#endif
478 + #if MAINSTACKADDR_AVAILABLE
479 +@@ -745,8 +751,2 @@ ruby_init_stack(volatile VALUE *addr
480 + #endif
481 +-#ifdef __ia64
482 +- if (!native_main_thread.register_stack_start ||
483 +- (VALUE*)bsp < native_main_thread.register_stack_start) {
484 +- native_main_thread.register_stack_start = (VALUE*)bsp;
485 +- }
486 +-#endif
487 + {
488
489 diff --git a/patchsets/patches-2.3.4-r2/004_gfbsd7.patch b/patchsets/patches-2.3.4-r2/004_gfbsd7.patch
490 new file mode 100644
491 index 0000000..fa561b6
492 --- /dev/null
493 +++ b/patchsets/patches-2.3.4-r2/004_gfbsd7.patch
494 @@ -0,0 +1,37 @@
495 +--- configure.in.orig 2013-05-05 19:36:02.800254192 +0200
496 ++++ configure.in 2013-05-05 19:37:56.573346196 +0200
497 +@@ -2156,7 +2156,7 @@
498 + fi
499 +
500 + AS_CASE(["$target_os"],
501 +-[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl], [
502 ++[linux* | gnu* | k*bsd*-gnu | bsdi* | kopensolaris*-gnu | nacl | freebsd* | dragonfly*], [
503 + if test "$rb_cv_binary_elf" = no; then
504 + with_dln_a_out=yes
505 + else
506 +@@ -2249,7 +2249,7 @@
507 + [bsdi3*], [ AS_CASE(["$CC"],
508 + [*shlicc*], [ : ${LDSHARED='$(CC) -r'}
509 + rb_cv_dlopen=yes])],
510 +- [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku*], [
511 ++ [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku* | freebsd7*], [
512 + : ${LDSHARED='$(CC) -shared'}
513 + if test "$rb_cv_binary_elf" = yes; then
514 + LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
515 +@@ -2262,7 +2262,6 @@
516 + [freebsd*|dragonfly*], [
517 + : ${LDSHARED='$(CC) -shared'}
518 + if test "$rb_cv_binary_elf" = yes; then
519 +- LDFLAGS="$LDFLAGS -rdynamic"
520 + DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
521 + else
522 + test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
523 +@@ -2638,7 +2637,7 @@
524 + [sunos4*], [
525 + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
526 + ],
527 +- [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | haiku*], [
528 ++ [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | haiku* | freebsd7*], [
529 + LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'" $LDFLAGS_OPTDIR"
530 + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
531 + if test "$load_relative" = yes; then
532
533 diff --git a/patchsets/patches-2.3.4-r2/005_no-undefined-ext.patch b/patchsets/patches-2.3.4-r2/005_no-undefined-ext.patch
534 new file mode 100644
535 index 0000000..f279932
536 --- /dev/null
537 +++ b/patchsets/patches-2.3.4-r2/005_no-undefined-ext.patch
538 @@ -0,0 +1,11 @@
539 +--- ruby-1.9.3-preview1.orig/configure.in
540 ++++ ruby-1.9.3-preview1/configure.in
541 +@@ -2038,7 +2038,7 @@ if test "$with_dln_a_out" != yes; then
542 + [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
543 + : ${LDSHARED='$(CC) -shared'}
544 + if test "$rb_cv_binary_elf" = yes; then
545 +- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
546 ++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
547 + fi
548 + rb_cv_dlopen=yes],
549 + [interix*], [ : ${LDSHARED='$(CC) -shared'}
550
551 diff --git a/patchsets/patches-2.3.4-r2/009_no-gems.patch b/patchsets/patches-2.3.4-r2/009_no-gems.patch
552 new file mode 100644
553 index 0000000..2da6b7d
554 --- /dev/null
555 +++ b/patchsets/patches-2.3.4-r2/009_no-gems.patch
556 @@ -0,0 +1,95 @@
557 +--- tool/rbinstall.rb.~1~ 2017-03-27 17:18:38.000000000 +0200
558 ++++ tool/rbinstall.rb 2017-03-30 07:38:53.437332083 +0200
559 +@@ -696,90 +696,11 @@
560 + # :startdoc:
561 +
562 + install?(:ext, :comm, :gem) do
563 +- gem_dir = Gem.default_dir
564 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
565 +- prepare "default gems", gem_dir, directories
566 +-
567 +- spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
568 +- default_spec_dir = "#{spec_dir}/default"
569 +- makedirs(default_spec_dir)
570 +-
571 +- gems = {}
572 +-
573 +- Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").each do |src|
574 +- specgen = RbInstall::Specs::Reader.new(src)
575 +- gems[specgen.gemspec.name] ||= specgen
576 +- end
577 +-
578 +- gems.sort.each do |name, specgen|
579 +- gemspec = specgen.gemspec
580 +- full_name = "#{gemspec.name}-#{gemspec.version}"
581 +-
582 +- puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
583 +- gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec")
584 +- open_for_install(gemspec_path, $data_mode) do
585 +- specgen.spec_source
586 +- end
587 +-
588 +- unless gemspec.executables.empty? then
589 +- bin_dir = File.join(gem_dir, 'gems', full_name, 'bin')
590 +- makedirs(bin_dir)
591 +-
592 +- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
593 +- install(execs, bin_dir, :mode => $script_mode)
594 +- end
595 +- end
596 ++ # gems are unbundled in Gentoo
597 + end
598 +
599 + install?(:ext, :comm, :gem) do
600 +- gem_dir = Gem.default_dir
601 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
602 +- prepare "bundle gems", gem_dir, directories
603 +- install_dir = with_destdir(gem_dir)
604 +- installed_gems = {}
605 +- options = {
606 +- :install_dir => install_dir,
607 +- :bin_dir => with_destdir(bindir),
608 +- :domain => :local,
609 +- :ignore_dependencies => true,
610 +- :dir_mode => $dir_mode,
611 +- :data_mode => $data_mode,
612 +- :prog_mode => $prog_mode,
613 +- :wrappers => true,
614 +- :format_executable => true,
615 +- }
616 +- Gem::Specification.each_spec([srcdir+'/gems/*']) do |spec|
617 +- ins = RbInstall::UnpackedInstaller.new(spec, options)
618 +- puts "#{" "*30}#{spec.name} #{spec.version}"
619 +- ins.install
620 +- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
621 +- installed_gems[spec.full_name] = true
622 +- end
623 +- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
624 +- unless installed_gems.empty?
625 +- install installed_gems, gem_dir+"/cache"
626 +- end
627 +- next if gems.empty?
628 +- if defined?(Zlib)
629 +- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
630 +- gems.each do |gem|
631 +- begin
632 +- File.umask(022)
633 +- Gem.install(gem, Gem::Requirement.default, options)
634 +- ensure
635 +- File.umask(0222)
636 +- end
637 +- gemname = File.basename(gem)
638 +- puts "#{" "*30}#{gemname}"
639 +- end
640 +- # fix directory permissions
641 +- # TODO: Gem.install should accept :dir_mode option or something
642 +- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
643 +- # fix .gemspec permissions
644 +- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
645 +- else
646 +- puts "skip installing bundle gems because of lacking zlib"
647 +- end
648 ++ # gems are unbundled in Gentoo
649 + end
650 +
651 + parse_args()
652
653 diff --git a/patchsets/patches-2.4.1-r2/001_ia64.patch b/patchsets/patches-2.4.1-r2/001_ia64.patch
654 new file mode 100644
655 index 0000000..e1e9c89
656 --- /dev/null
657 +++ b/patchsets/patches-2.4.1-r2/001_ia64.patch
658 @@ -0,0 +1,62 @@
659 +Bug: https://bugs.gentoo.org/show_bug.cgi?id=561780
660 +
661 +fix crash on register stack mark/sweep pass
662 +
663 +The crash looks like
664 +
665 + Program received signal SIGSEGV, Segmentation fault.
666 + mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
667 + 3297 v = *x;
668 + (gdb) bt
669 + #0 mark_locations_array (objspace=0x6000000000045db0, x=0x0, n=864692227966763116) at gc.c:3297
670 + #1 0x400000000014a040 in gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
671 + #2 0x400000000014b3a0 in mark_current_machine_context (objspace=0x6000000000045db0, th=0x60000000000455b0) at gc.c:3500
672 + #3 0x400000000014dfe0 in gc_mark_roots (objspace=0x6000000000045db0, full_mark=0, categoryp=0x0) at gc.c:4105
673 + #4 0x400000000014e6b0 in gc_marks_body (objspace=0x6000000000045db0, full_mark=0) at gc.c:4164
674 + #5 0x400000000014f260 in gc_marks (objspace=0x6000000000045db0, full_mark=0) at gc.c:4526
675 + #6 0x40000000001525c0 in garbage_collect_body (objspace=0x6000000000045db0, full_mark=0, immediate_sweep=0, reason=256) at gc.c:5024
676 + #7 0x400000000013c010 in heap_prepare_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1219
677 + #8 0x400000000013c140 in heap_get_freeobj_from_next_freepage (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1237
678 + #9 0x400000000013c360 in heap_get_freeobj (objspace=0x6000000000045db0, heap=0x6000000000045dc0) at gc.c:1259
679 + #10 0x400000000013c950 in newobj_of (klass=0, flags=40, v1=0, v2=0, v3=0) at gc.c:1303
680 + #11 0x400000000013ccc0 in rb_newobj_of (klass=0, flags=40) at gc.c:1356
681 + #12 0x4000000000163740 in hash_alloc (klass=0) at hash.c:289
682 + #13 0x4000000000163860 in rb_hash_new () at hash.c:309
683 + #14 0x400000000050e420 in Init_BareVM () at vm.c:2822
684 + #15 0x40000000000f6b60 in ruby_setup () at eval.c:54
685 + #16 0x40000000000f6f50 in ruby_init () at eval.c:75
686 + #17 0x400000000001b010 in main (argc=9, argv=0x60000fffffffb1d8) at main.c:35
687 +
688 +The problem here is in call
689 + gc_mark_locations (objspace=0x6000000000045db0, start=0x0, end=0x6000080000000368) at gc.c:3310
690 +where 'start' (native_main_thread.register_stack_start)
691 +is supposed to be stack start but it's not initialized.
692 +
693 +The initialization of 'native_main_thread.register_stack_start'
694 +is supposed to be done in 'ruby_init_stack()'.
695 +
696 +But code under 'MAINSTACKADDR_AVAILABLE' exits early.
697 +The fix is to move 'register_stack_start' earlier.
698 +
699 +diff --git a/thread_pthread.c b/thread_pthread.c
700 +index c8a7a16..9ad448b 100644
701 +--- a/thread_pthread.c
702 ++++ b/thread_pthread.c
703 +@@ -722,2 +722,8 @@ ruby_init_stack(volatile VALUE *addr
704 + native_main_thread.id = pthread_self();
705 ++#ifdef __ia64
706 ++ if (!native_main_thread.register_stack_start ||
707 ++ (VALUE*)bsp < native_main_thread.register_stack_start) {
708 ++ native_main_thread.register_stack_start = (VALUE*)bsp;
709 ++ }
710 ++#endif
711 + #if MAINSTACKADDR_AVAILABLE
712 +@@ -745,8 +751,2 @@ ruby_init_stack(volatile VALUE *addr
713 + #endif
714 +-#ifdef __ia64
715 +- if (!native_main_thread.register_stack_start ||
716 +- (VALUE*)bsp < native_main_thread.register_stack_start) {
717 +- native_main_thread.register_stack_start = (VALUE*)bsp;
718 +- }
719 +-#endif
720 + {
721
722 diff --git a/patchsets/patches-2.4.1-r2/002_windows_crossdev.patch b/patchsets/patches-2.4.1-r2/002_windows_crossdev.patch
723 new file mode 100644
724 index 0000000..7e290d4
725 --- /dev/null
726 +++ b/patchsets/patches-2.4.1-r2/002_windows_crossdev.patch
727 @@ -0,0 +1,64 @@
728 +Bug: https://bugs.gentoo.org/show_bug.cgi?id=618878
729 +
730 +A few patches to make crossdev for mingw-w64 play nice with ruby's ebuilds.
731 +Basic gist is that without the following patch to configure.in ruby-2.4.1
732 +hardcodes 240 into the shared, static, and import library names, which when
733 +built with the current ruby ebuilds results in names like libx64-msvcrt-ruby24240.dll and so on. The patch is in ruby-trunk[1], but may take a while
734 +to hit the tarballs that gentoo uses.
735 +
736 +Index: configure.in
737 +===================================================================
738 +--- a/configure.in (revision 57824)
739 ++++ b/configure.in (revision 57825)
740 +@@ -3825,7 +3825,23 @@
741 +
742 + AC_ARG_WITH(soname,
743 + AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]),
744 +- [RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
745 ++ [RUBY_SO_NAME=$withval],
746 ++ [
747 ++ AS_CASE(["$target_os"],
748 ++ [darwin*], [
749 ++ RUBY_SO_NAME='$(RUBY_BASE_NAME).$(RUBY_PROGRAM_VERSION)'
750 ++ ],
751 ++ [cygwin*], [
752 ++ RUBY_SO_NAME='$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
753 ++ ],
754 ++ [mingw*], [
755 ++ RUBY_SO_NAME="${rb_cv_msvcrt}"'-$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
756 ++ AS_IF([test x"${target_cpu}" != xi386], [
757 ++ RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
758 ++ ])
759 ++ ],
760 ++ [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
761 ++ ])
762 +
763 + LIBRUBY_LDSHARED=$LDSHARED
764 + LIBRUBY_DLDFLAGS=$DLDFLAGS
765 +@@ -3925,7 +3941,6 @@
766 + SOLIBS='-lm -lc'
767 + ],
768 + [darwin*], [
769 +- RUBY_SO_NAME="$RUBY_SO_NAME"'.$(RUBY_PROGRAM_VERSION)'
770 + LIBRUBY_LDSHARED='$(CC) -dynamiclib'
771 + if test "$load_relative" = yes; then
772 + libprefix="@executable_path/../${libdir_basename}"
773 +@@ -4157,7 +4172,6 @@
774 + fi
775 + ],
776 + [cygwin*|mingw*], [
777 +- RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)0'
778 + LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
779 + AS_CASE(["$target_os"],
780 + [cygwin*], [
781 +@@ -4167,10 +4181,6 @@
782 + fi
783 + ],
784 + [mingw*], [
785 +- RUBY_SO_NAME="${rb_cv_msvcrt}-${RUBY_SO_NAME}"
786 +- if test x"${target_cpu}" != xi386; then
787 +- RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
788 +- fi
789 + if test x"$enable_shared" = xyes; then
790 + LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
791 + LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
792
793 diff --git a/patchsets/patches-2.4.1-r2/005_no-undefined-ext.patch b/patchsets/patches-2.4.1-r2/005_no-undefined-ext.patch
794 new file mode 100644
795 index 0000000..f279932
796 --- /dev/null
797 +++ b/patchsets/patches-2.4.1-r2/005_no-undefined-ext.patch
798 @@ -0,0 +1,11 @@
799 +--- ruby-1.9.3-preview1.orig/configure.in
800 ++++ ruby-1.9.3-preview1/configure.in
801 +@@ -2038,7 +2038,7 @@ if test "$with_dln_a_out" != yes; then
802 + [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
803 + : ${LDSHARED='$(CC) -shared'}
804 + if test "$rb_cv_binary_elf" = yes; then
805 +- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
806 ++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
807 + fi
808 + rb_cv_dlopen=yes],
809 + [interix*], [ : ${LDSHARED='$(CC) -shared'}
810
811 diff --git a/patchsets/patches-2.4.1-r2/009_no-gems.patch b/patchsets/patches-2.4.1-r2/009_no-gems.patch
812 new file mode 100644
813 index 0000000..cdf503c
814 --- /dev/null
815 +++ b/patchsets/patches-2.4.1-r2/009_no-gems.patch
816 @@ -0,0 +1,112 @@
817 +--- tool/rbinstall.rb.~1~ 2016-10-17 09:17:07.000000000 +0200
818 ++++ tool/rbinstall.rb 2016-12-25 08:20:07.873491045 +0100
819 +@@ -695,107 +695,11 @@
820 + # :startdoc:
821 +
822 + install?(:ext, :comm, :gem) do
823 +- gem_dir = Gem.default_dir
824 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
825 +- prepare "default gems", gem_dir, directories
826 +-
827 +- spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
828 +- default_spec_dir = "#{spec_dir}/default"
829 +- makedirs(default_spec_dir)
830 +-
831 +- gems = Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").map {|src|
832 +- spec = Gem::Specification.load(src) || raise("invalid spec in #{src}")
833 +- file_collector = RbInstall::Specs::FileCollector.new(File.dirname(src))
834 +- files = file_collector.collect
835 +- next if files.empty?
836 +- spec.files = files
837 +- spec
838 +- }
839 +- gems.compact.sort_by(&:name).each do |gemspec|
840 +- full_name = "#{gemspec.name}-#{gemspec.version}"
841 +-
842 +- puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
843 +- gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec")
844 +- open_for_install(gemspec_path, $data_mode) do
845 +- gemspec.to_ruby
846 +- end
847 +-
848 +- unless gemspec.executables.empty? then
849 +- bin_dir = File.join(gem_dir, 'gems', full_name, gemspec.bindir)
850 +- makedirs(bin_dir)
851 +-
852 +- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
853 +- install(execs, bin_dir, :mode => $script_mode)
854 +- end
855 +- end
856 ++ # gems are unbundled in Gentoo
857 + end
858 +
859 + install?(:ext, :comm, :gem) do
860 +- gem_dir = Gem.default_dir
861 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
862 +- prepare "bundle gems", gem_dir, directories
863 +- install_dir = with_destdir(gem_dir)
864 +- installed_gems = {}
865 +- options = {
866 +- :install_dir => install_dir,
867 +- :bin_dir => with_destdir(bindir),
868 +- :domain => :local,
869 +- :ignore_dependencies => true,
870 +- :dir_mode => $dir_mode,
871 +- :data_mode => $data_mode,
872 +- :prog_mode => $prog_mode,
873 +- :wrappers => true,
874 +- :format_executable => true,
875 +- }
876 +- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
877 +- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
878 +- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
879 +- dir = File.dirname(path)
880 +- spec = Dir.chdir(dir) {
881 +- Gem::Specification.load(File.basename(path))
882 +- }
883 +- next unless spec.platform == Gem::Platform::RUBY
884 +- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
885 +- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
886 +- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
887 +- spec.extensions[0] ||= "-"
888 +- end
889 +- ins = RbInstall::UnpackedInstaller.new(spec, options)
890 +- puts "#{" "*30}#{spec.name} #{spec.version}"
891 +- ins.install
892 +- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
893 +- unless spec.extensions.empty?
894 +- install_recursive(ext, spec.extension_dir)
895 +- end
896 +- installed_gems[spec.full_name] = true
897 +- end
898 +- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
899 +- unless installed_gems.empty?
900 +- install installed_gems, gem_dir+"/cache"
901 +- end
902 +- next if gems.empty?
903 +- if defined?(Zlib)
904 +- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
905 +- silent = Gem::SilentUI.new
906 +- gems.each do |gem|
907 +- inst = Gem::Installer.new(gem, options)
908 +- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
909 +- begin
910 +- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
911 +- rescue Gem::InstallError => e
912 +- next
913 +- end
914 +- gemname = File.basename(gem)
915 +- puts "#{" "*30}#{gemname}"
916 +- end
917 +- # fix directory permissions
918 +- # TODO: Gem.install should accept :dir_mode option or something
919 +- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
920 +- # fix .gemspec permissions
921 +- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
922 +- else
923 +- puts "skip installing bundle gems because of lacking zlib"
924 +- end
925 ++ # gems are unbundled in Gentoo
926 + end
927 +
928 + parse_args()