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/, dev-lang/ruby/files/3.0/
Date: Mon, 28 Dec 2020 07:46:57
Message-Id: 1609141603.0d1dad9e3d8b05fee719937f55b49c49d972ad19.graaff@gentoo
1 commit: 0d1dad9e3d8b05fee719937f55b49c49d972ad19
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Mon Dec 28 07:37:23 2020 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 28 07:46:43 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d1dad9e
7
8 dev-lang/ruby: add ruby 3.0.0
9
10 Package-Manager: Portage-3.0.9, Repoman-3.0.2
11 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
12
13 dev-lang/ruby/Manifest | 1 +
14 .../ruby/files/3.0/010-default-gem-location.patch | 20 ++
15 dev-lang/ruby/ruby-3.0.0.ebuild | 262 +++++++++++++++++++++
16 3 files changed, 283 insertions(+)
17
18 diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest
19 index 5f4cd990dfe..a474614b377 100644
20 --- a/dev-lang/ruby/Manifest
21 +++ b/dev-lang/ruby/Manifest
22 @@ -1,3 +1,4 @@
23 DIST ruby-2.5.8.tar.xz 11298404 BLAKE2B 3256c0448e72b63c0bd89f89a27fa9c09c8feed54d42cd79899b7d5cfe9dbc29ca708d12c630b3f52ff85b0c6a4011ae7ff0483d64b2fd445700a72a91028035 SHA512 2886be764a454425c5beef2777c64a70ee0d048b07896b327633d904f5077fea4299526689f9e2ac4dcd2fc4811cf9a6c8ce75367ed35d29dfe1a54222872e0d
24 DIST ruby-2.6.6.tar.xz 11567284 BLAKE2B 45e910dd9b128c46bff3003834c4fdcbbc2e2e4d3e44f298ff4356a285de2c375d6b6021a3aa28d89336b32a1655fa4a7c086d07f4a0f6bcd578a11dd4a894da SHA512 86caf93dbf61d03781767ab5375a7edf4761f13ba08ccfefe16c0a7550499237e7390c2f72a95d42670d4fe76b2401b4218936187c62ec1572799e9e04c50d62
25 DIST ruby-2.7.2.tar.xz 12037052 BLAKE2B a4ad22295b3fed4e8064fc6e77adb8642d1fa7ae1f4ef912d7bde19c735cb25b1a3e3aefba53dad944046d844d608bcefba61c314cf1e52747f50d7d91f4c436 SHA512 7972278b096aa768c7adf2befd26003e18781a29ca317640317d30d93d6e963ded197724c8e2f1dfe1e838c5647176d414a74732a62e931fb50d6f2e0f777349
26 +DIST ruby-3.0.0.tar.xz 14374176 BLAKE2B 9e7520e0b1ae6644285449c4ae92983d306772b3dd5366a17da709a55797c798d099424a5628c78c842b825fb336c6a769ac9c371ef276f42bf3550fd0761ebe SHA512 2a23c2894e62e24bb20cec6b2a016b66d7df05083668726b6f70af8338211cfec417aa3624290d1f5ccd130f65ee7b52b5db7d428abc4a9460459c9a5dd1a450
27
28 diff --git a/dev-lang/ruby/files/3.0/010-default-gem-location.patch b/dev-lang/ruby/files/3.0/010-default-gem-location.patch
29 new file mode 100644
30 index 00000000000..060579b4f33
31 --- /dev/null
32 +++ b/dev-lang/ruby/files/3.0/010-default-gem-location.patch
33 @@ -0,0 +1,20 @@
34 +--- a/tool/rbinstall.rb.~1~ 2020-12-25 04:33:01.000000000 +0100
35 ++++ b/tool/rbinstall.rb 2020-12-25 10:05:34.629096405 +0100
36 +@@ -897,7 +897,7 @@
37 + end
38 +
39 + def install_default_gem(dir, srcdir)
40 +- gem_dir = Gem.default_dir
41 ++ gem_dir = ENV['GEM_DESTDIR']
42 + install_dir = with_destdir(gem_dir)
43 + prepare "default gems from #{dir}", gem_dir
44 + makedirs(Gem.ensure_default_gem_subdirectories(install_dir, $dir_mode).map {|d| File.join(gem_dir, d)})
45 +@@ -943,7 +943,7 @@
46 + end
47 +
48 + install?(:ext, :comm, :gem, :'bundled-gems') do
49 +- gem_dir = Gem.default_dir
50 ++ gem_dir = ENV['GEM_DESTDIR']
51 + install_dir = with_destdir(gem_dir)
52 + prepare "bundled gems", gem_dir
53 + makedirs(Gem.ensure_gem_subdirectories(install_dir, $dir_mode).map {|d| File.join(gem_dir, d)})
54
55 diff --git a/dev-lang/ruby/ruby-3.0.0.ebuild b/dev-lang/ruby/ruby-3.0.0.ebuild
56 new file mode 100644
57 index 00000000000..cdedfadfa7b
58 --- /dev/null
59 +++ b/dev-lang/ruby/ruby-3.0.0.ebuild
60 @@ -0,0 +1,262 @@
61 +# Copyright 1999-2020 Gentoo Authors
62 +# Distributed under the terms of the GNU General Public License v2
63 +
64 +EAPI=7
65 +
66 +inherit autotools flag-o-matic multilib
67 +
68 +MY_P="${PN}-$(ver_cut 1-3)"
69 +S=${WORKDIR}/${MY_P}
70 +
71 +SLOT=$(ver_cut 1-2)
72 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
73 +RUBYVERSION=${SLOT}.0
74 +
75 +DESCRIPTION="An object-oriented scripting language"
76 +HOMEPAGE="https://www.ruby-lang.org/"
77 +SRC_URI="https://cache.ruby-lang.org/pub/ruby/${SLOT}/${MY_P}.tar.xz"
78 +
79 +LICENSE="|| ( Ruby-BSD BSD-2 )"
80 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
81 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit libressl +rdoc rubytests socks5 +ssl static-libs systemtap tk xemacs"
82 +
83 +RDEPEND="
84 + berkdb? ( sys-libs/db:= )
85 + gdbm? ( sys-libs/gdbm:= )
86 + jemalloc? ( dev-libs/jemalloc )
87 + jit? ( || ( sys-devel/gcc:* sys-devel/clang:* ) )
88 + ssl? (
89 + !libressl? ( dev-libs/openssl:0= )
90 + libressl? ( dev-libs/libressl )
91 + )
92 + socks5? ( >=net-proxy/dante-1.1.13 )
93 + systemtap? ( dev-util/systemtap )
94 + tk? (
95 + dev-lang/tcl:0=[threads]
96 + dev-lang/tk:0=[threads]
97 + )
98 + dev-libs/libyaml
99 + dev-libs/libffi:=
100 + sys-libs/readline:0=
101 + sys-libs/zlib
102 + >=app-eselect/eselect-ruby-20201225
103 +"
104 +
105 +DEPEND="${RDEPEND}"
106 +
107 +BUNDLED_GEMS="
108 + >=dev-ruby/minitest-5.14.2[ruby_targets_ruby30]
109 + >=dev-ruby/power_assert-1.2.0[ruby_targets_ruby30]
110 + >=dev-ruby/rake-13.0.3[ruby_targets_ruby30]
111 + >=dev-ruby/rbs-1.0.0[ruby_targets_ruby30]
112 + >=dev-ruby/rexml-3.2.4[ruby_targets_ruby30]
113 + >=dev-ruby/rss-0.2.9[ruby_targets_ruby30]
114 + >=dev-ruby/test-unit-3.3.7[ruby_targets_ruby30]
115 + >=dev-ruby/typeprof-0.11.0[ruby_targets_ruby30]
116 +"
117 +
118 +PDEPEND="
119 + ${BUNDLED_GEMS}
120 + virtual/rubygems[ruby_targets_ruby30]
121 + >=dev-ruby/bundler-2.1.4[ruby_targets_ruby30]
122 + >=dev-ruby/did_you_mean-1.5.0[ruby_targets_ruby30]
123 + >=dev-ruby/json-2.5.1[ruby_targets_ruby30]
124 + rdoc? ( >=dev-ruby/rdoc-6.3.0[ruby_targets_ruby30] )
125 + xemacs? ( app-xemacs/ruby-modes )"
126 +
127 +src_prepare() {
128 + eapply "${FILESDIR}"/"${SLOT}"/010*.patch
129 +
130 + einfo "Unbundling gems..."
131 + cd "$S"
132 + # Remove bundled gems that we will install via PDEPEND, bug
133 + # 539700.
134 + rm -fr gems/* || die
135 + touch gems/bundled_gems || die
136 + # Don't install CLI tools since they will clash with the gem
137 + rm -f bin/{racc,racc2y,y2racc} || die
138 + sed -i -e '/executables/ s:^:#:' lib/racc/racc.gemspec || die
139 +
140 + einfo "Removing bundled libraries..."
141 + rm -fr ext/fiddle/libffi-3.2.1 || die
142 +
143 + if use prefix ; then
144 + # Fix hardcoded SHELL var in mkmf library
145 + sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
146 +
147 + if [[ ${CHOST} == *darwin* ]] ; then
148 + # avoid symlink loop on Darwin (?!)
149 + sed -i \
150 + -e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
151 + configure.ac || die
152 +
153 + # make ar/libtool hack for Darwin work
154 + sed -i \
155 + -e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
156 + configure.ac || die
157 + fi
158 + fi
159 +
160 + eapply_user
161 +
162 + eautoreconf
163 +}
164 +
165 +src_configure() {
166 + local modules= myconf=
167 +
168 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
169 + filter-flags -fomit-frame-pointer
170 + # In many places aliasing rules are broken; play it safe
171 + # as it's risky with newer compilers to leave it as it is.
172 + append-flags -fno-strict-aliasing
173 +
174 + # Socks support via dante
175 + if use socks5 ; then
176 + # Socks support can't be disabled as long as SOCKS_SERVER is
177 + # set and socks library is present, so need to unset
178 + # SOCKS_SERVER in that case.
179 + unset SOCKS_SERVER
180 + fi
181 +
182 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
183 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
184 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
185 + fi
186 +
187 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
188 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
189 +
190 + # Determine which modules *not* to build depending in the USE flags.
191 + if ! use berkdb ; then
192 + modules="${modules},dbm"
193 + fi
194 + if ! use gdbm ; then
195 + modules="${modules},gdbm"
196 + fi
197 + if ! use ssl ; then
198 + modules="${modules},openssl"
199 + fi
200 + if ! use tk ; then
201 + modules="${modules},tk"
202 + fi
203 +
204 + # Provide an empty LIBPATHENV because we disable rpath but we do not
205 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
206 + # #564272
207 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
208 + --program-suffix=${MY_SUFFIX} \
209 + --with-soname=ruby${MY_SUFFIX} \
210 + --with-readline-dir="${EPREFIX}"/usr \
211 + --enable-shared \
212 + --enable-pthread \
213 + --disable-rpath \
214 + --with-out-ext="${modules}" \
215 + $(use_with jemalloc jemalloc) \
216 + $(use_enable jit jit-support ) \
217 + $(use_enable socks5 socks) \
218 + $(use_enable systemtap dtrace) \
219 + $(use_enable doc install-doc) \
220 + --enable-ipv6 \
221 + $(use_enable static-libs static) \
222 + $(use_enable static-libs install-static-library) \
223 + $(use_with static-libs static-linked-ext) \
224 + $(use_enable debug) \
225 + ${myconf} \
226 + --enable-option-checking=no
227 +
228 + # Makefile is broken because it lacks -ldl
229 + rm -rf ext/-test-/popen_deadlock || die
230 +}
231 +
232 +src_compile() {
233 + emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS=""
234 +}
235 +
236 +src_test() {
237 + emake -j1 V=1 test
238 +
239 + elog "Ruby's make test has been run. Ruby also ships with a make check"
240 + elog "that cannot be run until after ruby has been installed."
241 + elog
242 + if use rubytests; then
243 + elog "You have enabled rubytests, so they will be installed to"
244 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
245 + elog "than root, and you must place them into a writeable directory."
246 + elog "Then call: "
247 + elog
248 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
249 + else
250 + elog "Enable the rubytests USE flag to install the make check tests"
251 + fi
252 +}
253 +
254 +src_install() {
255 + # Remove the remaining bundled gems. We do this late in the process
256 + # since they are used during the build to e.g. create the
257 + # documentation.
258 + rm -rf ext/json || die
259 + rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || die
260 +
261 + # Ruby is involved in the install process, we don't want interference here.
262 + unset RUBYOPT
263 +
264 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
265 +
266 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
267 +
268 + if [[ ${CHOST} == *darwin* ]] ; then
269 + DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
270 + export DYLD_LIBRARY_PATH
271 + fi
272 +
273 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
274 + for d in $(find "${S}/ext" -type d) ; do
275 + RUBYLIB="${RUBYLIB}:$d"
276 + done
277 + export LD_LIBRARY_PATH RUBYLIB
278 +
279 + # Create directory for the default gems
280 + local gem_home="${EPREFIX}/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}"
281 + mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed"
282 +
283 + emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install
284 +
285 + # Remove installed rubygems and rdoc copy
286 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
287 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
288 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
289 + rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
290 +
291 + if use doc; then
292 + emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc
293 + fi
294 +
295 + if use examples; then
296 + dodoc -r sample
297 + fi
298 +
299 + dodoc ChangeLog NEWS.md doc/NEWS* README*
300 +
301 + if use rubytests; then
302 + pushd test
303 + insinto /usr/share/${PN}-${SLOT}/test
304 + doins -r .
305 + popd
306 + fi
307 +}
308 +
309 +pkg_postinst() {
310 + if [[ ! -n $(readlink "${EROOT}"/usr/bin/ruby) ]] ; then
311 + eselect ruby set ruby${MY_SUFFIX}
312 + fi
313 +
314 + elog
315 + elog "To switch between available Ruby profiles, execute as root:"
316 + elog "\teselect ruby set ruby(23|24|...)"
317 + elog
318 +}
319 +
320 +pkg_postrm() {
321 + eselect ruby cleanup
322 +}