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/
Date: Thu, 25 Nov 2021 09:10:21
Message-Id: 1637831394.31fe3f545f587baece94ac3a6997ab3c632bc33e.graaff@gentoo
1 commit: 31fe3f545f587baece94ac3a6997ab3c632bc33e
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 25 09:09:03 2021 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 25 09:09:54 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31fe3f54
7
8 dev-lang/ruby: add 2.6.9, 2.7.5, 3.0.3
9
10 Package-Manager: Portage-3.0.28, Repoman-3.0.3
11 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
12
13 dev-lang/ruby/Manifest | 3 +
14 dev-lang/ruby/ruby-2.6.9.ebuild | 258 ++++++++++++++++++++++++++++++++++++++
15 dev-lang/ruby/ruby-2.7.5.ebuild | 267 ++++++++++++++++++++++++++++++++++++++++
16 dev-lang/ruby/ruby-3.0.3.ebuild | 267 ++++++++++++++++++++++++++++++++++++++++
17 4 files changed, 795 insertions(+)
18
19 diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest
20 index c2fd5cc82ae5..d0ba5efb8996 100644
21 --- a/dev-lang/ruby/Manifest
22 +++ b/dev-lang/ruby/Manifest
23 @@ -1,3 +1,6 @@
24 DIST ruby-2.6.8.tar.xz 11599488 BLAKE2B e5b2949233d8540f72d4d8b9c246f9bd0d1342426d2a1c19cb240b7c86f37299e9dc1dfc98ef2a86d1d91055865b4542d690de5567c71189bf2973a4989fa0fd SHA512 d040ad2238523587d8f356fcb796b8b6ad7f8caff7dd6df09e3f7efcbfa0369e33600e78c7f2bc713ae77c040757cce5c4fec223cb9070209f2bf741899c556d
25 +DIST ruby-2.6.9.tar.xz 11590064 BLAKE2B 8d14baf479053b7fab517f1e41191b009413d557431c558d92489a36d539f9a667571e4493abba171b047f8ba6d1f676fb6d2f2152fcae737924e773a324ddf6 SHA512 f60aa89e685cea324185eb0d13e6b44caef4e4f761cbf9ea1386ae70e39faf3866ac01e4bb5354574f2583e74290b8c80eaf63d126040d52368be6c771476451
26 DIST ruby-2.7.4.tar.xz 12067588 BLAKE2B 2680a7ccd1daf3d156d9519d9132853e68f5f1aad592abce3e73fdd03314a6c28e7d94590153aead86af8952ff51f804ee029f8100b0137919cc27373cb8b9cd SHA512 2cbb70ecfdd69120e789023ddb2b25cab0d03bc33fdc367a8f74ca8a3ee785c18c8ded9de3ecee627c7e275ffb85147e6abf921b6a61e31851b37c7fedf45bf9
27 +DIST ruby-2.7.5.tar.xz 12072980 BLAKE2B 50bb822cb2c5e76fee8755c710b593ce3bcb0f4f14b96a4e9eef5e58b4614bcf5f91491586b1dd6411fce57c258a7ad80136cd3cfbddf28e4fd4b37f486d2bea SHA512 21c8a713e3ce115fc4c405113ac691ddcefc3419f528b93ca1ac59e7052c1b6e9e241da0e570e291e567f28f3d840824dbcc5967b216cbe7d6ca7a05580fa311
28 DIST ruby-3.0.2.tar.xz 14746080 BLAKE2B 47c5591261fb63b1ec3ca719ea6b0c348937456c3711351c1f5317d1e6a748de197e90c8bd4ff822f7b2d4580ad7ed0b54b9eb7aaa5166ea1a15ab2deae96439 SHA512 0f702e2d8ca1342a9d4284dbdd234a3588e057b92566353aa7c21835cf09a3932864b2acf459a976960a1704e9befa562155d36b98b7cda8bd99526e10a374c4
29 +DIST ruby-3.0.3.tar.xz 14991880 BLAKE2B d57b7f6e0d0121326b1a191e93a49c045d26dfd1ab8b0d283b99d09968e07277edde0baaeec072602d6d06e20dcd3893d6cb0b03f59dbc59ebf0e3ebd5646446 SHA512 bb9ea426278d5a7ac46595296f03b82d43df8b7db41045cdf85611e05e26c703c53f700494cd7cf5d4c27fa953bdc5c144317d7720812db0a6e3b6f4bc4d2e00
30
31 diff --git a/dev-lang/ruby/ruby-2.6.9.ebuild b/dev-lang/ruby/ruby-2.6.9.ebuild
32 new file mode 100644
33 index 000000000000..331fce592559
34 --- /dev/null
35 +++ b/dev-lang/ruby/ruby-2.6.9.ebuild
36 @@ -0,0 +1,258 @@
37 +# Copyright 1999-2021 Gentoo Authors
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=7
41 +
42 +inherit autotools flag-o-matic multilib
43 +
44 +MY_P="${PN}-$(ver_cut 1-3)"
45 +S=${WORKDIR}/${MY_P}
46 +
47 +SLOT=$(ver_cut 1-2)
48 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
49 +RUBYVERSION=${SLOT}.0
50 +
51 +DESCRIPTION="An object-oriented scripting language"
52 +HOMEPAGE="https://www.ruby-lang.org/"
53 +SRC_URI="https://cache.ruby-lang.org/pub/ruby/${SLOT}/${MY_P}.tar.xz"
54 +
55 +LICENSE="|| ( Ruby-BSD BSD-2 )"
56 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
57 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit +rdoc rubytests socks5 +ssl static-libs systemtap tk xemacs"
58 +
59 +RDEPEND="
60 + berkdb? ( sys-libs/db:= )
61 + gdbm? ( sys-libs/gdbm:= )
62 + jemalloc? ( dev-libs/jemalloc:= )
63 + jit? ( || ( sys-devel/gcc:* sys-devel/clang:* ) )
64 + ssl? (
65 + dev-libs/openssl:0=
66 + )
67 + socks5? ( >=net-proxy/dante-1.1.13 )
68 + systemtap? ( dev-util/systemtap )
69 + tk? (
70 + dev-lang/tcl:0=[threads]
71 + dev-lang/tk:0=[threads]
72 + )
73 + dev-libs/libyaml
74 + dev-libs/libffi:=
75 + sys-libs/readline:0=
76 + sys-libs/zlib
77 + virtual/libcrypt:=
78 + >=app-eselect/eselect-ruby-20181225
79 +"
80 +
81 +DEPEND="${RDEPEND}"
82 +
83 +BUNDLED_GEMS="
84 + >=dev-ruby/did_you_mean-1.2.1[ruby_targets_ruby26]
85 + >=dev-ruby/minitest-5.11.3[ruby_targets_ruby26]
86 + >=dev-ruby/net-telnet-0.2.0[ruby_targets_ruby26]
87 + >=dev-ruby/power_assert-1.1.3[ruby_targets_ruby26]
88 + >=dev-ruby/rake-12.3.2[ruby_targets_ruby26]
89 + >=dev-ruby/test-unit-3.2.9[ruby_targets_ruby26]
90 + >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby26]
91 +"
92 +
93 +PDEPEND="
94 + ${BUNDLED_GEMS}
95 + virtual/rubygems[ruby_targets_ruby26]
96 + >=dev-ruby/bundler-1.17.2[ruby_targets_ruby26]
97 + >=dev-ruby/json-2.0.2[ruby_targets_ruby26]
98 + rdoc? ( >=dev-ruby/rdoc-6.1.2[ruby_targets_ruby26] )
99 + xemacs? ( app-xemacs/ruby-modes )"
100 +
101 +src_prepare() {
102 + # 005 does not compile bigdecimal and is questionable because it
103 + # compiles ruby in a non-standard way, may be dropped
104 + eapply "${FILESDIR}"/2.6/{002,010}*.patch
105 +
106 + einfo "Unbundling gems..."
107 + cd "$S"
108 + # Remove bundled gems that we will install via PDEPEND, bug
109 + # 539700.
110 + rm -fr gems/* || die
111 +
112 + einfo "Removing bundled libraries..."
113 + rm -fr ext/fiddle/libffi-3.2.1 || die
114 +
115 + if use prefix ; then
116 + # Fix hardcoded SHELL var in mkmf library
117 + sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
118 +
119 + if [[ ${CHOST} == *darwin* ]] ; then
120 + # avoid symlink loop on Darwin (?!)
121 + sed -i \
122 + -e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
123 + configure.ac || die
124 +
125 + # make ar/libtool hack for Darwin work
126 + sed -i \
127 + -e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
128 + configure.ac || die
129 + fi
130 + fi
131 +
132 + eapply_user
133 +
134 + eautoreconf
135 +}
136 +
137 +src_configure() {
138 + local modules= myconf=
139 +
140 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
141 + filter-flags -fomit-frame-pointer
142 + # In many places aliasing rules are broken; play it safe
143 + # as it's risky with newer compilers to leave it as it is.
144 + append-flags -fno-strict-aliasing
145 +
146 + # Socks support via dante
147 + if use socks5 ; then
148 + # Socks support can't be disabled as long as SOCKS_SERVER is
149 + # set and socks library is present, so need to unset
150 + # SOCKS_SERVER in that case.
151 + unset SOCKS_SERVER
152 + fi
153 +
154 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
155 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
156 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
157 + fi
158 +
159 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
160 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
161 +
162 + # Determine which modules *not* to build depending in the USE flags.
163 + if ! use berkdb ; then
164 + modules="${modules},dbm"
165 + fi
166 + if ! use gdbm ; then
167 + modules="${modules},gdbm"
168 + fi
169 + if ! use ssl ; then
170 + modules="${modules},openssl"
171 + fi
172 + if ! use tk ; then
173 + modules="${modules},tk"
174 + fi
175 +
176 + # Provide an empty LIBPATHENV because we disable rpath but we do not
177 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
178 + # #564272
179 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
180 + --program-suffix=${MY_SUFFIX} \
181 + --with-soname=ruby${MY_SUFFIX} \
182 + --with-readline-dir="${EPREFIX}"/usr \
183 + --enable-shared \
184 + --enable-pthread \
185 + --disable-rpath \
186 + --with-out-ext="${modules}" \
187 + $(use_with jemalloc jemalloc) \
188 + $(use_enable jit jit-support ) \
189 + $(use_enable socks5 socks) \
190 + $(use_enable systemtap dtrace) \
191 + $(use_enable doc install-doc) \
192 + --enable-ipv6 \
193 + $(use_enable static-libs static) \
194 + $(use_enable static-libs install-static-library) \
195 + $(use_with static-libs static-linked-ext) \
196 + $(use_enable debug) \
197 + ${myconf} \
198 + --enable-option-checking=no
199 +
200 + # Makefile is broken because it lacks -ldl
201 + rm -rf ext/-test-/popen_deadlock || die
202 +}
203 +
204 +src_compile() {
205 + emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS=""
206 +}
207 +
208 +src_test() {
209 + emake -j1 V=1 test
210 +
211 + elog "Ruby's make test has been run. Ruby also ships with a make check"
212 + elog "that cannot be run until after ruby has been installed."
213 + elog
214 + if use rubytests; then
215 + elog "You have enabled rubytests, so they will be installed to"
216 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
217 + elog "than root, and you must place them into a writeable directory."
218 + elog "Then call: "
219 + elog
220 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
221 + else
222 + elog "Enable the rubytests USE flag to install the make check tests"
223 + fi
224 +}
225 +
226 +src_install() {
227 + # Remove the remaining bundled gems. We do this late in the process
228 + # since they are used during the build to e.g. create the
229 + # documentation.
230 + einfo "Removing default gems before installation"
231 + rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || die
232 +
233 + # Ruby is involved in the install process, we don't want interference here.
234 + unset RUBYOPT
235 +
236 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
237 +
238 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
239 +
240 + if [[ ${CHOST} == *darwin* ]] ; then
241 + DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
242 + export DYLD_LIBRARY_PATH
243 + fi
244 +
245 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
246 + for d in $(find "${S}/ext" -type d) ; do
247 + RUBYLIB="${RUBYLIB}:$d"
248 + done
249 + export LD_LIBRARY_PATH RUBYLIB
250 +
251 + # Create directory for the default gems
252 + local gem_home="${EPREFIX}/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}"
253 + mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed"
254 +
255 + emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install
256 +
257 + # Remove installed rubygems and rdoc copy
258 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
259 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
260 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
261 + rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
262 +
263 + if use doc; then
264 + emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc
265 + fi
266 +
267 + if use examples; then
268 + dodoc -r sample
269 + fi
270 +
271 + dodoc ChangeLog NEWS doc/NEWS* README*
272 +
273 + if use rubytests; then
274 + pushd test
275 + insinto /usr/share/${PN}-${SLOT}/test
276 + doins -r .
277 + popd
278 + fi
279 +}
280 +
281 +pkg_postinst() {
282 + if [[ ! -n $(readlink "${EROOT}"/usr/bin/ruby) ]] ; then
283 + eselect ruby set ruby${MY_SUFFIX}
284 + fi
285 +
286 + elog
287 + elog "To switch between available Ruby profiles, execute as root:"
288 + elog "\teselect ruby set ruby(23|24|...)"
289 + elog
290 +}
291 +
292 +pkg_postrm() {
293 + eselect ruby cleanup
294 +}
295
296 diff --git a/dev-lang/ruby/ruby-2.7.5.ebuild b/dev-lang/ruby/ruby-2.7.5.ebuild
297 new file mode 100644
298 index 000000000000..1941ac0252cc
299 --- /dev/null
300 +++ b/dev-lang/ruby/ruby-2.7.5.ebuild
301 @@ -0,0 +1,267 @@
302 +# Copyright 1999-2021 Gentoo Authors
303 +# Distributed under the terms of the GNU General Public License v2
304 +
305 +EAPI=7
306 +
307 +inherit autotools flag-o-matic multilib
308 +
309 +MY_P="${PN}-$(ver_cut 1-3)"
310 +S=${WORKDIR}/${MY_P}
311 +
312 +SLOT=$(ver_cut 1-2)
313 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
314 +RUBYVERSION=${SLOT}.0
315 +
316 +DESCRIPTION="An object-oriented scripting language"
317 +HOMEPAGE="https://www.ruby-lang.org/"
318 +SRC_URI="https://cache.ruby-lang.org/pub/ruby/${SLOT}/${MY_P}.tar.xz"
319 +
320 +LICENSE="|| ( Ruby-BSD BSD-2 )"
321 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
322 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit +rdoc rubytests socks5 +ssl static-libs systemtap tk xemacs"
323 +
324 +RDEPEND="
325 + berkdb? ( sys-libs/db:= )
326 + gdbm? ( sys-libs/gdbm:= )
327 + jemalloc? ( dev-libs/jemalloc:= )
328 + jit? ( || ( sys-devel/gcc:* sys-devel/clang:* ) )
329 + ssl? (
330 + dev-libs/openssl:0=
331 + )
332 + socks5? ( >=net-proxy/dante-1.1.13 )
333 + systemtap? ( dev-util/systemtap )
334 + tk? (
335 + dev-lang/tcl:0=[threads]
336 + dev-lang/tk:0=[threads]
337 + )
338 + dev-libs/libyaml
339 + dev-libs/libffi:=
340 + sys-libs/readline:0=
341 + sys-libs/zlib
342 + virtual/libcrypt:=
343 + >=app-eselect/eselect-ruby-20191222
344 +"
345 +
346 +DEPEND="${RDEPEND}"
347 +
348 +BUNDLED_GEMS="
349 + >=dev-ruby/minitest-5.13.0[ruby_targets_ruby27]
350 + >=dev-ruby/net-telnet-0.2.0[ruby_targets_ruby27]
351 + >=dev-ruby/power_assert-1.1.7[ruby_targets_ruby27]
352 + >=dev-ruby/rake-13.0.1[ruby_targets_ruby27]
353 + >=dev-ruby/test-unit-3.3.4[ruby_targets_ruby27]
354 + >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby27]
355 +"
356 +
357 +PDEPEND="
358 + ${BUNDLED_GEMS}
359 + virtual/rubygems[ruby_targets_ruby27]
360 + >=dev-ruby/bundler-2.1.4[ruby_targets_ruby27]
361 + >=dev-ruby/did_you_mean-1.3.1[ruby_targets_ruby27]
362 + >=dev-ruby/json-2.0.2[ruby_targets_ruby27]
363 + rdoc? ( >=dev-ruby/rdoc-6.1.2[ruby_targets_ruby27] )
364 + xemacs? ( app-xemacs/ruby-modes )"
365 +
366 +src_prepare() {
367 + eapply "${FILESDIR}"/2.7/{003,010}*.patch
368 +
369 + if use elibc_musl ; then
370 + eapply "${FILESDIR}"/2.7/{900,901}-musl-*.patch
371 + fi
372 +
373 + # Reset time on patched gem_prelude.rb to avoid the need for a base
374 + # ruby during bootstrapping, bug 787137
375 + touch -t 202001010000 gem_prelude.rb || die
376 +
377 + einfo "Unbundling gems..."
378 + cd "$S"
379 + # Remove bundled gems that we will install via PDEPEND, bug
380 + # 539700.
381 + rm -fr gems/* || die
382 + # Don't install CLI tools since they will clash with the gem
383 + rm -f bin/{racc,racc2y,y2racc} || die
384 + sed -i -e '/executables/ s:^:#:' lib/racc/racc.gemspec || die
385 +
386 + einfo "Removing bundled libraries..."
387 + rm -fr ext/fiddle/libffi-3.2.1 || die
388 +
389 + if use prefix ; then
390 + # Fix hardcoded SHELL var in mkmf library
391 + sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
392 +
393 + if [[ ${CHOST} == *darwin* ]] ; then
394 + # avoid symlink loop on Darwin (?!)
395 + sed -i \
396 + -e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
397 + configure.ac || die
398 +
399 + # make ar/libtool hack for Darwin work
400 + sed -i \
401 + -e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
402 + configure.ac || die
403 + fi
404 + fi
405 +
406 + eapply_user
407 +
408 + eautoreconf
409 +}
410 +
411 +src_configure() {
412 + local modules= myconf=
413 +
414 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
415 + filter-flags -fomit-frame-pointer
416 + # In many places aliasing rules are broken; play it safe
417 + # as it's risky with newer compilers to leave it as it is.
418 + append-flags -fno-strict-aliasing
419 +
420 + # Socks support via dante
421 + if use socks5 ; then
422 + # Socks support can't be disabled as long as SOCKS_SERVER is
423 + # set and socks library is present, so need to unset
424 + # SOCKS_SERVER in that case.
425 + unset SOCKS_SERVER
426 + fi
427 +
428 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
429 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
430 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
431 + fi
432 +
433 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
434 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
435 +
436 + # Determine which modules *not* to build depending in the USE flags.
437 + if ! use berkdb ; then
438 + modules="${modules},dbm"
439 + fi
440 + if ! use gdbm ; then
441 + modules="${modules},gdbm"
442 + fi
443 + if ! use ssl ; then
444 + modules="${modules},openssl"
445 + fi
446 + if ! use tk ; then
447 + modules="${modules},tk"
448 + fi
449 +
450 + # Provide an empty LIBPATHENV because we disable rpath but we do not
451 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
452 + # #564272
453 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
454 + --program-suffix=${MY_SUFFIX} \
455 + --with-soname=ruby${MY_SUFFIX} \
456 + --with-readline-dir="${EPREFIX}"/usr \
457 + --enable-shared \
458 + --enable-pthread \
459 + --disable-rpath \
460 + --with-out-ext="${modules}" \
461 + $(use_with jemalloc jemalloc) \
462 + $(use_enable jit jit-support ) \
463 + $(use_enable socks5 socks) \
464 + $(use_enable systemtap dtrace) \
465 + $(use_enable doc install-doc) \
466 + --enable-ipv6 \
467 + $(use_enable static-libs static) \
468 + $(use_enable static-libs install-static-library) \
469 + $(use_with static-libs static-linked-ext) \
470 + $(use_enable debug) \
471 + ${myconf} \
472 + --enable-option-checking=no
473 +
474 + # Makefile is broken because it lacks -ldl
475 + rm -rf ext/-test-/popen_deadlock || die
476 +}
477 +
478 +src_compile() {
479 + emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS=""
480 +}
481 +
482 +src_test() {
483 + emake -j1 V=1 test
484 +
485 + elog "Ruby's make test has been run. Ruby also ships with a make check"
486 + elog "that cannot be run until after ruby has been installed."
487 + elog
488 + if use rubytests; then
489 + elog "You have enabled rubytests, so they will be installed to"
490 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
491 + elog "than root, and you must place them into a writeable directory."
492 + elog "Then call: "
493 + elog
494 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
495 + else
496 + elog "Enable the rubytests USE flag to install the make check tests"
497 + fi
498 +}
499 +
500 +src_install() {
501 + # Remove the remaining bundled gems. We do this late in the process
502 + # since they are used during the build to e.g. create the
503 + # documentation.
504 + einfo "Removing default gems before installation"
505 + rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || 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 +
514 + if [[ ${CHOST} == *darwin* ]] ; then
515 + DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
516 + export DYLD_LIBRARY_PATH
517 + fi
518 +
519 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
520 + for d in $(find "${S}/ext" -type d) ; do
521 + RUBYLIB="${RUBYLIB}:$d"
522 + done
523 + export LD_LIBRARY_PATH RUBYLIB
524 +
525 + # Create directory for the default gems
526 + local gem_home="${EPREFIX}/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}"
527 + mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed"
528 +
529 + emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install
530 +
531 + # Remove installed rubygems and rdoc copy
532 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
533 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
534 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
535 + rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
536 +
537 + if use doc; then
538 + emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc
539 + fi
540 +
541 + if use examples; then
542 + dodoc -r sample
543 + fi
544 +
545 + dodoc ChangeLog NEWS doc/NEWS* README*
546 +
547 + if use rubytests; then
548 + pushd test
549 + insinto /usr/share/${PN}-${SLOT}/test
550 + doins -r .
551 + popd
552 + fi
553 +}
554 +
555 +pkg_postinst() {
556 + if [[ ! -n $(readlink "${EROOT}"/usr/bin/ruby) ]] ; then
557 + eselect ruby set ruby${MY_SUFFIX}
558 + fi
559 +
560 + elog
561 + elog "To switch between available Ruby profiles, execute as root:"
562 + elog "\teselect ruby set ruby(23|24|...)"
563 + elog
564 +}
565 +
566 +pkg_postrm() {
567 + eselect ruby cleanup
568 +}
569
570 diff --git a/dev-lang/ruby/ruby-3.0.3.ebuild b/dev-lang/ruby/ruby-3.0.3.ebuild
571 new file mode 100644
572 index 000000000000..16eea1190ab4
573 --- /dev/null
574 +++ b/dev-lang/ruby/ruby-3.0.3.ebuild
575 @@ -0,0 +1,267 @@
576 +# Copyright 1999-2021 Gentoo Authors
577 +# Distributed under the terms of the GNU General Public License v2
578 +
579 +EAPI=7
580 +
581 +inherit autotools flag-o-matic multilib
582 +
583 +MY_P="${PN}-$(ver_cut 1-3)"
584 +S=${WORKDIR}/${MY_P}
585 +
586 +SLOT=$(ver_cut 1-2)
587 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
588 +RUBYVERSION=${SLOT}.0
589 +
590 +DESCRIPTION="An object-oriented scripting language"
591 +HOMEPAGE="https://www.ruby-lang.org/"
592 +SRC_URI="https://cache.ruby-lang.org/pub/ruby/${SLOT}/${MY_P}.tar.xz"
593 +
594 +LICENSE="|| ( Ruby-BSD BSD-2 )"
595 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
596 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit +rdoc rubytests socks5 +ssl static-libs systemtap tk xemacs"
597 +
598 +RDEPEND="
599 + berkdb? ( sys-libs/db:= )
600 + gdbm? ( sys-libs/gdbm:= )
601 + jemalloc? ( dev-libs/jemalloc:= )
602 + jit? ( || ( sys-devel/gcc:* sys-devel/clang:* ) )
603 + ssl? (
604 + dev-libs/openssl:0=
605 + )
606 + socks5? ( >=net-proxy/dante-1.1.13 )
607 + systemtap? ( dev-util/systemtap )
608 + tk? (
609 + dev-lang/tcl:0=[threads]
610 + dev-lang/tk:0=[threads]
611 + )
612 + dev-libs/libyaml
613 + dev-libs/libffi:=
614 + sys-libs/readline:0=
615 + sys-libs/zlib
616 + virtual/libcrypt:=
617 + >=app-eselect/eselect-ruby-20201225
618 +"
619 +
620 +DEPEND="${RDEPEND}"
621 +
622 +BUNDLED_GEMS="
623 + >=dev-ruby/minitest-5.14.2[ruby_targets_ruby30]
624 + >=dev-ruby/power_assert-1.2.0[ruby_targets_ruby30]
625 + >=dev-ruby/rake-13.0.3[ruby_targets_ruby30]
626 + >=dev-ruby/rbs-1.0.0[ruby_targets_ruby30]
627 + >=dev-ruby/rexml-3.2.4[ruby_targets_ruby30]
628 + >=dev-ruby/rss-0.2.9[ruby_targets_ruby30]
629 + >=dev-ruby/test-unit-3.3.7[ruby_targets_ruby30]
630 + >=dev-ruby/typeprof-0.11.0[ruby_targets_ruby30]
631 +"
632 +
633 +PDEPEND="
634 + ${BUNDLED_GEMS}
635 + virtual/rubygems[ruby_targets_ruby30]
636 + >=dev-ruby/bundler-2.2.15[ruby_targets_ruby30]
637 + >=dev-ruby/did_you_mean-1.5.0[ruby_targets_ruby30]
638 + >=dev-ruby/json-2.5.1[ruby_targets_ruby30]
639 + rdoc? ( >=dev-ruby/rdoc-6.3.0[ruby_targets_ruby30] )
640 + xemacs? ( app-xemacs/ruby-modes )"
641 +
642 +src_prepare() {
643 + eapply "${FILESDIR}"/"${SLOT}"/010*.patch
644 +
645 + if use elibc_musl ; then
646 + eapply "${FILESDIR}"/3.0/900-musl-*.patch
647 + eapply "${FILESDIR}"/2.7/901-musl-*.patch
648 + fi
649 +
650 + einfo "Unbundling gems..."
651 + cd "$S"
652 + # Remove bundled gems that we will install via PDEPEND, bug
653 + # 539700.
654 + rm -fr gems/* || die
655 + touch gems/bundled_gems || die
656 + # Don't install CLI tools since they will clash with the gem
657 + rm -f bin/{racc,racc2y,y2racc} || die
658 + sed -i -e '/executables/ s:^:#:' lib/racc/racc.gemspec || die
659 +
660 + einfo "Removing bundled libraries..."
661 + rm -fr ext/fiddle/libffi-3.2.1 || die
662 +
663 + if use prefix ; then
664 + # Fix hardcoded SHELL var in mkmf library
665 + sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
666 +
667 + if [[ ${CHOST} == *darwin* ]] ; then
668 + # avoid symlink loop on Darwin (?!)
669 + sed -i \
670 + -e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
671 + configure.ac || die
672 +
673 + # make ar/libtool hack for Darwin work
674 + sed -i \
675 + -e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
676 + configure.ac || die
677 + fi
678 + fi
679 +
680 + eapply_user
681 +
682 + eautoreconf
683 +}
684 +
685 +src_configure() {
686 + local modules= myconf=
687 +
688 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
689 + filter-flags -fomit-frame-pointer
690 + # In many places aliasing rules are broken; play it safe
691 + # as it's risky with newer compilers to leave it as it is.
692 + append-flags -fno-strict-aliasing
693 +
694 + # Socks support via dante
695 + if use socks5 ; then
696 + # Socks support can't be disabled as long as SOCKS_SERVER is
697 + # set and socks library is present, so need to unset
698 + # SOCKS_SERVER in that case.
699 + unset SOCKS_SERVER
700 + fi
701 +
702 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
703 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
704 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
705 + fi
706 +
707 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
708 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
709 +
710 + # Determine which modules *not* to build depending in the USE flags.
711 + if ! use berkdb ; then
712 + modules="${modules},dbm"
713 + fi
714 + if ! use gdbm ; then
715 + modules="${modules},gdbm"
716 + fi
717 + if ! use ssl ; then
718 + modules="${modules},openssl"
719 + fi
720 + if ! use tk ; then
721 + modules="${modules},tk"
722 + fi
723 +
724 + # Provide an empty LIBPATHENV because we disable rpath but we do not
725 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
726 + # #564272
727 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
728 + --program-suffix=${MY_SUFFIX} \
729 + --with-soname=ruby${MY_SUFFIX} \
730 + --with-readline-dir="${EPREFIX}"/usr \
731 + --enable-shared \
732 + --enable-pthread \
733 + --disable-rpath \
734 + --with-out-ext="${modules}" \
735 + $(use_with jemalloc jemalloc) \
736 + $(use_enable jit jit-support ) \
737 + $(use_enable socks5 socks) \
738 + $(use_enable systemtap dtrace) \
739 + $(use_enable doc install-doc) \
740 + --enable-ipv6 \
741 + $(use_enable static-libs static) \
742 + $(use_enable static-libs install-static-library) \
743 + $(use_with static-libs static-linked-ext) \
744 + $(use_enable debug) \
745 + ${myconf} \
746 + --enable-option-checking=no
747 +
748 + # Makefile is broken because it lacks -ldl
749 + rm -rf ext/-test-/popen_deadlock || die
750 +}
751 +
752 +src_compile() {
753 + emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS=""
754 +}
755 +
756 +src_test() {
757 + emake -j1 V=1 test
758 +
759 + elog "Ruby's make test has been run. Ruby also ships with a make check"
760 + elog "that cannot be run until after ruby has been installed."
761 + elog
762 + if use rubytests; then
763 + elog "You have enabled rubytests, so they will be installed to"
764 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
765 + elog "than root, and you must place them into a writeable directory."
766 + elog "Then call: "
767 + elog
768 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
769 + else
770 + elog "Enable the rubytests USE flag to install the make check tests"
771 + fi
772 +}
773 +
774 +src_install() {
775 + # Remove the remaining bundled gems. We do this late in the process
776 + # since they are used during the build to e.g. create the
777 + # documentation.
778 + einfo "Removing default gems before installation"
779 + rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || die
780 +
781 + # Ruby is involved in the install process, we don't want interference here.
782 + unset RUBYOPT
783 +
784 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
785 +
786 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
787 +
788 + if [[ ${CHOST} == *darwin* ]] ; then
789 + DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
790 + export DYLD_LIBRARY_PATH
791 + fi
792 +
793 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
794 + for d in $(find "${S}/ext" -type d) ; do
795 + RUBYLIB="${RUBYLIB}:$d"
796 + done
797 + export LD_LIBRARY_PATH RUBYLIB
798 +
799 + # Create directory for the default gems
800 + local gem_home="${EPREFIX}/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}"
801 + mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed"
802 +
803 + emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install
804 +
805 + # Remove installed rubygems and rdoc copy
806 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
807 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
808 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
809 + rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
810 +
811 + if use doc; then
812 + emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc
813 + fi
814 +
815 + if use examples; then
816 + dodoc -r sample
817 + fi
818 +
819 + dodoc ChangeLog NEWS.md doc/NEWS* README*
820 +
821 + if use rubytests; then
822 + pushd test
823 + insinto /usr/share/${PN}-${SLOT}/test
824 + doins -r .
825 + popd
826 + fi
827 +}
828 +
829 +pkg_postinst() {
830 + if [[ ! -n $(readlink "${EROOT}"/usr/bin/ruby) ]] ; then
831 + eselect ruby set ruby${MY_SUFFIX}
832 + fi
833 +
834 + elog
835 + elog "To switch between available Ruby profiles, execute as root:"
836 + elog "\teselect ruby set ruby(23|24|...)"
837 + elog
838 +}
839 +
840 +pkg_postrm() {
841 + eselect ruby cleanup
842 +}