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