diff options
author | Fabian Groffen <grobian@gentoo.org> | 2021-10-16 17:57:00 +0200 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2021-10-16 17:57:14 +0200 |
commit | e56274ae84c1aa457d87d86605ab3ec05cfc7638 (patch) | |
tree | 3928a4568a8620194b2eea5d745f9b0ab75a1a9f /dev-lang/ruby | |
parent | app-antivirus/clamav: fixed mode on .initd files (diff) | |
download | gentoo-e56274ae84c1aa457d87d86605ab3ec05cfc7638.tar.gz gentoo-e56274ae84c1aa457d87d86605ab3ec05cfc7638.tar.bz2 gentoo-e56274ae84c1aa457d87d86605ab3ec05cfc7638.zip |
dev-lang/ruby: add patches for musl
Fix two problems:
1. fix compilation problem in coroutine
2. address stack size such that one can e.g. run puppet
Closes: https://bugs.gentoo.org/721068
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'dev-lang/ruby')
-rw-r--r-- | dev-lang/ruby/files/2.7/900-musl-coroutine.patch | 41 | ||||
-rw-r--r-- | dev-lang/ruby/files/2.7/901-musl-stacksize.patch | 26 | ||||
-rw-r--r-- | dev-lang/ruby/files/3.0/900-musl-coroutine.patch | 28 | ||||
-rw-r--r-- | dev-lang/ruby/ruby-2.7.4.ebuild | 4 | ||||
-rw-r--r-- | dev-lang/ruby/ruby-3.0.2.ebuild | 5 |
5 files changed, 104 insertions, 0 deletions
diff --git a/dev-lang/ruby/files/2.7/900-musl-coroutine.patch b/dev-lang/ruby/files/2.7/900-musl-coroutine.patch new file mode 100644 index 000000000000..ed47c54e29c7 --- /dev/null +++ b/dev-lang/ruby/files/2.7/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 <aladjev.andrew@gmail.com> +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 <sys/types.h> ++ + #include "Context.h" + + // http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html diff --git a/dev-lang/ruby/files/2.7/901-musl-stacksize.patch b/dev-lang/ruby/files/2.7/901-musl-stacksize.patch new file mode 100644 index 000000000000..e5fcfce2195e --- /dev/null +++ b/dev-lang/ruby/files/2.7/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(&base, &size) == 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, &rlim) == 0 && rlim.rlim_cur > size) { + diff --git a/dev-lang/ruby/files/3.0/900-musl-coroutine.patch b/dev-lang/ruby/files/3.0/900-musl-coroutine.patch new file mode 100644 index 000000000000..a323cdd6e770 --- /dev/null +++ b/dev-lang/ruby/files/3.0/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 <aladjev.andrew@gmail.com> +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/dev-lang/ruby/ruby-2.7.4.ebuild b/dev-lang/ruby/ruby-2.7.4.ebuild index 41cea1ac56ab..91fa086e55cc 100644 --- a/dev-lang/ruby/ruby-2.7.4.ebuild +++ b/dev-lang/ruby/ruby-2.7.4.ebuild @@ -65,6 +65,10 @@ PDEPEND=" src_prepare() { eapply "${FILESDIR}"/2.7/{003,010}*.patch + if use elibc_musl ; then + eapply "${FILESDIR}"/2.7/{900,901}-musl-*.patch + fi + # Reset time on patched gem_prelude.rb to avoid the need for a base # ruby during bootstrapping, bug 787137 touch -t 202001010000 gem_prelude.rb || die diff --git a/dev-lang/ruby/ruby-3.0.2.ebuild b/dev-lang/ruby/ruby-3.0.2.ebuild index baa8d04f1336..ae8a7216c6d8 100644 --- a/dev-lang/ruby/ruby-3.0.2.ebuild +++ b/dev-lang/ruby/ruby-3.0.2.ebuild @@ -67,6 +67,11 @@ PDEPEND=" src_prepare() { eapply "${FILESDIR}"/"${SLOT}"/010*.patch + if use elibc_musl ; then + eapply "${FILESDIR}"/3.0/900-musl-*.patch + eapply "${FILESDIR}"/2.7/901-musl-*.patch + fi + einfo "Unbundling gems..." cd "$S" # Remove bundled gems that we will install via PDEPEND, bug |