[gentoo-commits] repo/gentoo:master commit in: dev-lang/ruby/, dev-lang/ruby/files/3.1/, dev-lang/ruby/files/3.0/

2022-04-23 Thread Hans de Graaff
commit: 78c5e6bb96842f6ab7eb5e6bf4c86360797f2564
Author: Hans de Graaff  gentoo  org>
AuthorDate: Sat Apr 23 09:52:05 2022 +
Commit: Hans de Graaff  gentoo  org>
CommitDate: Sat Apr 23 09:52:05 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78c5e6bb

dev-lang/ruby: copy patches to adhere to ruby lang policy

We keep patch sets per version, even if the patches can be applied
as-is, to keep things manageable.

Signed-off-by: Hans de Graaff  gentoo.org>

 dev-lang/ruby/files/3.0/901-musl-stacksize.patch | 26 +++
 dev-lang/ruby/files/3.1/900-musl-coroutine.patch | 41 
 dev-lang/ruby/ruby-3.0.4.ebuild  |  2 +-
 dev-lang/ruby/ruby-3.1.2.ebuild  |  2 +-
 4 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/dev-lang/ruby/files/3.0/901-musl-stacksize.patch 
b/dev-lang/ruby/files/3.0/901-musl-stacksize.patch
new file mode 100644
index ..e5fcfce2195e
--- /dev/null
+++ b/dev-lang/ruby/files/3.0/901-musl-stacksize.patch
@@ -0,0 +1,26 @@
+musl has a conservative stacksize, as compared to glibc, so treat it
+like other systems with such stacksize
+
+diff --git a/thread_pthread.c b/thread_pthread.c
+index 951885ffa0..e2d662143b 100644
+--- a/thread_pthread.c
 b/thread_pthread.c
