1 |
commit: e56274ae84c1aa457d87d86605ab3ec05cfc7638 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 16 15:57:00 2021 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 16 15:57:14 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e56274ae |
7 |
|
8 |
dev-lang/ruby: add patches for musl |
9 |
|
10 |
Fix two problems: |
11 |
1. fix compilation problem in coroutine |
12 |
2. address stack size such that one can e.g. run puppet |
13 |
|
14 |
Closes: https://bugs.gentoo.org/721068 |
15 |
Package-Manager: Portage-3.0.20, Repoman-3.0.3 |
16 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
17 |
|
18 |
dev-lang/ruby/files/2.7/900-musl-coroutine.patch | 41 ++++++++++++++++++++++++ |
19 |
dev-lang/ruby/files/2.7/901-musl-stacksize.patch | 26 +++++++++++++++ |
20 |
dev-lang/ruby/files/3.0/900-musl-coroutine.patch | 28 ++++++++++++++++ |
21 |
dev-lang/ruby/ruby-2.7.4.ebuild | 4 +++ |
22 |
dev-lang/ruby/ruby-3.0.2.ebuild | 5 +++ |
23 |
5 files changed, 104 insertions(+) |
24 |
|
25 |
diff --git a/dev-lang/ruby/files/2.7/900-musl-coroutine.patch b/dev-lang/ruby/files/2.7/900-musl-coroutine.patch |
26 |
new file mode 100644 |
27 |
index 00000000000..ed47c54e29c |
28 |
--- /dev/null |
29 |
+++ b/dev-lang/ruby/files/2.7/900-musl-coroutine.patch |
30 |
@@ -0,0 +1,41 @@ |
31 |
+Adapted for Gentoo version 2.7.4 |
32 |
+ |
33 |
+From b570e7de87aaad8c903176d835e8124127f627b3 Mon Sep 17 00:00:00 2001 |
34 |
+From: Andrew Aladjev <aladjev.andrew@×××××.com> |
35 |
+Date: Sat, 26 Sep 2020 12:58:06 +0300 |
36 |
+Subject: [PATCH] fixed default coroutine selection for musl |
37 |
+ |
38 |
+--- |
39 |
+ configure.ac | 5 ++++- |
40 |
+ coroutine/copy/Context.c | 2 ++ |
41 |
+ 2 files changed, 6 insertions(+), 1 deletion(-) |
42 |
+ |
43 |
+diff --git a/configure.ac b/configure.ac |
44 |
+index ab5d532c103b..084f0936c006 100644 |
45 |
+--- a/configure.ac |
46 |
++++ b/configure.ac |
47 |
+@@ -2364,7 +2364,10 @@ |
48 |
+ rb_cv_coroutine=copy |
49 |
+ ], |
50 |
+ [*], [ |
51 |
+- rb_cv_coroutine=ucontext |
52 |
++ AC_CHECK_FUNCS([getcontext swapcontext makecontext], |
53 |
++ [rb_cv_coroutine=ucontext], |
54 |
++ [rb_cv_coroutine=copy; break] |
55 |
++ ) |
56 |
+ ] |
57 |
+ ) |
58 |
+ AC_MSG_RESULT(${rb_cv_coroutine}) |
59 |
+diff --git a/coroutine/copy/Context.c b/coroutine/copy/Context.c |
60 |
+index c1b4144e9857..94a7f57f7d89 100644 |
61 |
+--- a/coroutine/copy/Context.c |
62 |
++++ b/coroutine/copy/Context.c |
63 |
+@@ -5,6 +5,8 @@ |
64 |
+ * Copyright, 2019, by Samuel Williams. |
65 |
+ */ |
66 |
+ |
67 |
++#include <sys/types.h> |
68 |
++ |
69 |
+ #include "Context.h" |
70 |
+ |
71 |
+ // http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html |
72 |
|
73 |
diff --git a/dev-lang/ruby/files/2.7/901-musl-stacksize.patch b/dev-lang/ruby/files/2.7/901-musl-stacksize.patch |
74 |
new file mode 100644 |
75 |
index 00000000000..e5fcfce2195 |
76 |
--- /dev/null |
77 |
+++ b/dev-lang/ruby/files/2.7/901-musl-stacksize.patch |
78 |
@@ -0,0 +1,26 @@ |
79 |
+musl has a conservative stacksize, as compared to glibc, so treat it |
80 |
+like other systems with such stacksize |
81 |
+ |
82 |
+diff --git a/thread_pthread.c b/thread_pthread.c |
83 |
+index 951885ffa0..e2d662143b 100644 |
84 |
+--- a/thread_pthread.c |
85 |
++++ b/thread_pthread.c |
86 |
+@@ -721,7 +721,7 @@ ruby_init_stack(volatile VALUE *addr |
87 |
+ { |
88 |
+ native_main_thread.id = pthread_self(); |
89 |
+ |
90 |
+-#if MAINSTACKADDR_AVAILABLE |
91 |
++#if MAINSTACKADDR_AVAILABLE && !(defined(__linux__) && !defined(__GLIBC__)) |
92 |
+ if (native_main_thread.stack_maxsize) return; |
93 |
+ { |
94 |
+ void* stackaddr; |
95 |
+@@ -1680,7 +1680,7 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr) |
96 |
+ |
97 |
+ #ifdef STACKADDR_AVAILABLE |
98 |
+ if (get_stack(&base, &size) == 0) { |
99 |
+-# ifdef __APPLE__ |
100 |
++# if defined(__APPLE__) || (defined(__linux__) && !defined(__GLIBC__)) |
101 |
+ if (pthread_equal(th->thread_id, native_main_thread.id)) { |
102 |
+ struct rlimit rlim; |
103 |
+ if (getrlimit(RLIMIT_STACK, &rlim) == 0 && rlim.rlim_cur > size) { |
104 |
+ |
105 |
|
106 |
diff --git a/dev-lang/ruby/files/3.0/900-musl-coroutine.patch b/dev-lang/ruby/files/3.0/900-musl-coroutine.patch |
107 |
new file mode 100644 |
108 |
index 00000000000..a323cdd6e77 |
109 |
--- /dev/null |
110 |
+++ b/dev-lang/ruby/files/3.0/900-musl-coroutine.patch |
111 |
@@ -0,0 +1,28 @@ |
112 |
+Adapted for Gentoo version 3.0.2 |
113 |
+ |
114 |
+From b570e7de87aaad8c903176d835e8124127f627b3 Mon Sep 17 00:00:00 2001 |
115 |
+From: Andrew Aladjev <aladjev.andrew@×××××.com> |
116 |
+Date: Sat, 26 Sep 2020 12:58:06 +0300 |
117 |
+Subject: [PATCH] fixed default coroutine selection for musl |
118 |
+ |
119 |
+--- |
120 |
+ configure.ac | 5 ++++- |
121 |
+ coroutine/copy/Context.c | 2 ++ |
122 |
+ 2 files changed, 6 insertions(+), 1 deletion(-) |
123 |
+ |
124 |
+diff --git a/configure.ac b/configure.ac |
125 |
+index ab5d532c103b..084f0936c006 100644 |
126 |
+--- a/configure.ac |
127 |
++++ b/configure.ac |
128 |
+@@ -2364,7 +2364,10 @@ |
129 |
+ rb_cv_coroutine=copy |
130 |
+ ], |
131 |
+ [ |
132 |
+- rb_cv_coroutine=ucontext |
133 |
++ AC_CHECK_FUNCS([getcontext swapcontext makecontext], |
134 |
++ [rb_cv_coroutine=ucontext], |
135 |
++ [rb_cv_coroutine=copy; break] |
136 |
++ ) |
137 |
+ ] |
138 |
+ ) |
139 |
+ AC_MSG_RESULT(${rb_cv_coroutine}) |
140 |
|
141 |
diff --git a/dev-lang/ruby/ruby-2.7.4.ebuild b/dev-lang/ruby/ruby-2.7.4.ebuild |
142 |
index 41cea1ac56a..91fa086e55c 100644 |
143 |
--- a/dev-lang/ruby/ruby-2.7.4.ebuild |
144 |
+++ b/dev-lang/ruby/ruby-2.7.4.ebuild |
145 |
@@ -65,6 +65,10 @@ PDEPEND=" |
146 |
src_prepare() { |
147 |
eapply "${FILESDIR}"/2.7/{003,010}*.patch |
148 |
|
149 |
+ if use elibc_musl ; then |
150 |
+ eapply "${FILESDIR}"/2.7/{900,901}-musl-*.patch |
151 |
+ fi |
152 |
+ |
153 |
# Reset time on patched gem_prelude.rb to avoid the need for a base |
154 |
# ruby during bootstrapping, bug 787137 |
155 |
touch -t 202001010000 gem_prelude.rb || die |
156 |
|
157 |
diff --git a/dev-lang/ruby/ruby-3.0.2.ebuild b/dev-lang/ruby/ruby-3.0.2.ebuild |
158 |
index baa8d04f133..ae8a7216c6d 100644 |
159 |
--- a/dev-lang/ruby/ruby-3.0.2.ebuild |
160 |
+++ b/dev-lang/ruby/ruby-3.0.2.ebuild |
161 |
@@ -67,6 +67,11 @@ PDEPEND=" |
162 |
src_prepare() { |
163 |
eapply "${FILESDIR}"/"${SLOT}"/010*.patch |
164 |
|
165 |
+ if use elibc_musl ; then |
166 |
+ eapply "${FILESDIR}"/3.0/900-musl-*.patch |
167 |
+ eapply "${FILESDIR}"/2.7/901-musl-*.patch |
168 |
+ fi |
169 |
+ |
170 |
einfo "Unbundling gems..." |
171 |
cd "$S" |
172 |
# Remove bundled gems that we will install via PDEPEND, bug |