Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/ruby/files/2.4/, dev-lang/ruby/
Date: Mon, 16 Jul 2018 07:34:57
Message-Id: 1531726487.15ba2bca25c5d4539c61705668724bf38be64217.graaff@gentoo
1 commit: 15ba2bca25c5d4539c61705668724bf38be64217
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 16 07:34:29 2018 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 16 07:34:47 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15ba2bca
7
8 dev-lang/ruby: EAPI 7, fix libressl 2.7
9
10 Convert to EAPI 7
11 Fix compilation with libressl 2.7, bug 656584
12 Use patches in FILESDIR instead of patchset
13
14 Package-Manager: Portage-2.3.40, Repoman-2.3.9
15
16 dev-lang/ruby/files/2.4/002_windows_crossdev.patch | 64 ++++++
17 dev-lang/ruby/files/2.4/005_no-undefined-ext.patch | 11 +
18 dev-lang/ruby/files/2.4/009_no-gems.patch | 112 ++++++++++
19 dev-lang/ruby/files/2.4/010-libressl_2.7.patch | 15 ++
20 dev-lang/ruby/files/2.4/011-gcc8.patch | 64 ++++++
21 dev-lang/ruby/ruby-2.4.4-r1.ebuild | 229 +++++++++++++++++++++
22 6 files changed, 495 insertions(+)
23
24 diff --git a/dev-lang/ruby/files/2.4/002_windows_crossdev.patch b/dev-lang/ruby/files/2.4/002_windows_crossdev.patch
25 new file mode 100644
26 index 00000000000..7e290d434f0
27 --- /dev/null
28 +++ b/dev-lang/ruby/files/2.4/002_windows_crossdev.patch
29 @@ -0,0 +1,64 @@
30 +Bug: https://bugs.gentoo.org/show_bug.cgi?id=618878
31 +
32 +A few patches to make crossdev for mingw-w64 play nice with ruby's ebuilds.
33 +Basic gist is that without the following patch to configure.in ruby-2.4.1
34 +hardcodes 240 into the shared, static, and import library names, which when
35 +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
36 +to hit the tarballs that gentoo uses.
37 +
38 +Index: configure.in
39 +===================================================================
40 +--- a/configure.in (revision 57824)
41 ++++ b/configure.in (revision 57825)
42 +@@ -3825,7 +3825,23 @@
43 +
44 + AC_ARG_WITH(soname,
45 + AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]),
46 +- [RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
47 ++ [RUBY_SO_NAME=$withval],
48 ++ [
49 ++ AS_CASE(["$target_os"],
50 ++ [darwin*], [
51 ++ RUBY_SO_NAME='$(RUBY_BASE_NAME).$(RUBY_PROGRAM_VERSION)'
52 ++ ],
53 ++ [cygwin*], [
54 ++ RUBY_SO_NAME='$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
55 ++ ],
56 ++ [mingw*], [
57 ++ RUBY_SO_NAME="${rb_cv_msvcrt}"'-$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
58 ++ AS_IF([test x"${target_cpu}" != xi386], [
59 ++ RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
60 ++ ])
61 ++ ],
62 ++ [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
63 ++ ])
64 +
65 + LIBRUBY_LDSHARED=$LDSHARED
66 + LIBRUBY_DLDFLAGS=$DLDFLAGS
67 +@@ -3925,7 +3941,6 @@
68 + SOLIBS='-lm -lc'
69 + ],
70 + [darwin*], [
71 +- RUBY_SO_NAME="$RUBY_SO_NAME"'.$(RUBY_PROGRAM_VERSION)'
72 + LIBRUBY_LDSHARED='$(CC) -dynamiclib'
73 + if test "$load_relative" = yes; then
74 + libprefix="@executable_path/../${libdir_basename}"
75 +@@ -4157,7 +4172,6 @@
76 + fi
77 + ],
78 + [cygwin*|mingw*], [
79 +- RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)0'
80 + LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
81 + AS_CASE(["$target_os"],
82 + [cygwin*], [
83 +@@ -4167,10 +4181,6 @@
84 + fi
85 + ],
86 + [mingw*], [
87 +- RUBY_SO_NAME="${rb_cv_msvcrt}-${RUBY_SO_NAME}"
88 +- if test x"${target_cpu}" != xi386; then
89 +- RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
90 +- fi
91 + if test x"$enable_shared" = xyes; then
92 + LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
93 + LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
94
95 diff --git a/dev-lang/ruby/files/2.4/005_no-undefined-ext.patch b/dev-lang/ruby/files/2.4/005_no-undefined-ext.patch
96 new file mode 100644
97 index 00000000000..f2799324012
98 --- /dev/null
99 +++ b/dev-lang/ruby/files/2.4/005_no-undefined-ext.patch
100 @@ -0,0 +1,11 @@
101 +--- ruby-1.9.3-preview1.orig/configure.in
102 ++++ ruby-1.9.3-preview1/configure.in
103 +@@ -2038,7 +2038,7 @@ if test "$with_dln_a_out" != yes; then
104 + [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
105 + : ${LDSHARED='$(CC) -shared'}
106 + if test "$rb_cv_binary_elf" = yes; then
107 +- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
108 ++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
109 + fi
110 + rb_cv_dlopen=yes],
111 + [interix*], [ : ${LDSHARED='$(CC) -shared'}
112
113 diff --git a/dev-lang/ruby/files/2.4/009_no-gems.patch b/dev-lang/ruby/files/2.4/009_no-gems.patch
114 new file mode 100644
115 index 00000000000..6e4e2643d4c
116 --- /dev/null
117 +++ b/dev-lang/ruby/files/2.4/009_no-gems.patch
118 @@ -0,0 +1,112 @@
119 +--- a/tool/rbinstall.rb.~1~ 2016-10-17 09:17:07.000000000 +0200
120 ++++ b/tool/rbinstall.rb 2016-12-25 08:20:07.873491045 +0100
121 +@@ -695,107 +695,11 @@
122 + # :startdoc:
123 +
124 + install?(:ext, :comm, :gem) do
125 +- gem_dir = Gem.default_dir
126 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
127 +- prepare "default gems", gem_dir, directories
128 +-
129 +- spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
130 +- default_spec_dir = "#{spec_dir}/default"
131 +- makedirs(default_spec_dir)
132 +-
133 +- gems = Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").map {|src|
134 +- spec = Gem::Specification.load(src) || raise("invalid spec in #{src}")
135 +- file_collector = RbInstall::Specs::FileCollector.new(File.dirname(src))
136 +- files = file_collector.collect
137 +- next if files.empty?
138 +- spec.files = files
139 +- spec
140 +- }
141 +- gems.compact.sort_by(&:name).each do |gemspec|
142 +- full_name = "#{gemspec.name}-#{gemspec.version}"
143 +-
144 +- puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
145 +- gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec")
146 +- open_for_install(gemspec_path, $data_mode) do
147 +- gemspec.to_ruby
148 +- end
149 +-
150 +- unless gemspec.executables.empty? then
151 +- bin_dir = File.join(gem_dir, 'gems', full_name, gemspec.bindir)
152 +- makedirs(bin_dir)
153 +-
154 +- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
155 +- install(execs, bin_dir, :mode => $script_mode)
156 +- end
157 +- end
158 ++ # gems are unbundled in Gentoo
159 + end
160 +
161 + install?(:ext, :comm, :gem) do
162 +- gem_dir = Gem.default_dir
163 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
164 +- prepare "bundle gems", gem_dir, directories
165 +- install_dir = with_destdir(gem_dir)
166 +- installed_gems = {}
167 +- options = {
168 +- :install_dir => install_dir,
169 +- :bin_dir => with_destdir(bindir),
170 +- :domain => :local,
171 +- :ignore_dependencies => true,
172 +- :dir_mode => $dir_mode,
173 +- :data_mode => $data_mode,
174 +- :prog_mode => $prog_mode,
175 +- :wrappers => true,
176 +- :format_executable => true,
177 +- }
178 +- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
179 +- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
180 +- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
181 +- dir = File.dirname(path)
182 +- spec = Dir.chdir(dir) {
183 +- Gem::Specification.load(File.basename(path))
184 +- }
185 +- next unless spec.platform == Gem::Platform::RUBY
186 +- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
187 +- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
188 +- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
189 +- spec.extensions[0] ||= "-"
190 +- end
191 +- ins = RbInstall::UnpackedInstaller.new(spec, options)
192 +- puts "#{" "*30}#{spec.name} #{spec.version}"
193 +- ins.install
194 +- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
195 +- unless spec.extensions.empty?
196 +- install_recursive(ext, spec.extension_dir)
197 +- end
198 +- installed_gems[spec.full_name] = true
199 +- end
200 +- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
201 +- unless installed_gems.empty?
202 +- install installed_gems, gem_dir+"/cache"
203 +- end
204 +- next if gems.empty?
205 +- if defined?(Zlib)
206 +- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
207 +- silent = Gem::SilentUI.new
208 +- gems.each do |gem|
209 +- inst = Gem::Installer.new(gem, options)
210 +- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
211 +- begin
212 +- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
213 +- rescue Gem::InstallError => e
214 +- next
215 +- end
216 +- gemname = File.basename(gem)
217 +- puts "#{" "*30}#{gemname}"
218 +- end
219 +- # fix directory permissions
220 +- # TODO: Gem.install should accept :dir_mode option or something
221 +- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
222 +- # fix .gemspec permissions
223 +- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
224 +- else
225 +- puts "skip installing bundle gems because of lacking zlib"
226 +- end
227 ++ # gems are unbundled in Gentoo
228 + end
229 +
230 + parse_args()
231
232 diff --git a/dev-lang/ruby/files/2.4/010-libressl_2.7.patch b/dev-lang/ruby/files/2.4/010-libressl_2.7.patch
233 new file mode 100644
234 index 00000000000..2e25ab09585
235 --- /dev/null
236 +++ b/dev-lang/ruby/files/2.4/010-libressl_2.7.patch
237 @@ -0,0 +1,15 @@
238 +--- a/ext/openssl/extconf.rb.orig 2017-09-08 14:38:12 UTC
239 ++++ b/ext/openssl/extconf.rb
240 +@@ -157,8 +157,11 @@ OpenSSL.check_func_or_macro("SSL_get_ser
241 + have_func("SSL_is_server")
242 +
243 + # added in 1.1.0
244 ++if !have_struct_member("SSL", "ctx", "openssl/ssl.h") ||
245 ++ try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x2070000fL", "openssl/opensslv.h")
246 ++ $defs.push("-DHAVE_OPAQUE_OPENSSL")
247 ++end
248 + have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
249 +-have_struct_member("SSL", "ctx", "openssl/ssl.h") || $defs.push("-DHAVE_OPAQUE_OPENSSL")
250 + have_func("BN_GENCB_new")
251 + have_func("BN_GENCB_free")
252 + have_func("BN_GENCB_get_arg")
253
254 diff --git a/dev-lang/ruby/files/2.4/011-gcc8.patch b/dev-lang/ruby/files/2.4/011-gcc8.patch
255 new file mode 100644
256 index 00000000000..cb2443631dd
257 --- /dev/null
258 +++ b/dev-lang/ruby/files/2.4/011-gcc8.patch
259 @@ -0,0 +1,64 @@
260 +From 027b576b31cd12bad575b3a39476726273f58c41 Mon Sep 17 00:00:00 2001
261 +From: naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
262 +Date: Mon, 18 Dec 2017 09:03:59 +0000
263 +Subject: [PATCH] suppress warning: 'const' attribute on function returning
264 + 'void'
265 +
266 +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
267 +---
268 + include/ruby/intern.h | 4 ++--
269 + include/ruby/ruby.h | 2 +-
270 + internal.h | 4 ++--
271 + 3 files changed, 5 insertions(+), 5 deletions(-)
272 +
273 +diff --git a/include/ruby/intern.h b/include/ruby/intern.h
274 +index 5684b3230a67..a711b861159f 100644
275 +--- a/include/ruby/intern.h
276 ++++ b/include/ruby/intern.h
277 +@@ -249,9 +249,9 @@ PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3);
278 + NORETURN(void rb_invalid_str(const char*, const char*));
279 + NORETURN(void rb_error_frozen(const char*));
280 + NORETURN(void rb_error_frozen_object(VALUE));
281 +-CONSTFUNC(void rb_error_untrusted(VALUE));
282 ++void rb_error_untrusted(VALUE);
283 + void rb_check_frozen(VALUE);
284 +-CONSTFUNC(void rb_check_trusted(VALUE));
285 ++void rb_check_trusted(VALUE);
286 + #define rb_check_frozen_internal(obj) do { \
287 + VALUE frozen_obj = (obj); \
288 + if (OBJ_FROZEN(frozen_obj)) { \
289 +diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
290 +index 9c7d2fb68439..3210103c648a 100644
291 +--- a/include/ruby/ruby.h
292 ++++ b/include/ruby/ruby.h
293 +@@ -628,7 +628,7 @@ int ruby_safe_level_2_warning(void) __attribute__((const,warning("$SAFE=2 to 4 a
294 + # define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level, error))
295 + #endif
296 + void rb_set_safe_level_force(int);
297 +-CONSTFUNC(void rb_secure_update(VALUE));
298 ++void rb_secure_update(VALUE);
299 + NORETURN(void rb_insecure_operation(void));
300 +
301 + VALUE rb_errinfo(void);
302 +diff --git a/internal.h b/internal.h
303 +index d0257a8d8ba0..4ccf3218c6ca 100644
304 +--- a/internal.h
305 ++++ b/internal.h
306 +@@ -1110,7 +1110,7 @@ VALUE rb_invcmp(VALUE, VALUE);
307 + struct rb_block;
308 + int rb_dvar_defined(ID, const struct rb_block *);
309 + int rb_local_defined(ID, const struct rb_block *);
310 +-CONSTFUNC(const char * rb_insns_name(int i));
311 ++const char * rb_insns_name(int i);
312 + VALUE rb_insns_name_array(void);
313 +
314 + /* complex.c */
315 +@@ -1136,7 +1136,7 @@ void Init_ext(void);
316 +
317 + /* encoding.c */
318 + ID rb_id_encoding(void);
319 +-CONSTFUNC(void rb_gc_mark_encodings(void));
320 ++void rb_gc_mark_encodings(void);
321 + rb_encoding *rb_enc_get_from_index(int index);
322 + rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
323 + int rb_encdb_replicate(const char *alias, const char *orig);
324
325 diff --git a/dev-lang/ruby/ruby-2.4.4-r1.ebuild b/dev-lang/ruby/ruby-2.4.4-r1.ebuild
326 new file mode 100644
327 index 00000000000..dec2991fe7a
328 --- /dev/null
329 +++ b/dev-lang/ruby/ruby-2.4.4-r1.ebuild
330 @@ -0,0 +1,229 @@
331 +# Copyright 1999-2018 Gentoo Foundation
332 +# Distributed under the terms of the GNU General Public License v2
333 +
334 +EAPI=7
335 +
336 +inherit autotools flag-o-matic multilib
337 +
338 +MY_P="${PN}-$(ver_cut 1-3)"
339 +S=${WORKDIR}/${MY_P}
340 +
341 +SLOT=$(ver_cut 1-2)
342 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
343 +RUBYVERSION=${SLOT}.0
344 +
345 +DESCRIPTION="An object-oriented scripting language"
346 +HOMEPAGE="https://www.ruby-lang.org/"
347 +SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.xz"
348 +
349 +LICENSE="|| ( Ruby-BSD BSD-2 )"
350 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
351 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc libressl +rdoc rubytests socks5 ssl static-libs tk xemacs"
352 +
353 +RDEPEND="
354 + berkdb? ( sys-libs/db:= )
355 + gdbm? ( sys-libs/gdbm:= )
356 + jemalloc? ( dev-libs/jemalloc )
357 + ssl? (
358 + !libressl? ( dev-libs/openssl:0= )
359 + libressl? ( dev-libs/libressl )
360 + )
361 + socks5? ( >=net-proxy/dante-1.1.13 )
362 + tk? (
363 + dev-lang/tcl:0=[threads]
364 + dev-lang/tk:0=[threads]
365 + )
366 + dev-libs/libyaml
367 + virtual/libffi
368 + sys-libs/zlib
369 + >=app-eselect/eselect-ruby-20161226
370 + !<dev-ruby/rdoc-3.9.4
371 + !<dev-ruby/rubygems-1.8.10-r1"
372 +
373 +DEPEND="${RDEPEND}"
374 +
375 +BUNDLED_GEMS="
376 + >=dev-ruby/did_you_mean-1.1.0:2.4[ruby_targets_ruby24]
377 + >=dev-ruby/minitest-5.10.1[ruby_targets_ruby24]
378 + >=dev-ruby/net-telnet-0.1.1[ruby_targets_ruby24]
379 + >=dev-ruby/power_assert-0.4.1[ruby_targets_ruby24]
380 + >=dev-ruby/rake-12.0.0[ruby_targets_ruby24]
381 + >=dev-ruby/test-unit-3.2.3[ruby_targets_ruby24]
382 + >=dev-ruby/xmlrpc-0.2.1[ruby_targets_ruby24]
383 +"
384 +
385 +PDEPEND="
386 + ${BUNDLED_GEMS}
387 + virtual/rubygems[ruby_targets_ruby24]
388 + >=dev-ruby/json-2.0.2[ruby_targets_ruby24]
389 + rdoc? ( >=dev-ruby/rdoc-5.1.0[ruby_targets_ruby24] )
390 + xemacs? ( app-xemacs/ruby-modes )"
391 +
392 +src_prepare() {
393 + eapply "${FILESDIR}"/${SLOT}/*.patch
394 +
395 + einfo "Unbundling gems..."
396 + cd "$S"
397 + # Remove bundled gems that we will install via PDEPEND, bug
398 + # 539700. Use explicit version numbers to ensure rm fails when they
399 + # change so we can update dependencies accordingly.
400 + rm -f gems/{did_you_mean-1.1.0,minitest-5.10.1,net-telnet-0.1.1,power_assert-0.4.1,rake-12.0.0,test-unit-3.2.3,xmlrpc-0.2.1}.gem || die
401 +
402 + einfo "Removing bundled libraries..."
403 + rm -fr ext/fiddle/libffi-3.2.1 || die
404 +
405 + # Fix a hardcoded lib path in configure script
406 + sed -i -e "s:\(RUBY_LIB_PREFIX=\"\${prefix}/\)lib:\1$(get_libdir):" \
407 + configure.in || die "sed failed"
408 +
409 + eapply_user
410 +
411 + eautoreconf
412 +}
413 +
414 +src_configure() {
415 + local modules= myconf=
416 +
417 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
418 + filter-flags -fomit-frame-pointer
419 + # In many places aliasing rules are broken; play it safe
420 + # as it's risky with newer compilers to leave it as it is.
421 + append-flags -fno-strict-aliasing
422 + # SuperH needs this
423 + use sh && append-flags -mieee
424 +
425 + # Socks support via dante
426 + if use socks5 ; then
427 + # Socks support can't be disabled as long as SOCKS_SERVER is
428 + # set and socks library is present, so need to unset
429 + # SOCKS_SERVER in that case.
430 + unset SOCKS_SERVER
431 + fi
432 +
433 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
434 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
435 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
436 + fi
437 +
438 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
439 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
440 +
441 + # Determine which modules *not* to build depending in the USE flags.
442 + if ! use berkdb ; then
443 + modules="${modules},dbm"
444 + fi
445 + if ! use gdbm ; then
446 + modules="${modules},gdbm"
447 + fi
448 + if ! use ssl ; then
449 + modules="${modules},openssl"
450 + fi
451 + if ! use tk ; then
452 + modules="${modules},tk"
453 + fi
454 +
455 + # Provide an empty LIBPATHENV because we disable rpath but we do not
456 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
457 + # #564272
458 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
459 + --program-suffix=${MY_SUFFIX} \
460 + --with-soname=ruby${MY_SUFFIX} \
461 + --docdir=${EPREFIX}/usr/share/doc/${P} \
462 + --enable-shared \
463 + --enable-pthread \
464 + --disable-rpath \
465 + --with-out-ext="${modules}" \
466 + $(use_with jemalloc jemalloc) \
467 + $(use_enable socks5 socks) \
468 + $(use_enable doc install-doc) \
469 + --enable-ipv6 \
470 + $(use_enable static-libs static) \
471 + $(use_enable static-libs install-static-library) \
472 + $(use_with static-libs static-linked-ext) \
473 + $(use_enable debug) \
474 + ${myconf} \
475 + --enable-option-checking=no \
476 + || die "econf failed"
477 +}
478 +
479 +src_compile() {
480 + emake V=1 EXTLDFLAGS="${LDFLAGS}" || die "emake failed"
481 +}
482 +
483 +src_test() {
484 + emake -j1 V=1 test || die "make test failed"
485 +
486 + elog "Ruby's make test has been run. Ruby also ships with a make check"
487 + elog "that cannot be run until after ruby has been installed."
488 + elog
489 + if use rubytests; then
490 + elog "You have enabled rubytests, so they will be installed to"
491 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
492 + elog "than root, and you must place them into a writeable directory."
493 + elog "Then call: "
494 + elog
495 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
496 + else
497 + elog "Enable the rubytests USE flag to install the make check tests"
498 + fi
499 +}
500 +
501 +src_install() {
502 + # Remove the remaining bundled gems. We do this late in the process
503 + # since they are used during the build to e.g. create the
504 + # documentation.
505 + rm -rf ext/json || die
506 +
507 + # Ruby is involved in the install process, we don't want interference here.
508 + unset RUBYOPT
509 +
510 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
511 +
512 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
513 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
514 + for d in $(find "${S}/ext" -type d) ; do
515 + RUBYLIB="${RUBYLIB}:$d"
516 + done
517 + export LD_LIBRARY_PATH RUBYLIB
518 +
519 + emake V=1 DESTDIR="${D}" install || die "make install failed"
520 +
521 + # Remove installed rubygems and rdoc copy
522 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
523 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
524 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
525 + rm -rf "${ED}/usr/bin/"{ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
526 +
527 + if use doc; then
528 + make DESTDIR="${D}" install-doc || die "make install-doc failed"
529 + fi
530 +
531 + if use examples; then
532 + insinto /usr/share/doc/${PF}
533 + doins -r sample
534 + fi
535 +
536 + dodoc ChangeLog NEWS doc/NEWS* README* || die
537 +
538 + if use rubytests; then
539 + pushd test
540 + insinto /usr/share/${PN}-${SLOT}/test
541 + doins -r .
542 + popd
543 + fi
544 +}
545 +
546 +pkg_postinst() {
547 + if [[ ! -n $(readlink "${EROOT}"usr/bin/ruby) ]] ; then
548 + eselect ruby set ruby${MY_SUFFIX}
549 + fi
550 +
551 + elog
552 + elog "To switch between available Ruby profiles, execute as root:"
553 + elog "\teselect ruby set ruby(23|24|...)"
554 + elog
555 +}
556 +
557 +pkg_postrm() {
558 + eselect ruby cleanup
559 +}