+@@ -721,7 +721,7 @@ ruby_init_stack(volatile VALUE *addr
+ {
+ native_main_thread.id = pthread_self();
+ 
+-#if MAINSTACKADDR_AVAILABLE
++#if MAINSTACKADDR_AVAILABLE && !(defined(__linux__) && !defined(__GLIBC__))
+ if (native_main_thread.stack_maxsize) return;
+ {
+void* stackaddr;
+@@ -1680,7 +1680,7 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const 
void *addr)
+
+ #ifdef STACKADDR_AVAILABLE
+ if (get_stack(, ) == 0) {
+-# ifdef __APPLE__
++# if defined(__APPLE__) || (defined(__linux__) && !defined(__GLIBC__))
+   if (pthread_equal(th->thread_id, native_main_thread.id)) {
+   struct rlimit rlim;
+   if (getrlimit(RLIMIT_STACK, ) == 0 && rlim.rlim_cur > size) {
+

diff --git a/dev-lang/ruby/files/3.1/900-musl-coroutine.patch 
b/dev-lang/ruby/files/3.1/900-musl-coroutine.patch
new file mode 100644
index ..ed47c54e29c7
--- /dev/null
+++ b/dev-lang/ruby/files/3.1/900-musl-coroutine.patch
@@ -0,0 +1,41 @@
+Adapted for Gentoo version 2.7.4
+
+From b570e7de87aaad8c903176d835e8124127f627b3 Mon Sep 17 00:00:00 2001
+From: Andrew Aladjev 
+Date: Sat, 26 Sep 2020 12:58:06 +0300
+Subject: [PATCH] fixed default coroutine selection for musl
+
+---
+ configure.ac | 5 -
+ coroutine/copy/Context.c | 2 ++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index ab5d532c103b..084f0936c006 100644
+--- a/configure.ac
 b/configure.ac
+@@ -2364,7 +2364,10 @@
+ rb_cv_coroutine=copy
+ ],
+ [*], [
+-rb_cv_coroutine=ucontext
++AC_CHECK_FUNCS([getcontext swapcontext makecontext],
++[rb_cv_coroutine=ucontext],
++[rb_cv_coroutine=copy; break]
++)
+ ]
+ )
+ AC_MSG_RESULT(${rb_cv_coroutine})
+diff --git a/coroutine/copy/Context.c b/coroutine/copy/Context.c
+index c1b4144e9857..94a7f57f7d89 100644
+--- a/coroutine/copy/Context.c
 b/coroutine/copy/Context.c
+@@ -5,6 +5,8 @@
+  *  Copyright, 2019, by Samuel Williams.
+ */
+ 
++#include 
++
+ #include "Context.h"
+ 
+ // http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html

diff --git a/dev-lang/ruby/ruby-3.0.4.ebuild b/dev-lang/ruby/ruby-3.0.4.ebuild
index 9f2844fcd073..bc7abb7b0e17 100644
--- a/dev-lang/ruby/ruby-3.0.4.ebuild
+++ b/dev-lang/ruby/ruby-3.0.4.ebuild
@@ -69,7 +69,7 @@ src_prepare() {
 
if use elibc_musl ; then
eapply "${FILESDIR}"/3.0/900-musl-*.patch
-   eapply "${FILESDIR}"/2.7/901-musl-*.patch
+   eapply "${FILESDIR}"/3.0/901-musl-*.patch
fi
 
einfo "Unbundling gems..."

diff --git a/dev-lang/ruby/ruby-3.1.2.ebuild b/dev-lang/ruby/ruby-3.1.2.ebuild
index 4d6261c67b20..df0d23d2bc16 100644
--- a/dev-lang/ruby/ruby-3.1.2.ebuild
+++ b/dev-lang/ruby/ruby-3.1.2.ebuild
@@ -68,7 +68,7 @@ src_prepare() {
eapply "${FILESDIR}"/"${SLOT}"/010*.patch
 
if use elibc_musl ; then
-   eapply "${FILESDIR}"/2.7/901-musl-*.patch
+   eapply "${FILESDIR}"/3.1/901-musl-*.patch
fi
 
einfo "Unbundling gems..."



[gentoo-commits] repo/gentoo:master commit in: dev-lang/ruby/, dev-lang/ruby/files/3.1/

2022-03-11 Thread Hans de Graaff
commit: 28c577ea567095d12b456135459331e34a87f66d
Author: Hans de Graaff  gentoo  org>
AuthorDate: Sat Mar 12 07:14:37 2022 +
Commit: Hans de Graaff  gentoo  org>
CommitDate: Sat Mar 12 07:21:19 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28c577ea

dev-lang/ruby: add ruby 3.1

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Hans de Graaff  gentoo.org>

 dev-lang/ruby/Manifest |   1 +
 dev-lang/ruby/files/3.1/001-socksocket-fix.patch   |  15 ++
 .../ruby/files/3.1/010-default-gem-location.patch  |  20 ++
 dev-lang/ruby/files/3.1/900-musl-coroutine.patch   |  28 +++
 dev-lang/ruby/ruby-3.1.1.ebuild| 267 +
 5 files changed, 331 insertions(+)

diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest
index 2aa532d28be2..e739d42d9b3b 100644
--- a/dev-lang/ruby/Manifest
+++ b/dev-lang/ruby/Manifest
@@ -1,3 +1,4 @@
 DIST ruby-2.6.9.tar.xz 11590064 BLAKE2B 
8d14baf479053b7fab517f1e41191b009413d557431c558d92489a36d539f9a667571e4493abba171b047f8ba6d1f676fb6d2f2152fcae737924e773a324ddf6
 SHA512 
f60aa89e685cea324185eb0d13e6b44caef4e4f761cbf9ea1386ae70e39faf3866ac01e4bb5354574f2583e74290b8c80eaf63d126040d52368be6c771476451
 DIST ruby-2.7.5.tar.xz 12072980 BLAKE2B 
50bb822cb2c5e76fee8755c710b593ce3bcb0f4f14b96a4e9eef5e58b4614bcf5f91491586b1dd6411fce57c258a7ad80136cd3cfbddf28e4fd4b37f486d2bea
 SHA512 
21c8a713e3ce115fc4c405113ac691ddcefc3419f528b93ca1ac59e7052c1b6e9e241da0e570e291e567f28f3d840824dbcc5967b216cbe7d6ca7a05580fa311
 DIST ruby-3.0.3.tar.xz 14991880 BLAKE2B 
d57b7f6e0d0121326b1a191e93a49c045d26dfd1ab8b0d283b99d09968e07277edde0baaeec072602d6d06e20dcd3893d6cb0b03f59dbc59ebf0e3ebd5646446
 SHA512 
bb9ea426278d5a7ac46595296f03b82d43df8b7db41045cdf85611e05e26c703c53f700494cd7cf5d4c27fa953bdc5c144317d7720812db0a6e3b6f4bc4d2e00
+DIST ruby-3.1.1.tar.xz 15103808 BLAKE2B 
c11ec8d60cd24c88716d6e685e4cc19931e40504ac04b9d8c79b890cdaf8f4661e95649475e40171e267797674839047276c7f7f1613f20ed3cd5b9ae910950a
 SHA512 
8877fa9a458964a59a11529cd10b3d25b5f6238cd4678b6dcea0bd4b750499cf8ff39d8824053b4ab26c5cd0cfb604a57807ce61580175857fcf00b2cff3e55f

diff --git a/dev-lang/ruby/files/3.1/001-socksocket-fix.patch 
b/dev-lang/ruby/files/3.1/001-socksocket-fix.patch
new file mode 100644
index ..1a79e25491cc
--- /dev/null
+++ b/dev-lang/ruby/files/3.1/001-socksocket-fix.patch
@@ -0,0 +1,15 @@
+Fix compilation with socks5 USE flag.
+
+Patch by Phobos Kappa in https://bugs.gentoo.org/762253
+
+--- a/ext/socket/sockssocket.c 2020-12-25 05:33:01.0 +0200
 b/ext/socket/sockssocket.c 2020-12-28 15:42:50.310029778 +0200
+@@ -34,7 +34,7 @@
+   init = 1;
+ }
+ 
+-return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, 
Qnil);
++return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, 
Qnil, Qnil);
+ }
+ 
+ #ifdef SOCKS5

diff --git a/dev-lang/ruby/files/3.1/010-default-gem-location.patch 
b/dev-lang/ruby/files/3.1/010-default-gem-location.patch
new file mode 100644
index ..039a44b0530b
--- /dev/null
+++ b/dev-lang/ruby/files/3.1/010-default-gem-location.patch
@@ -0,0 +1,20 @@
+--- a/tool/rbinstall.rb.~1~2020-12-25 04:33:01.0 +0100
 b/tool/rbinstall.rb2020-12-25 10:05:34.629096405 +0100
+@@ -897,7 +897,7 @@
+ end
+ 
+ def install_default_gem(dir, srcdir, bindir)
+-  gem_dir = Gem.default_dir
++  gem_dir = ENV['GEM_DESTDIR']
+   install_dir = with_destdir(gem_dir)
+   prepare "default gems from #{dir}", gem_dir
+   makedirs(Gem.ensure_default_gem_subdirectories(install_dir, $dir_mode).map 
{|d| File.join(gem_dir, d)})
+@@ -1018,7 +1018,7 @@
+   end
+   Gem.instance_variable_set(:@ruby, ruby_path) if Gem.ruby != ruby_path
+ 
+-  gem_dir = Gem.default_dir
++  gem_dir = ENV['GEM_DESTDIR']
+   install_dir = with_destdir(gem_dir)
+   prepare "bundled gems", gem_dir
+   RbInstall.no_write do

diff --git a/dev-lang/ruby/files/3.1/900-musl-coroutine.patch 
b/dev-lang/ruby/files/3.1/900-musl-coroutine.patch
new file mode 100644
index ..a323cdd6e770
--- /dev/null
+++ b/dev-lang/ruby/files/3.1/900-musl-coroutine.patch
@@ -0,0 +1,28 @@
+Adapted for Gentoo version 3.0.2
+
+From b570e7de87aaad8c903176d835e8124127f627b3 Mon Sep 17 00:00:00 2001
+From: Andrew Aladjev 
+Date: Sat, 26 Sep 2020 12:58:06 +0300
+Subject: [PATCH] fixed default coroutine selection for musl
+
+---
+ configure.ac | 5 -
+ coroutine/copy/Context.c | 2 ++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index ab5d532c103b..084f0936c006 100644
+--- a/configure.ac
 b/configure.ac
+@@ -2364,7 +2364,10 @@
+ rb_cv_coroutine=copy
+ ],
+ [
+-rb_cv_coroutine=ucontext
++AC_CHECK_FUNCS([getcontext swapcontext makecontext],
++[rb_cv_coroutine=ucontext],
++[rb_cv_coroutine=copy; break]
++)
+ ]
+