summaryrefslogtreecommitdiff
path: root/dev-lang/ruby
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-21 18:59:32 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-21 18:59:32 +0100
commit520a5b56dff7c24c9d42eafec142cb78b44f8e3e (patch)
treef562f705600dbd2292e97c0b4145787c2a8d1f97 /dev-lang/ruby
parent3811bc3072bf19e2be351d2c63f81532945c0f21 (diff)
gentoo resync : 21.07.2018
Diffstat (limited to 'dev-lang/ruby')
-rw-r--r--dev-lang/ruby/Manifest11
-rw-r--r--dev-lang/ruby/files/2.4/002_windows_crossdev.patch64
-rw-r--r--dev-lang/ruby/files/2.4/005_no-undefined-ext.patch11
-rw-r--r--dev-lang/ruby/files/2.4/009_no-gems.patch112
-rw-r--r--dev-lang/ruby/files/2.4/010-libressl_2.7.patch15
-rw-r--r--dev-lang/ruby/files/2.4/011-gcc8.patch64
-rw-r--r--dev-lang/ruby/files/2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch67
-rw-r--r--dev-lang/ruby/files/2.5/005_no-undefined-ext.patch11
-rw-r--r--dev-lang/ruby/files/2.5/009_no-gems.patch95
-rw-r--r--dev-lang/ruby/files/2.5/010-libressl_2.7.patch15
-rw-r--r--dev-lang/ruby/ruby-2.4.4-r1.ebuild229
-rw-r--r--dev-lang/ruby/ruby-2.5.1-r1.ebuild224
12 files changed, 918 insertions, 0 deletions
diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest
index 55d352f2d06d..006e7989114e 100644
--- a/dev-lang/ruby/Manifest
+++ b/dev-lang/ruby/Manifest
@@ -1,3 +1,12 @@
+AUX 2.4/002_windows_crossdev.patch 2175 BLAKE2B 988871c957bd1b54c0ce46d98f47b67dc9a708a641ed27b8159021384dec8fe72ecfab0c8c081dfab8025c1de7b356771bb45ed6b6911d200e81edc75c095dfd SHA512 5e88b30680f1d1d34e218972180271f57dce4db0299e423ce96901e8eadb9e461e38649adfc10d0361e8715ec94bfc7fe3198a95eca2d817cfccc3a677b60523
+AUX 2.4/005_no-undefined-ext.patch 479 BLAKE2B b11ae86049ed792e5f98e6e56d93468b0a3346aa33b8df076f1c50569bebeaa73f8d59452749654c4771fb7677ff4be19d7f566f6b7e548613caba6310f54dcd SHA512 347cbc588ac2551bd0f66cdcfa79d63ed51e0a743aa981420ed5205bda35efae752795b6a527985948b978e755b5c25a29c663cb5651fe58f37c3d9e711be42e
+AUX 2.4/009_no-gems.patch 4153 BLAKE2B c7d056d46cd769a00c3ae8b3866ad7ca7126fe008362461561693b6da7fb867c5418cc9f5fb11af242842af5edab050b68fafd349b8c6e75af208f6a36850900 SHA512 ec63fa29a6be3b86b4bde397292a2de73accbdab479ae881af9d364d7c8cb1f2a3e85c809735d47375b52923754d4abbd26a63c01616926189fda5e4a5a8a454
+AUX 2.4/010-libressl_2.7.patch 638 BLAKE2B ffd6091c3d1d657d44370d4bfd84e8c40fe387483972c09dbcb7819957be78ee320c6f46d2f78493d25357072950db13e08dff6d622d2374a9c330fe97ce200f SHA512 d42f61eda8292ee5d3485ba4576fd6dbd8a3e40918f2096de3b376b92f633b476f6ad4913fb3be3f7ef356e722d8a192317b233d174563cd342a429595b0cdae
+AUX 2.4/011-gcc8.patch 2470 BLAKE2B d6fe2e34e7c33ca7bccf3b934092ef43b4ba8766d8c160a0548fa4946fc61a763634037c3180479896802e6e75828af043e75839fd03cc9e4b6e126c833d2cb8 SHA512 1636dc821a822ab6ec919e576ebba9e9cba64540801df6a2b4411e650930ec5cdc3ab28aeb3c5d45d3304f73af52372c2dee91833bcd9952692f3167d21007d2
+AUX 2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch 2501 BLAKE2B 7c166f47ce8264354272c7f74ebee5fbe038b1cf06230c6507f62d823be266959b622a0a61920845dfc38fbe7846c4ccd1cabf8e133f456e94b1da5197c49526 SHA512 72319113329c7c3c74e5bab21b67256327a65fbe01827cd32ea289de769a91b493c5d1eb35a087ed026105a9e5daf8b0bc17374c01ef1a83cb408440d6316706
+AUX 2.5/005_no-undefined-ext.patch 486 BLAKE2B 715f952cab863847f420afb020cac6819e4ab4e8f5527bdf550dd51eef37e272e7e89cbda5b6f9f137fdac89dfc5e99d42be8ae5712c255f11a0628cf07dc84d SHA512 6bbded9fce0c091b7cfb170c9dc2b0882b0e8bbf8fe31eaf596f3620853c8c75aa64c2648d5a72a0208a6ab6d711eb080a2d6aa98352933eda3b874bdd39cee8
+AUX 2.5/009_no-gems.patch 3454 BLAKE2B f2439a799776c39ba16f1503d573c90ea6d74fc2bad3b3874a961add6b605bb064c683080a4258ed1a0e83bca5cb67c02ba68bceb6acea7613ab7166e16a2f4c SHA512 bef8b2763993755b5b6ccba0b5cbe002fd721405d7c274f421ae3d95fa4d0d99cdf946f5fa9a907cac2c3696b2cc23f2f2e030b3a70eca93081e49b02f25a072
+AUX 2.5/010-libressl_2.7.patch 638 BLAKE2B 53f5f5d275e2c5482a608a947a1b3c41e9dcdd1763cc57a075e3abd536567852387506ec0ce2f5f49f5eed2246ca9f860d56637a9f18cd17cd49fff6fc92d340 SHA512 986aff99fd35814c94581cdc169cfc5a5f75c87889db5556941809ecaf878b6af838afe2ee108dd7147ea70be6fe9e47f98cce3c1804af0a34f7c1aab8c13d89
DIST ruby-2.3.7.tar.xz 11438124 BLAKE2B 4f7e0422291794b254cb80edd2f0841bbc1e85cd62635024b6d43b23b1bcdc512d92b57d8885b253465cc8ef3c6cbcec97a6ef239dc11cc8b252e941d25e0487 SHA512 fd91c8db3d3aa4cc962a62f27b4d1a71f6b5567ab836e6dbfbbb1553eb269d11e12faf9e36af6c489c33b54fd89dab99bfe81a563158b704877f0628d6f5bc5a
DIST ruby-2.4.4.tar.xz 10049304 BLAKE2B 76bb2c3f63cda8e6f3814c74dded23568b2f7f12036d745bf55fc4a68e281ef3ae0fe29bf8e194db71f72e724ffe750a31bec9246ad1c01eb05ed93512a6422e SHA512 4dc112a149273d4221484ccbf1260c6c5fcad7e0a6e4bc91e4ef69cbc093d3191f7abd71420f80d680f8ea5d111e6803ba2af32166aa501913639e6d5696fde0
DIST ruby-2.5.1.tar.xz 11348108 BLAKE2B ea1019a81f96169ab8d435215362b36b098df373ac4f53ecda328686ec2c13204a38c66bb1bf9504d18e1762e7e6ae277bab3b16bb53b8e628962df715769f3b SHA512 31bacf58469953282cd5d8b51862dcf4b84dedb927c1871bc3fca32fc157fe49187631575a70838705fe246f4555647577a7ecc26894445a7d64de5503dc11b4
@@ -5,6 +14,8 @@ DIST ruby-patches-2.3.7.tar.bz2 3030 BLAKE2B 7c1e80ff0569a03672f53820c665933056b
DIST ruby-patches-2.4.4.tar.bz2 2898 BLAKE2B e46502dbb0aa25c3d71693a6c04b433bd4de60f194cdd283517c4b08da190356885d9bca4a6765402088185fa8ec681156e8e8eecf0703a2c1ea7bb81adc0bf9 SHA512 d767d43c7df737469247e42e1c4205b8c6850c8f335a2869c884f145c037e9bab10492cc7cd2903f5c33e232cdc5bbdabb3e8da837c7bf420b9d58d1d33149ed
DIST ruby-patches-2.5.1.tar.bz2 2986 BLAKE2B 64d64eda19bff94f205a6314c2af59896064fb64c118e0f3859d82aeb7e58478170b9160804ab8faf569054b65228abeecc5900e568e17133c21e9aed9bdf589 SHA512 c2bca3f98c7bb1de267b9f07eb1b0903c499c79e9c9d0166a6924e88e837434f27ddedd7aead7ebbe32f0530f751601ac5486a0db46ee28b94d7cea13e0e7924
EBUILD ruby-2.3.7.ebuild 6873 BLAKE2B ba2a6dac0d1a97c16b362348d4e693a46092fb0b6ed1834d2e91038aae254ed1005da06499673adc1b4751cb96865b2932eab1f24f74144f6030ecf7f358c8e1 SHA512 e1b9a05c7778d6859a778b90ea88401ff5a314bbad99e99c900f0434332154dddb9fa19eec25d8d112d879fb26ab114dcb62971396a57a81b03272f67e997c40
+EBUILD ruby-2.4.4-r1.ebuild 6614 BLAKE2B fcefec91b4b2dbebc60933f0d99bacd607f17ac8a5cb3219c4d2883b84ec80fc96cb959e94b337aa8820e39c0297071ccb89c6c3f9fdb823a0fe1f36cd8a71ff SHA512 394540a7ff8ae0ccd2074212a9afc666cc743d1ac85d6d0ea3e680e9088a248231d360b345c89ac2bb98bb12804cec2035952606eb938665df0ba6556b93d6e5
EBUILD ruby-2.4.4.ebuild 6980 BLAKE2B 2a08be5225e43fd5e5d7c90ff63ed43b6eab9b6e69ac1df7aead9657d651267e8bc0e741e16a276bee7fe5ecca5565d17d1428d96e5713305d278f251cdd99f4 SHA512 f43e497753a3fcfc0ff3e4ff840ae8cf3003671da0fe55e62651c17592f885cdbb99ed76ff6b99581ffd0903d23bc03b5425839f884f9e0e7ed925fb748edd4d
+EBUILD ruby-2.5.1-r1.ebuild 6406 BLAKE2B 8bdfbb254c15eade779454f1688038ed1fb13955d57e88c36c6a7a2e11e9efa7c20d680ce2e7422e92d1bfe8b4f59ba7dbe3282fb60ba1c6a070143c047a22d2 SHA512 b161c3b9848f9580de3f30474dcb49c0b71a09864b33e63e0882826e17be454dcaa566f7dd74f6a7e0d856df12dd79d39aed534ad65258fbf1ecaa4a40512d10
EBUILD ruby-2.5.1.ebuild 6772 BLAKE2B f9ac0a58ebcd718715fb67cbbe90cc853a14d8ba717bd91e93645115c5b37dc4def3827dbd01ba7b91138468b124c3581f90a133e88884a7f2b9a902f3b4ad82 SHA512 ed302d0d2a27d002a1b89aaea3b25ce6c88660f1fd30469cc2d292cfe3679bc477b6f8ac986964db45541db091be3040ee8dc8a76f5c10995d307dcb4246042b
MISC metadata.xml 911 BLAKE2B 7596a3d7a53742635e3262a0deac45eb6c37e51b473dde2b5da78742baba1ecab42a4a3e2f992cfa8f3765472df896ccff2e2936ba5dedba1aad05c2ab47d9dc SHA512 c5d9f15742132625061303ed71206e937933b402e183edbe0f37ee73ac7ba47b3f7ad54cbf12d1db3900a1f833ea2432790a10a02ba7e1e0c4bf128a716b9d72
diff --git a/dev-lang/ruby/files/2.4/002_windows_crossdev.patch b/dev-lang/ruby/files/2.4/002_windows_crossdev.patch
new file mode 100644
index 000000000000..7e290d434f03
--- /dev/null
+++ b/dev-lang/ruby/files/2.4/002_windows_crossdev.patch
@@ -0,0 +1,64 @@
+Bug: https://bugs.gentoo.org/show_bug.cgi?id=618878
+
+A few patches to make crossdev for mingw-w64 play nice with ruby's ebuilds.
+Basic gist is that without the following patch to configure.in ruby-2.4.1
+hardcodes 240 into the shared, static, and import library names, which when
+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
+to hit the tarballs that gentoo uses.
+
+Index: configure.in
+===================================================================
+--- a/configure.in (revision 57824)
++++ b/configure.in (revision 57825)
+@@ -3825,7 +3825,23 @@
+
+ AC_ARG_WITH(soname,
+ AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]),
+- [RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
++ [RUBY_SO_NAME=$withval],
++ [
++ AS_CASE(["$target_os"],
++ [darwin*], [
++ RUBY_SO_NAME='$(RUBY_BASE_NAME).$(RUBY_PROGRAM_VERSION)'
++ ],
++ [cygwin*], [
++ RUBY_SO_NAME='$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
++ ],
++ [mingw*], [
++ RUBY_SO_NAME="${rb_cv_msvcrt}"'-$(RUBY_BASE_NAME)$(MAJOR)$(MINOR)0'
++ AS_IF([test x"${target_cpu}" != xi386], [
++ RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
++ ])
++ ],
++ [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
++ ])
+
+ LIBRUBY_LDSHARED=$LDSHARED
+ LIBRUBY_DLDFLAGS=$DLDFLAGS
+@@ -3925,7 +3941,6 @@
+ SOLIBS='-lm -lc'
+ ],
+ [darwin*], [
+- RUBY_SO_NAME="$RUBY_SO_NAME"'.$(RUBY_PROGRAM_VERSION)'
+ LIBRUBY_LDSHARED='$(CC) -dynamiclib'
+ if test "$load_relative" = yes; then
+ libprefix="@executable_path/../${libdir_basename}"
+@@ -4157,7 +4172,6 @@
+ fi
+ ],
+ [cygwin*|mingw*], [
+- RUBY_SO_NAME="${RUBY_SO_NAME}"'$(MAJOR)$(MINOR)0'
+ LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
+ AS_CASE(["$target_os"],
+ [cygwin*], [
+@@ -4167,10 +4181,6 @@
+ fi
+ ],
+ [mingw*], [
+- RUBY_SO_NAME="${rb_cv_msvcrt}-${RUBY_SO_NAME}"
+- if test x"${target_cpu}" != xi386; then
+- RUBY_SO_NAME="${target_cpu}-${RUBY_SO_NAME}"
+- fi
+ if test x"$enable_shared" = xyes; then
+ LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
+ LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
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
new file mode 100644
index 000000000000..f27993240128
--- /dev/null
+++ b/dev-lang/ruby/files/2.4/005_no-undefined-ext.patch
@@ -0,0 +1,11 @@
+--- ruby-1.9.3-preview1.orig/configure.in
++++ ruby-1.9.3-preview1/configure.in
+@@ -2038,7 +2038,7 @@ if test "$with_dln_a_out" != yes; then
+ [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu], [
+ : ${LDSHARED='$(CC) -shared'}
+ if test "$rb_cv_binary_elf" = yes; then
+- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
+ fi
+ rb_cv_dlopen=yes],
+ [interix*], [ : ${LDSHARED='$(CC) -shared'}
diff --git a/dev-lang/ruby/files/2.4/009_no-gems.patch b/dev-lang/ruby/files/2.4/009_no-gems.patch
new file mode 100644
index 000000000000..6e4e2643d4c0
--- /dev/null
+++ b/dev-lang/ruby/files/2.4/009_no-gems.patch
@@ -0,0 +1,112 @@
+--- a/tool/rbinstall.rb.~1~ 2016-10-17 09:17:07.000000000 +0200
++++ b/tool/rbinstall.rb 2016-12-25 08:20:07.873491045 +0100
+@@ -695,107 +695,11 @@
+ # :startdoc:
+
+ install?(:ext, :comm, :gem) do
+- gem_dir = Gem.default_dir
+- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
+- prepare "default gems", gem_dir, directories
+-
+- spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
+- default_spec_dir = "#{spec_dir}/default"
+- makedirs(default_spec_dir)
+-
+- gems = Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").map {|src|
+- spec = Gem::Specification.load(src) || raise("invalid spec in #{src}")
+- file_collector = RbInstall::Specs::FileCollector.new(File.dirname(src))
+- files = file_collector.collect
+- next if files.empty?
+- spec.files = files
+- spec
+- }
+- gems.compact.sort_by(&:name).each do |gemspec|
+- full_name = "#{gemspec.name}-#{gemspec.version}"
+-
+- puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
+- gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec")
+- open_for_install(gemspec_path, $data_mode) do
+- gemspec.to_ruby
+- end
+-
+- unless gemspec.executables.empty? then
+- bin_dir = File.join(gem_dir, 'gems', full_name, gemspec.bindir)
+- makedirs(bin_dir)
+-
+- execs = gemspec.executables.map {|exec| File.join(srcdir, 'bin', exec)}
+- install(execs, bin_dir, :mode => $script_mode)
+- end
+- end
++ # gems are unbundled in Gentoo
+ end
+
+ install?(:ext, :comm, :gem) do
+- gem_dir = Gem.default_dir
+- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
+- prepare "bundle gems", gem_dir, directories
+- install_dir = with_destdir(gem_dir)
+- installed_gems = {}
+- options = {
+- :install_dir => install_dir,
+- :bin_dir => with_destdir(bindir),
+- :domain => :local,
+- :ignore_dependencies => true,
+- :dir_mode => $dir_mode,
+- :data_mode => $data_mode,
+- :prog_mode => $prog_mode,
+- :wrappers => true,
+- :format_executable => true,
+- }
+- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
+- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
+- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
+- dir = File.dirname(path)
+- spec = Dir.chdir(dir) {
+- Gem::Specification.load(File.basename(path))
+- }
+- next unless spec.platform == Gem::Platform::RUBY
+- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
+- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
+- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
+- spec.extensions[0] ||= "-"
+- end
+- ins = RbInstall::UnpackedInstaller.new(spec, options)
+- puts "#{" "*30}#{spec.name} #{spec.version}"
+- ins.install
+- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
+- unless spec.extensions.empty?
+- install_recursive(ext, spec.extension_dir)
+- end
+- installed_gems[spec.full_name] = true
+- end
+- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
+- unless installed_gems.empty?
+- install installed_gems, gem_dir+"/cache"
+- end
+- next if gems.empty?
+- if defined?(Zlib)
+- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
+- silent = Gem::SilentUI.new
+- gems.each do |gem|
+- inst = Gem::Installer.new(gem, options)
+- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
+- begin
+- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
+- rescue Gem::InstallError => e
+- next
+- end
+- gemname = File.basename(gem)
+- puts "#{" "*30}#{gemname}"
+- end
+- # fix directory permissions
+- # TODO: Gem.install should accept :dir_mode option or something
+- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
+- # fix .gemspec permissions
+- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
+- else
+- puts "skip installing bundle gems because of lacking zlib"
+- end
++ # gems are unbundled in Gentoo
+ end
+
+ parse_args()
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
new file mode 100644
index 000000000000..2e25ab095858
--- /dev/null
+++ b/dev-lang/ruby/files/2.4/010-libressl_2.7.patch
@@ -0,0 +1,15 @@
+--- a/ext/openssl/extconf.rb.orig 2017-09-08 14:38:12 UTC
++++ b/ext/openssl/extconf.rb
+@@ -157,8 +157,11 @@ OpenSSL.check_func_or_macro("SSL_get_ser
+ have_func("SSL_is_server")
+
+ # added in 1.1.0
++if !have_struct_member("SSL", "ctx", "openssl/ssl.h") ||
++ try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x2070000fL", "openssl/opensslv.h")
++ $defs.push("-DHAVE_OPAQUE_OPENSSL")
++end
+ have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
+-have_struct_member("SSL", "ctx", "openssl/ssl.h") || $defs.push("-DHAVE_OPAQUE_OPENSSL")
+ have_func("BN_GENCB_new")
+ have_func("BN_GENCB_free")
+ have_func("BN_GENCB_get_arg")
diff --git a/dev-lang/ruby/files/2.4/011-gcc8.patch b/dev-lang/ruby/files/2.4/011-gcc8.patch
new file mode 100644
index 000000000000..cb2443631dd8
--- /dev/null
+++ b/dev-lang/ruby/files/2.4/011-gcc8.patch
@@ -0,0 +1,64 @@
+From 027b576b31cd12bad575b3a39476726273f58c41 Mon Sep 17 00:00:00 2001
+From: naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
+Date: Mon, 18 Dec 2017 09:03:59 +0000
+Subject: [PATCH] suppress warning: 'const' attribute on function returning
+ 'void'
+
+git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
+---
+ include/ruby/intern.h | 4 ++--
+ include/ruby/ruby.h | 2 +-
+ internal.h | 4 ++--
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/include/ruby/intern.h b/include/ruby/intern.h
+index 5684b3230a67..a711b861159f 100644
+--- a/include/ruby/intern.h
++++ b/include/ruby/intern.h
+@@ -249,9 +249,9 @@ PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3);
+ NORETURN(void rb_invalid_str(const char*, const char*));
+ NORETURN(void rb_error_frozen(const char*));
+ NORETURN(void rb_error_frozen_object(VALUE));
+-CONSTFUNC(void rb_error_untrusted(VALUE));
++void rb_error_untrusted(VALUE);
+ void rb_check_frozen(VALUE);
+-CONSTFUNC(void rb_check_trusted(VALUE));
++void rb_check_trusted(VALUE);
+ #define rb_check_frozen_internal(obj) do { \
+ VALUE frozen_obj = (obj); \
+ if (OBJ_FROZEN(frozen_obj)) { \
+diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
+index 9c7d2fb68439..3210103c648a 100644
+--- a/include/ruby/ruby.h
++++ b/include/ruby/ruby.h
+@@ -628,7 +628,7 @@ int ruby_safe_level_2_warning(void) __attribute__((const,warning("$SAFE=2 to 4 a
+ # define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level, error))
+ #endif
+ void rb_set_safe_level_force(int);
+-CONSTFUNC(void rb_secure_update(VALUE));
++void rb_secure_update(VALUE);
+ NORETURN(void rb_insecure_operation(void));
+
+ VALUE rb_errinfo(void);
+diff --git a/internal.h b/internal.h
+index d0257a8d8ba0..4ccf3218c6ca 100644
+--- a/internal.h
++++ b/internal.h
+@@ -1110,7 +1110,7 @@ VALUE rb_invcmp(VALUE, VALUE);
+ struct rb_block;
+ int rb_dvar_defined(ID, const struct rb_block *);
+ int rb_local_defined(ID, const struct rb_block *);
+-CONSTFUNC(const char * rb_insns_name(int i));
++const char * rb_insns_name(int i);
+ VALUE rb_insns_name_array(void);
+
+ /* complex.c */
+@@ -1136,7 +1136,7 @@ void Init_ext(void);
+
+ /* encoding.c */
+ ID rb_id_encoding(void);
+-CONSTFUNC(void rb_gc_mark_encodings(void));
++void rb_gc_mark_encodings(void);
+ rb_encoding *rb_enc_get_from_index(int index);
+ rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
+ int rb_encdb_replicate(const char *alias, const char *orig);
diff --git a/dev-lang/ruby/files/2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch b/dev-lang/ruby/files/2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch
new file mode 100644
index 000000000000..2ade8b8d4203
--- /dev/null
+++ b/dev-lang/ruby/files/2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch
@@ -0,0 +1,67 @@
+From 5af43b1ec2674e9f86090790bc61abdb96be14ff Mon Sep 17 00:00:00 2001
+From: hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
+Date: Tue, 30 Jan 2018 05:43:42 +0000
+Subject: [PATCH] ia64: update ia64-specific code to use execution context
+
+This change follows commit 837fd5e494731d7d44786f29e7d6e8c27029806f
+in '#ifdef __ia64' branches.
+
+Noticed as a build failure by John Paul Adrian Glaubitz:
+
+```
+ cont.c:502:50: error: 'rb_thread_t {aka struct rb_thread_struct}'
+ has no member named 'machine'
+ size = cont->machine.register_stack_size =
+ th->machine.register_stack_end - th->machine.register_stack_start;
+ ^~
+```
+
+The change is trivial: update 'th->machine' usage to 'th->ec->machine'.
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
+---
+ cont.c | 6 +++---
+ thread.c | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/cont.c b/cont.c
+index f48fd2e52b..93a64f8fe6 100644
+--- a/cont.c
++++ b/cont.c
+@@ -475,7 +475,7 @@ cont_save_machine_stack(rb_thread_t *th, rb_context_t *cont)
+
+ SET_MACHINE_STACK_END(&th->ec->machine.stack_end);
+ #ifdef __ia64
+- th->machine.register_stack_end = rb_ia64_bsp();
++ th->ec->machine.register_stack_end = rb_ia64_bsp();
+ #endif
+
+ if (th->ec->machine.stack_start > th->ec->machine.stack_end) {
+@@ -499,8 +499,8 @@ cont_save_machine_stack(rb_thread_t *th, rb_context_t *cont)
+
+ #ifdef __ia64
+ rb_ia64_flushrs();
+- size = cont->machine.register_stack_size = th->machine.register_stack_end - th->machine.register_stack_start;
+- cont->machine.register_stack_src = th->machine.register_stack_start;
++ size = cont->machine.register_stack_size = th->ec->machine.register_stack_end - th->ec->machine.register_stack_start;
++ cont->machine.register_stack_src = th->ec->machine.register_stack_start;
+ if (cont->machine.register_stack) {
+ REALLOC_N(cont->machine.register_stack, VALUE, size);
+ }
+diff --git a/thread.c b/thread.c
+index acb53354fd..23957eba09 100644
+--- a/thread.c
++++ b/thread.c
+@@ -133,7 +133,7 @@ static inline void blocking_region_end(rb_thread_t *th, struct rb_blocking_regio
+
+ #ifdef __ia64
+ #define RB_GC_SAVE_MACHINE_REGISTER_STACK(th) \
+- do{(th)->machine.register_stack_end = rb_ia64_bsp();}while(0)
++ do{(th)->ec->machine.register_stack_end = rb_ia64_bsp();}while(0)
+ #else
+ #define RB_GC_SAVE_MACHINE_REGISTER_STACK(th)
+ #endif
+--
+2.16.1
+
diff --git a/dev-lang/ruby/files/2.5/005_no-undefined-ext.patch b/dev-lang/ruby/files/2.5/005_no-undefined-ext.patch
new file mode 100644
index 000000000000..1f0fdda08da5
--- /dev/null
+++ b/dev-lang/ruby/files/2.5/005_no-undefined-ext.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac.~1~ 2017-12-15 10:43:40.000000000 +0100
++++ b/configure.ac 2017-12-25 11:02:19.099076831 +0100
+@@ -3233,7 +3233,7 @@
+ [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku*], [
+ : ${LDSHARED='$(CC) -shared'}
+ AS_IF([test "$rb_cv_binary_elf" = yes], [
+- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
+ ])
+ rb_cv_dlopen=yes],
+ [interix*], [ : ${LDSHARED='$(CC) -shared'}
diff --git a/dev-lang/ruby/files/2.5/009_no-gems.patch b/dev-lang/ruby/files/2.5/009_no-gems.patch
new file mode 100644
index 000000000000..e12429a43242
--- /dev/null
+++ b/dev-lang/ruby/files/2.5/009_no-gems.patch
@@ -0,0 +1,95 @@
+--- a/tool/rbinstall.rb.~1~ 2017-10-30 06:45:20.000000000 +0100
++++ b/tool/rbinstall.rb 2017-12-25 11:06:53.340432435 +0100
+@@ -700,20 +700,10 @@
+ # :startdoc:
+
+ install?(:ext, :comm, :gem, :'default-gems', :'default-gems-comm') do
+- install_default_gem('lib', srcdir)
++ # Gems are unbundled in Gentoo
+ end
+ install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do
+- install_default_gem('ext', srcdir) do |path|
+- # assume that gemspec and extconf.rb are placed in the same directory
+- success = false
+- begin
+- IO.foreach(File.dirname(path[(srcdir.size+1)..-1]) + "/Makefile") do |l|
+- break success = true if /^TARGET\s*=/ =~ l
+- end
+- rescue Errno::ENOENT
+- end
+- success
+- end
++ # Gems are unbundled in Gentoo
+ end
+
+ def load_gemspec(file)
+@@ -765,68 +755,7 @@
+ end
+
+ install?(:ext, :comm, :gem, :'bundled-gems') do
+- gem_dir = Gem.default_dir
+- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
+- prepare "bundled gems", gem_dir, directories
+- install_dir = with_destdir(gem_dir)
+- installed_gems = {}
+- options = {
+- :install_dir => install_dir,
+- :bin_dir => with_destdir(bindir),
+- :domain => :local,
+- :ignore_dependencies => true,
+- :dir_mode => $dir_mode,
+- :data_mode => $data_mode,
+- :prog_mode => $prog_mode,
+- :wrappers => true,
+- :format_executable => true,
+- }
+- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
+- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
+- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
+- spec = load_gemspec(path)
+- next unless spec.platform == Gem::Platform::RUBY
+- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
+- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
+- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
+- spec.extensions[0] ||= "-"
+- end
+- ins = RbInstall::UnpackedInstaller.new(spec, options)
+- puts "#{INDENT}#{spec.name} #{spec.version}"
+- ins.install
+- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
+- unless spec.extensions.empty?
+- install_recursive(ext, spec.extension_dir)
+- end
+- installed_gems[spec.full_name] = true
+- end
+- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
+- unless installed_gems.empty?
+- install installed_gems, gem_dir+"/cache"
+- end
+- next if gems.empty?
+- if defined?(Zlib)
+- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
+- silent = Gem::SilentUI.new
+- gems.each do |gem|
+- inst = Gem::Installer.new(gem, options)
+- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
+- begin
+- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
+- rescue Gem::InstallError => e
+- next
+- end
+- gemname = File.basename(gem)
+- puts "#{INDENT}#{gemname}"
+- end
+- # fix directory permissions
+- # TODO: Gem.install should accept :dir_mode option or something
+- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
+- # fix .gemspec permissions
+- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
+- else
+- puts "skip installing bundled gems because of lacking zlib"
+- end
++ # Gems are unbundled in Gentoo
+ end
+
+ parse_args()
diff --git a/dev-lang/ruby/files/2.5/010-libressl_2.7.patch b/dev-lang/ruby/files/2.5/010-libressl_2.7.patch
new file mode 100644
index 000000000000..150f43c9e55d
--- /dev/null
+++ b/dev-lang/ruby/files/2.5/010-libressl_2.7.patch
@@ -0,0 +1,15 @@
+--- a/ext/openssl/extconf.rb.orig 2018-04-02 09:57:14 UTC
++++ b/ext/openssl/extconf.rb
+@@ -122,8 +122,11 @@ OpenSSL.check_func_or_macro("SSL_get_ser
+ have_func("SSL_is_server")
+
+ # added in 1.1.0
++if !have_struct_member("SSL", "ctx", "openssl/ssl.h") ||
++ try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x2070000fL", "openssl/opensslv.h")
++ $defs.push("-DHAVE_OPAQUE_OPENSSL")
++end
+ have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
+-have_struct_member("SSL", "ctx", "openssl/ssl.h") || $defs.push("-DHAVE_OPAQUE_OPENSSL")
+ have_func("BN_GENCB_new")
+ have_func("BN_GENCB_free")
+ have_func("BN_GENCB_get_arg")
diff --git a/dev-lang/ruby/ruby-2.4.4-r1.ebuild b/dev-lang/ruby/ruby-2.4.4-r1.ebuild
new file mode 100644
index 000000000000..dec2991fe7a8
--- /dev/null
+++ b/dev-lang/ruby/ruby-2.4.4-r1.ebuild
@@ -0,0 +1,229 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic multilib
+
+MY_P="${PN}-$(ver_cut 1-3)"
+S=${WORKDIR}/${MY_P}
+
+SLOT=$(ver_cut 1-2)
+MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
+RUBYVERSION=${SLOT}.0
+
+DESCRIPTION="An object-oriented scripting language"
+HOMEPAGE="https://www.ruby-lang.org/"
+SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.xz"
+
+LICENSE="|| ( Ruby-BSD BSD-2 )"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="berkdb debug doc examples gdbm ipv6 jemalloc libressl +rdoc rubytests socks5 ssl static-libs tk xemacs"
+
+RDEPEND="
+ berkdb? ( sys-libs/db:= )
+ gdbm? ( sys-libs/gdbm:= )
+ jemalloc? ( dev-libs/jemalloc )
+ ssl? (
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl )
+ )
+ socks5? ( >=net-proxy/dante-1.1.13 )
+ tk? (
+ dev-lang/tcl:0=[threads]
+ dev-lang/tk:0=[threads]
+ )
+ dev-libs/libyaml
+ virtual/libffi
+ sys-libs/zlib
+ >=app-eselect/eselect-ruby-20161226
+ !<dev-ruby/rdoc-3.9.4
+ !<dev-ruby/rubygems-1.8.10-r1"
+
+DEPEND="${RDEPEND}"
+
+BUNDLED_GEMS="
+ >=dev-ruby/did_you_mean-1.1.0:2.4[ruby_targets_ruby24]
+ >=dev-ruby/minitest-5.10.1[ruby_targets_ruby24]
+ >=dev-ruby/net-telnet-0.1.1[ruby_targets_ruby24]
+ >=dev-ruby/power_assert-0.4.1[ruby_targets_ruby24]
+ >=dev-ruby/rake-12.0.0[ruby_targets_ruby24]
+ >=dev-ruby/test-unit-3.2.3[ruby_targets_ruby24]
+ >=dev-ruby/xmlrpc-0.2.1[ruby_targets_ruby24]
+"
+
+PDEPEND="
+ ${BUNDLED_GEMS}
+ virtual/rubygems[ruby_targets_ruby24]
+ >=dev-ruby/json-2.0.2[ruby_targets_ruby24]
+ rdoc? ( >=dev-ruby/rdoc-5.1.0[ruby_targets_ruby24] )
+ xemacs? ( app-xemacs/ruby-modes )"
+
+src_prepare() {
+ eapply "${FILESDIR}"/${SLOT}/*.patch
+
+ einfo "Unbundling gems..."
+ cd "$S"
+ # Remove bundled gems that we will install via PDEPEND, bug
+ # 539700. Use explicit version numbers to ensure rm fails when they
+ # change so we can update dependencies accordingly.
+ 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
+
+ einfo "Removing bundled libraries..."
+ rm -fr ext/fiddle/libffi-3.2.1 || die
+
+ # Fix a hardcoded lib path in configure script
+ sed -i -e "s:\(RUBY_LIB_PREFIX=\"\${prefix}/\)lib:\1$(get_libdir):" \
+ configure.in || die "sed failed"
+
+ eapply_user
+
+ eautoreconf
+}
+
+src_configure() {
+ local modules= myconf=
+
+ # -fomit-frame-pointer makes ruby segfault, see bug #150413.
+ filter-flags -fomit-frame-pointer
+ # In many places aliasing rules are broken; play it safe
+ # as it's risky with newer compilers to leave it as it is.
+ append-flags -fno-strict-aliasing
+ # SuperH needs this
+ use sh && append-flags -mieee
+
+ # Socks support via dante
+ if use socks5 ; then
+ # Socks support can't be disabled as long as SOCKS_SERVER is
+ # set and socks library is present, so need to unset
+ # SOCKS_SERVER in that case.
+ unset SOCKS_SERVER
+ fi
+
+ # Increase GC_MALLOC_LIMIT if set (default is 8000000)
+ if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
+ append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
+ fi
+
+ # ipv6 hack, bug 168939. Needs --enable-ipv6.
+ use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
+
+ # Determine which modules *not* to build depending in the USE flags.
+ if ! use berkdb ; then
+ modules="${modules},dbm"
+ fi
+ if ! use gdbm ; then
+ modules="${modules},gdbm"
+ fi
+ if ! use ssl ; then
+ modules="${modules},openssl"
+ fi
+ if ! use tk ; then
+ modules="${modules},tk"
+ fi
+
+ # Provide an empty LIBPATHENV because we disable rpath but we do not
+ # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
+ # #564272
+ INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
+ --program-suffix=${MY_SUFFIX} \
+ --with-soname=ruby${MY_SUFFIX} \
+ --docdir=${EPREFIX}/usr/share/doc/${P} \
+ --enable-shared \
+ --enable-pthread \
+ --disable-rpath \
+ --with-out-ext="${modules}" \
+ $(use_with jemalloc jemalloc) \
+ $(use_enable socks5 socks) \
+ $(use_enable doc install-doc) \
+ --enable-ipv6 \
+ $(use_enable static-libs static) \
+ $(use_enable static-libs install-static-library) \
+ $(use_with static-libs static-linked-ext) \
+ $(use_enable debug) \
+ ${myconf} \
+ --enable-option-checking=no \
+ || die "econf failed"
+}
+
+src_compile() {
+ emake V=1 EXTLDFLAGS="${LDFLAGS}" || die "emake failed"
+}
+
+src_test() {
+ emake -j1 V=1 test || die "make test failed"
+
+ elog "Ruby's make test has been run. Ruby also ships with a make check"
+ elog "that cannot be run until after ruby has been installed."
+ elog
+ if use rubytests; then
+ elog "You have enabled rubytests, so they will be installed to"
+ elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
+ elog "than root, and you must place them into a writeable directory."
+ elog "Then call: "
+ elog
+ elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
+ else
+ elog "Enable the rubytests USE flag to install the make check tests"
+ fi
+}
+
+src_install() {
+ # Remove the remaining bundled gems. We do this late in the process
+ # since they are used during the build to e.g. create the
+ # documentation.
+ rm -rf ext/json || die
+
+ # Ruby is involved in the install process, we don't want interference here.
+ unset RUBYOPT
+
+ local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
+
+ LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
+ RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
+ for d in $(find "${S}/ext" -type d) ; do
+ RUBYLIB="${RUBYLIB}:$d"
+ done
+ export LD_LIBRARY_PATH RUBYLIB
+
+ emake V=1 DESTDIR="${D}" install || die "make install failed"
+
+ # Remove installed rubygems and rdoc copy
+ rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
+ rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
+ rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
+ rm -rf "${ED}/usr/bin/"{ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
+
+ if use doc; then
+ make DESTDIR="${D}" install-doc || die "make install-doc failed"
+ fi
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r sample
+ fi
+
+ dodoc ChangeLog NEWS doc/NEWS* README* || die
+
+ if use rubytests; then
+ pushd test
+ insinto /usr/share/${PN}-${SLOT}/test
+ doins -r .
+ popd
+ fi
+}
+
+pkg_postinst() {
+ if [[ ! -n $(readlink "${EROOT}"usr/bin/ruby) ]] ; then
+ eselect ruby set ruby${MY_SUFFIX}
+ fi
+
+ elog
+ elog "To switch between available Ruby profiles, execute as root:"
+ elog "\teselect ruby set ruby(23|24|...)"
+ elog
+}
+
+pkg_postrm() {
+ eselect ruby cleanup
+}
diff --git a/dev-lang/ruby/ruby-2.5.1-r1.ebuild b/dev-lang/ruby/ruby-2.5.1-r1.ebuild
new file mode 100644
index 000000000000..d5c3f48de2dd
--- /dev/null
+++ b/dev-lang/ruby/ruby-2.5.1-r1.ebuild
@@ -0,0 +1,224 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic multilib
+
+MY_P="${PN}-$(ver_cut 1-3)"
+S=${WORKDIR}/${MY_P}
+
+SLOT=$(ver_cut 1-2)
+MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
+RUBYVERSION=${SLOT}.0
+
+DESCRIPTION="An object-oriented scripting language"
+HOMEPAGE="https://www.ruby-lang.org/"
+SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.xz"
+
+LICENSE="|| ( Ruby-BSD BSD-2 )"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="berkdb debug doc examples gdbm ipv6 jemalloc libressl +rdoc rubytests socks5 ssl static-libs tk xemacs"
+
+RDEPEND="
+ berkdb? ( sys-libs/db:= )
+ gdbm? ( sys-libs/gdbm:= )
+ jemalloc? ( dev-libs/jemalloc )
+ ssl? (
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl )
+ )
+ socks5? ( >=net-proxy/dante-1.1.13 )
+ tk? (
+ dev-lang/tcl:0=[threads]
+ dev-lang/tk:0=[threads]
+ )
+ dev-libs/libyaml
+ virtual/libffi
+ sys-libs/zlib
+ >=app-eselect/eselect-ruby-20171225
+"
+
+DEPEND="${RDEPEND}"
+
+BUNDLED_GEMS="
+ >=dev-ruby/did_you_mean-1.2.0:2.5[ruby_targets_ruby25]
+ >=dev-ruby/minitest-5.10.3[ruby_targets_ruby25]
+ >=dev-ruby/net-telnet-0.1.1[ruby_targets_ruby25]
+ >=dev-ruby/power_assert-1.1.1[ruby_targets_ruby25]
+ >=dev-ruby/rake-12.3.0[ruby_targets_ruby25]
+ >=dev-ruby/test-unit-3.2.7[ruby_targets_ruby25]
+ >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby25]
+"
+
+PDEPEND="
+ ${BUNDLED_GEMS}
+ virtual/rubygems[ruby_targets_ruby25]
+ >=dev-ruby/json-2.0.2[ruby_targets_ruby25]
+ rdoc? ( >=dev-ruby/rdoc-5.1.0[ruby_targets_ruby25] )
+ xemacs? ( app-xemacs/ruby-modes )"
+
+src_prepare() {
+ eapply "${FILESDIR}"/${SLOT}/*.patch
+
+ einfo "Unbundling gems..."
+ cd "$S"
+ # Remove bundled gems that we will install via PDEPEND, bug
+ # 539700. Use explicit version numbers to ensure rm fails when they
+ # change so we can update dependencies accordingly.
+ rm -f gems/{did_you_mean-1.2.0,minitest-5.10.3,net-telnet-0.1.1,power_assert-1.1.1,rake-12.3.0,test-unit-3.2.7,xmlrpc-0.3.0}.gem || die
+
+ einfo "Removing bundled libraries..."
+ rm -fr ext/fiddle/libffi-3.2.1 || die
+
+ eapply_user
+
+ eautoreconf
+}
+
+src_configure() {
+ local modules= myconf=
+
+ # -fomit-frame-pointer makes ruby segfault, see bug #150413.
+ filter-flags -fomit-frame-pointer
+ # In many places aliasing rules are broken; play it safe
+ # as it's risky with newer compilers to leave it as it is.
+ append-flags -fno-strict-aliasing
+ # SuperH needs this
+ use sh && append-flags -mieee
+
+ # Socks support via dante
+ if use socks5 ; then
+ # Socks support can't be disabled as long as SOCKS_SERVER is
+ # set and socks library is present, so need to unset
+ # SOCKS_SERVER in that case.
+ unset SOCKS_SERVER
+ fi
+
+ # Increase GC_MALLOC_LIMIT if set (default is 8000000)
+ if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
+ append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
+ fi
+
+ # ipv6 hack, bug 168939. Needs --enable-ipv6.
+ use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
+
+ # Determine which modules *not* to build depending in the USE flags.
+ if ! use berkdb ; then
+ modules="${modules},dbm"
+ fi
+ if ! use gdbm ; then
+ modules="${modules},gdbm"
+ fi
+ if ! use ssl ; then
+ modules="${modules},openssl"
+ fi
+ if ! use tk ; then
+ modules="${modules},tk"
+ fi
+
+ # Provide an empty LIBPATHENV because we disable rpath but we do not
+ # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
+ # #564272
+ INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
+ --program-suffix=${MY_SUFFIX} \
+ --with-soname=ruby${MY_SUFFIX} \
+ --docdir=${EPREFIX}/usr/share/doc/${P} \
+ --enable-shared \
+ --enable-pthread \
+ --disable-rpath \
+ --with-out-ext="${modules}" \
+ $(use_with jemalloc jemalloc) \
+ $(use_enable socks5 socks) \
+ $(use_enable doc install-doc) \
+ --enable-ipv6 \
+ $(use_enable static-libs static) \
+ $(use_enable static-libs install-static-library) \
+ $(use_with static-libs static-linked-ext) \
+ $(use_enable debug) \
+ ${myconf} \
+ --enable-option-checking=no \
+ || die "econf failed"
+}
+
+src_compile() {
+ emake V=1 EXTLDFLAGS="${LDFLAGS}" || die "emake failed"
+}
+
+src_test() {
+ emake -j1 V=1 test || die "make test failed"
+
+ elog "Ruby's make test has been run. Ruby also ships with a make check"
+ elog "that cannot be run until after ruby has been installed."
+ elog
+ if use rubytests; then
+ elog "You have enabled rubytests, so they will be installed to"
+ elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
+ elog "than root, and you must place them into a writeable directory."
+ elog "Then call: "
+ elog
+ elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
+ else
+ elog "Enable the rubytests USE flag to install the make check tests"
+ fi
+}
+
+src_install() {
+ # Remove the remaining bundled gems. We do this late in the process
+ # since they are used during the build to e.g. create the
+ # documentation.
+ rm -rf ext/json || die
+
+ # Ruby is involved in the install process, we don't want interference here.
+ unset RUBYOPT
+
+ local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
+
+ LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
+ RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
+ for d in $(find "${S}/ext" -type d) ; do
+ RUBYLIB="${RUBYLIB}:$d"
+ done
+ export LD_LIBRARY_PATH RUBYLIB
+
+ emake V=1 DESTDIR="${D}" install || die "make install failed"
+
+ # Remove installed rubygems and rdoc copy
+ rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
+ rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
+ rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
+ rm -rf "${ED}/usr/bin/"{ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
+
+ if use doc; then
+ make DESTDIR="${D}" install-doc || die "make install-doc failed"
+ fi
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r sample
+ fi
+
+ dodoc ChangeLog NEWS doc/NEWS* README* || die
+
+ if use rubytests; then
+ pushd test
+ insinto /usr/share/${PN}-${SLOT}/test
+ doins -r .
+ popd
+ fi
+}
+
+pkg_postinst() {
+ if [[ ! -n $(readlink "${EROOT}"usr/bin/ruby) ]] ; then
+ eselect ruby set ruby${MY_SUFFIX}
+ fi
+
+ elog
+ elog "To switch between available Ruby profiles, execute as root:"
+ elog "\teselect ruby set ruby(23|24|...)"
+ elog
+}
+
+pkg_postrm() {
+ eselect ruby cleanup
+}