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/files/2.5/, dev-lang/ruby/
Date: Thu, 14 Mar 2019 05:56:21
Message-Id: 1552542955.2632e0268923b8cabbba7856f37e5e6b27069e21.graaff@gentoo
1 commit: 2632e0268923b8cabbba7856f37e5e6b27069e21
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 14 05:55:55 2019 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 14 05:55:55 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2632e026
7
8 dev-lang/ruby: add 2.5.4, 2.6.2
9
10 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
11 Package-Manager: Portage-2.3.62, Repoman-2.3.11
12
13 dev-lang/ruby/Manifest | 2 +
14 dev-lang/ruby/files/2.5/011-no-gems.patch | 85 +++++++++++
15 dev-lang/ruby/ruby-2.5.4.ebuild | 225 ++++++++++++++++++++++++++++
16 dev-lang/ruby/ruby-2.6.2.ebuild | 237 ++++++++++++++++++++++++++++++
17 4 files changed, 549 insertions(+)
18
19 diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest
20 index 1c6d7d24dd7..2588f8680ed 100644
21 --- a/dev-lang/ruby/Manifest
22 +++ b/dev-lang/ruby/Manifest
23 @@ -1,6 +1,8 @@
24 DIST ruby-2.3.8.tar.xz 11465792 BLAKE2B b9c8ef5c943872e3d1426c30cbd720acc66d17cc7bc926f3294e68f17fbc78edef42f6496295800c3d4efd3ae441730723bfcfbc1111e46239359930622697d9 SHA512 06373050e6c1af9cb6a5863aef878b21c8a45fd0e68414e3d546cb73ec3028207d3acc0a9326428f172b9347a30bbe69a16f9dc0bdb739161d677adb2d888095
25 DIST ruby-2.4.5.tar.xz 10064712 BLAKE2B 0846125e617b43ea302b4c5309b20503577937865d445a6fee766323a188aa552d3a13740c3d38c7be812b19bffb2474021cb7b368cc144d51ea771552f62769 SHA512 658f676c623109f4c7499615e191c98c3dd72cfcaeeaf121337d0b8a33c5243145edd50ec5e2775f988e3cd19788984f105fa165e3049779066566f67172c1b4
26 DIST ruby-2.5.3.tar.xz 11453336 BLAKE2B 66c59448a23c22796b43f04a1f84359386b7bee7163da4255426ea75b1c7af0a7a7142991b870a75a72ded56ac49f47c51bc162ebf2be2af0d1b1608b60c02df SHA512 6dcae0e8d0bacdb2cbde636e2030596308b5af53f2eb85d3adccb67b02e6f8f9751e8117d12f8484829fdd9d995f6e327f701d9b433bcf94f1f59d13a1fd7518
27 +DIST ruby-2.5.4.tar.xz 11493016 BLAKE2B 6fa56a32962738a731f5604375d0f2db2e16d71fc568e6c01eb61928ae1dbec6a51455237f51e2be5b2a17a89f4d1ff896afb21f10ba7b8336aa3599756eeeee SHA512 e72294e549d09510f20c808d26a0d21ef0ee2616d8598980a42db260d45340e5c259ac65e5478a8b086042ff6ba7d8447a6c8115454ffe977c4f63175ab89062
28 DIST ruby-2.6.0.tar.xz 11918536 BLAKE2B f51fe57c1ff83d99c834f29d1bcc8e847f7a4cd3a10e202391327373d9d803fcc356d210cc07b9038915039a7462c0263fa7567b63366d1ab6273b9a82e651d1 SHA512 c56eaf85ef7b79deb34ee4590b143c07f4fc83eb79775290761aee5a7c63374659613538a41f25706ed6e19e49d5c67a1014c24d17f29948294c7abd0b0fcea8
29 DIST ruby-2.6.1.tar.xz 11872964 BLAKE2B 789d1a174b02538e92a66372814b8be45f30187f99df15922e3dd899222fd5feea196ed0a352a19246d8c822e0eb97e8f4ff8229a6c00ac5c60cb214460b7289 SHA512 fb36289a955f0596c683cdadf1e4a9a9fd35222b1e1c6160c2e7cd82e5befd40a7aa4361e55f7a8f83c06ee899ec493821c7db34a60c4ac3bca0e874d33ef1a9
30 +DIST ruby-2.6.2.tar.xz 11889840 BLAKE2B 817919c078869c2ad8d5c9d8c8b7ee77e8b0e3339c2ef662a94a666a859f762fa63c6f8534027abd368e91fe4e3e1fe68fa984cbf12f76cff8c0c66f0114914f SHA512 13f7d7b483a037378eac4bf4bebddc21d69f4e19e6bbb397dd53e7518037ae9a3aa5b41fc20bf1fe410803c6efc3a6a65a65af47648d3a93713f75cfe885326a
31 DIST ruby-patches-2.3.8-r1.tar.bz2 3030 BLAKE2B 7c1e80ff0569a03672f53820c665933056b46bcf791c9132cb9f358f72df693749f02da65ca7469c3dd0f652d7dc7bfaa03dccd4eb900562361876023fb65b42 SHA512 54cc3f2bfd1967b8558736e5a5240b886a56b22defca5813f45b1f4dca9af169b4d59d60b327ec8411e824970ac6da1cec53cfc31833403742e9d6941e5a78f1
32
33 diff --git a/dev-lang/ruby/files/2.5/011-no-gems.patch b/dev-lang/ruby/files/2.5/011-no-gems.patch
34 new file mode 100644
35 index 00000000000..2ebe064c8ac
36 --- /dev/null
37 +++ b/dev-lang/ruby/files/2.5/011-no-gems.patch
38 @@ -0,0 +1,85 @@
39 +--- a/tool/rbinstall.rb.~1~ 2017-10-30 06:45:20.000000000 +0100
40 ++++ b/tool/rbinstall.rb 2017-12-25 11:06:53.340432435 +0100
41 +@@ -700,10 +700,10 @@
42 + # :startdoc:
43 +
44 + install?(:ext, :comm, :gem, :'default-gems', :'default-gems-comm') do
45 +- install_default_gem('lib', srcdir)
46 ++ # Gems are unbundled in Gentoo
47 + end
48 + install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do
49 +- install_default_gem('ext', srcdir)
50 ++ # Gems are unbundled in Gentoo
51 + end
52 +
53 + def load_gemspec(file)
54 +@@ -765,68 +755,7 @@
55 + end
56 +
57 + install?(:ext, :comm, :gem, :'bundled-gems') do
58 +- gem_dir = Gem.default_dir
59 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
60 +- prepare "bundled gems", gem_dir, directories
61 +- install_dir = with_destdir(gem_dir)
62 +- installed_gems = {}
63 +- options = {
64 +- :install_dir => install_dir,
65 +- :bin_dir => with_destdir(bindir),
66 +- :domain => :local,
67 +- :ignore_dependencies => true,
68 +- :dir_mode => $dir_mode,
69 +- :data_mode => $data_mode,
70 +- :prog_mode => $prog_mode,
71 +- :wrappers => true,
72 +- :format_executable => true,
73 +- }
74 +- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
75 +- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
76 +- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
77 +- spec = load_gemspec(path)
78 +- next unless spec.platform == Gem::Platform::RUBY
79 +- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
80 +- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
81 +- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
82 +- spec.extensions[0] ||= "-"
83 +- end
84 +- ins = RbInstall::UnpackedInstaller.new(spec, options)
85 +- puts "#{INDENT}#{spec.name} #{spec.version}"
86 +- ins.install
87 +- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
88 +- unless spec.extensions.empty?
89 +- install_recursive(ext, spec.extension_dir)
90 +- end
91 +- installed_gems[spec.full_name] = true
92 +- end
93 +- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
94 +- unless installed_gems.empty?
95 +- install installed_gems, gem_dir+"/cache"
96 +- end
97 +- next if gems.empty?
98 +- if defined?(Zlib)
99 +- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
100 +- silent = Gem::SilentUI.new
101 +- gems.each do |gem|
102 +- inst = Gem::Installer.new(gem, options)
103 +- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
104 +- begin
105 +- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
106 +- rescue Gem::InstallError => e
107 +- next
108 +- end
109 +- gemname = File.basename(gem)
110 +- puts "#{INDENT}#{gemname}"
111 +- end
112 +- # fix directory permissions
113 +- # TODO: Gem.install should accept :dir_mode option or something
114 +- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
115 +- # fix .gemspec permissions
116 +- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
117 +- else
118 +- puts "skip installing bundled gems because of lacking zlib"
119 +- end
120 ++ # Gems are unbundled in Gentoo
121 + end
122 +
123 + parse_args()
124
125 diff --git a/dev-lang/ruby/ruby-2.5.4.ebuild b/dev-lang/ruby/ruby-2.5.4.ebuild
126 new file mode 100644
127 index 00000000000..813475e31ff
128 --- /dev/null
129 +++ b/dev-lang/ruby/ruby-2.5.4.ebuild
130 @@ -0,0 +1,225 @@
131 +# Copyright 1999-2019 Gentoo Authors
132 +# Distributed under the terms of the GNU General Public License v2
133 +
134 +EAPI=7
135 +
136 +inherit autotools flag-o-matic multilib
137 +
138 +MY_P="${PN}-$(ver_cut 1-3)"
139 +S=${WORKDIR}/${MY_P}
140 +
141 +SLOT=$(ver_cut 1-2)
142 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
143 +RUBYVERSION=${SLOT}.0
144 +
145 +DESCRIPTION="An object-oriented scripting language"
146 +HOMEPAGE="https://www.ruby-lang.org/"
147 +SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.xz"
148 +
149 +LICENSE="|| ( Ruby-BSD BSD-2 )"
150 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
151 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc libressl +rdoc rubytests socks5 +ssl static-libs tk xemacs"
152 +
153 +RDEPEND="
154 + berkdb? ( sys-libs/db:= )
155 + gdbm? ( sys-libs/gdbm:= )
156 + jemalloc? ( dev-libs/jemalloc )
157 + ssl? (
158 + !libressl? ( dev-libs/openssl:0= )
159 + libressl? ( dev-libs/libressl )
160 + )
161 + socks5? ( >=net-proxy/dante-1.1.13 )
162 + tk? (
163 + dev-lang/tcl:0=[threads]
164 + dev-lang/tk:0=[threads]
165 + )
166 + dev-libs/libyaml
167 + virtual/libffi:=
168 + sys-libs/readline:0=
169 + sys-libs/zlib
170 + >=app-eselect/eselect-ruby-20171225
171 +"
172 +
173 +DEPEND="${RDEPEND}"
174 +
175 +BUNDLED_GEMS="
176 + >=dev-ruby/did_you_mean-1.2.0:2.5[ruby_targets_ruby25]
177 + >=dev-ruby/minitest-5.10.3[ruby_targets_ruby25]
178 + >=dev-ruby/net-telnet-0.1.1[ruby_targets_ruby25]
179 + >=dev-ruby/power_assert-1.1.1[ruby_targets_ruby25]
180 + >=dev-ruby/rake-12.3.0[ruby_targets_ruby25]
181 + >=dev-ruby/test-unit-3.2.7[ruby_targets_ruby25]
182 + >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby25]
183 +"
184 +
185 +PDEPEND="
186 + ${BUNDLED_GEMS}
187 + virtual/rubygems[ruby_targets_ruby25]
188 + >=dev-ruby/json-2.0.2[ruby_targets_ruby25]
189 + rdoc? ( >=dev-ruby/rdoc-5.1.0[ruby_targets_ruby25] )
190 + xemacs? ( app-xemacs/ruby-modes )"
191 +
192 +src_prepare() {
193 + eapply "${FILESDIR}"/${SLOT}/{001,005,011}*.patch
194 +
195 + einfo "Unbundling gems..."
196 + cd "$S"
197 + # Remove bundled gems that we will install via PDEPEND, bug
198 + # 539700. Use explicit version numbers to ensure rm fails when they
199 + # change so we can update dependencies accordingly.
200 + rm -f gems/{did_you_mean-1.2.0,minitest-5.10.3,net-telnet-0.1.1,power_assert-1.1.1,rake-12.3.0,test-unit-3.2.7,xmlrpc-0.3.0}.gem || die
201 +
202 + einfo "Removing bundled libraries..."
203 + rm -fr ext/fiddle/libffi-3.2.1 || die
204 +
205 + eapply_user
206 +
207 + eautoreconf
208 +}
209 +
210 +src_configure() {
211 + local modules= myconf=
212 +
213 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
214 + filter-flags -fomit-frame-pointer
215 + # In many places aliasing rules are broken; play it safe
216 + # as it's risky with newer compilers to leave it as it is.
217 + append-flags -fno-strict-aliasing
218 + # SuperH needs this
219 + use sh && append-flags -mieee
220 +
221 + # Socks support via dante
222 + if use socks5 ; then
223 + # Socks support can't be disabled as long as SOCKS_SERVER is
224 + # set and socks library is present, so need to unset
225 + # SOCKS_SERVER in that case.
226 + unset SOCKS_SERVER
227 + fi
228 +
229 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
230 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
231 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
232 + fi
233 +
234 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
235 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
236 +
237 + # Determine which modules *not* to build depending in the USE flags.
238 + if ! use berkdb ; then
239 + modules="${modules},dbm"
240 + fi
241 + if ! use gdbm ; then
242 + modules="${modules},gdbm"
243 + fi
244 + if ! use ssl ; then
245 + modules="${modules},openssl"
246 + fi
247 + if ! use tk ; then
248 + modules="${modules},tk"
249 + fi
250 +
251 + # Provide an empty LIBPATHENV because we disable rpath but we do not
252 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
253 + # #564272
254 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
255 + --program-suffix=${MY_SUFFIX} \
256 + --with-soname=ruby${MY_SUFFIX} \
257 + --docdir=${EPREFIX}/usr/share/doc/${P} \
258 + --enable-shared \
259 + --enable-pthread \
260 + --disable-rpath \
261 + --with-out-ext="${modules}" \
262 + $(use_with jemalloc jemalloc) \
263 + $(use_enable socks5 socks) \
264 + $(use_enable doc install-doc) \
265 + --enable-ipv6 \
266 + $(use_enable static-libs static) \
267 + $(use_enable static-libs install-static-library) \
268 + $(use_with static-libs static-linked-ext) \
269 + $(use_enable debug) \
270 + ${myconf} \
271 + --enable-option-checking=no \
272 + || die "econf failed"
273 +}
274 +
275 +src_compile() {
276 + emake V=1 EXTLDFLAGS="${LDFLAGS}" || die "emake failed"
277 +}
278 +
279 +src_test() {
280 + emake -j1 V=1 test || die "make test failed"
281 +
282 + elog "Ruby's make test has been run. Ruby also ships with a make check"
283 + elog "that cannot be run until after ruby has been installed."
284 + elog
285 + if use rubytests; then
286 + elog "You have enabled rubytests, so they will be installed to"
287 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
288 + elog "than root, and you must place them into a writeable directory."
289 + elog "Then call: "
290 + elog
291 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
292 + else
293 + elog "Enable the rubytests USE flag to install the make check tests"
294 + fi
295 +}
296 +
297 +src_install() {
298 + # Remove the remaining bundled gems. We do this late in the process
299 + # since they are used during the build to e.g. create the
300 + # documentation.
301 + rm -rf ext/json || die
302 +
303 + # Ruby is involved in the install process, we don't want interference here.
304 + unset RUBYOPT
305 +
306 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
307 +
308 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
309 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
310 + for d in $(find "${S}/ext" -type d) ; do
311 + RUBYLIB="${RUBYLIB}:$d"
312 + done
313 + export LD_LIBRARY_PATH RUBYLIB
314 +
315 + emake V=1 DESTDIR="${D}" install || die "make install failed"
316 +
317 + # Remove installed rubygems and rdoc copy
318 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
319 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
320 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
321 + rm -rf "${ED}/usr/bin/"{ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
322 +
323 + if use doc; then
324 + make DESTDIR="${D}" install-doc || die "make install-doc failed"
325 + fi
326 +
327 + if use examples; then
328 + insinto /usr/share/doc/${PF}
329 + doins -r sample
330 + fi
331 +
332 + dodoc ChangeLog NEWS doc/NEWS* README* || die
333 +
334 + if use rubytests; then
335 + pushd test
336 + insinto /usr/share/${PN}-${SLOT}/test
337 + doins -r .
338 + popd
339 + fi
340 +}
341 +
342 +pkg_postinst() {
343 + if [[ ! -n $(readlink "${EROOT}"usr/bin/ruby) ]] ; then
344 + eselect ruby set ruby${MY_SUFFIX}
345 + fi
346 +
347 + elog
348 + elog "To switch between available Ruby profiles, execute as root:"
349 + elog "\teselect ruby set ruby(23|24|...)"
350 + elog
351 +}
352 +
353 +pkg_postrm() {
354 + eselect ruby cleanup
355 +}
356
357 diff --git a/dev-lang/ruby/ruby-2.6.2.ebuild b/dev-lang/ruby/ruby-2.6.2.ebuild
358 new file mode 100644
359 index 00000000000..9ab0d7c1a5d
360 --- /dev/null
361 +++ b/dev-lang/ruby/ruby-2.6.2.ebuild
362 @@ -0,0 +1,237 @@
363 +# Copyright 1999-2019 Gentoo Authors
364 +# Distributed under the terms of the GNU General Public License v2
365 +
366 +EAPI=7
367 +
368 +inherit autotools flag-o-matic multilib
369 +
370 +MY_P="${PN}-$(ver_cut 1-3)"
371 +S=${WORKDIR}/${MY_P}
372 +
373 +SLOT=$(ver_cut 1-2)
374 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
375 +RUBYVERSION=${SLOT}.0
376 +
377 +DESCRIPTION="An object-oriented scripting language"
378 +HOMEPAGE="https://www.ruby-lang.org/"
379 +SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.xz"
380 +
381 +LICENSE="|| ( Ruby-BSD BSD-2 )"
382 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
383 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit libressl +rdoc rubytests socks5 +ssl static-libs tk xemacs"
384 +
385 +RDEPEND="
386 + berkdb? ( sys-libs/db:= )
387 + gdbm? ( sys-libs/gdbm:= )
388 + jemalloc? ( dev-libs/jemalloc )
389 + jit? ( || ( sys-devel/gcc:* sys-devel/clang:* ) )
390 + ssl? (
391 + !libressl? ( dev-libs/openssl:0= )
392 + libressl? ( dev-libs/libressl )
393 + )
394 + socks5? ( >=net-proxy/dante-1.1.13 )
395 + tk? (
396 + dev-lang/tcl:0=[threads]
397 + dev-lang/tk:0=[threads]
398 + )
399 + dev-libs/libyaml
400 + virtual/libffi:=
401 + sys-libs/readline:0=
402 + sys-libs/zlib
403 + >=app-eselect/eselect-ruby-20171225
404 +"
405 +
406 +DEPEND="${RDEPEND}"
407 +
408 +BUNDLED_GEMS="
409 + >=dev-ruby/did_you_mean-1.2.1[ruby_targets_ruby26]
410 + >=dev-ruby/minitest-5.11.3[ruby_targets_ruby26]
411 + >=dev-ruby/net-telnet-0.2.0[ruby_targets_ruby26]
412 + >=dev-ruby/power_assert-1.1.3[ruby_targets_ruby26]
413 + >=dev-ruby/rake-12.3.2[ruby_targets_ruby26]
414 + >=dev-ruby/test-unit-3.2.9[ruby_targets_ruby26]
415 + >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby26]
416 +"
417 +
418 +PDEPEND="
419 + ${BUNDLED_GEMS}
420 + virtual/rubygems[ruby_targets_ruby26]
421 + >=dev-ruby/bundler-1.17.2[ruby_targets_ruby26]
422 + >=dev-ruby/json-2.0.2[ruby_targets_ruby26]
423 + rdoc? ( >=dev-ruby/rdoc-5.1.0[ruby_targets_ruby26] )
424 + xemacs? ( app-xemacs/ruby-modes )"
425 +
426 +src_prepare() {
427 + # 005 does not compile bigdecimal and is questionable because it
428 + # compiles ruby in a non-standard way, may be dropped
429 + eapply "${FILESDIR}"/2.6/010*.patch
430 +
431 + einfo "Unbundling gems..."
432 + cd "$S"
433 + # Remove bundled gems that we will install via PDEPEND, bug
434 + # 539700.
435 + rm -fr gems/* || die
436 +
437 + einfo "Removing bundled libraries..."
438 + rm -fr ext/fiddle/libffi-3.2.1 || die
439 +
440 + eapply_user
441 +
442 + eautoreconf
443 +}
444 +
445 +src_configure() {
446 + local modules= myconf=
447 +
448 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
449 + filter-flags -fomit-frame-pointer
450 + # In many places aliasing rules are broken; play it safe
451 + # as it's risky with newer compilers to leave it as it is.
452 + append-flags -fno-strict-aliasing
453 + # SuperH needs this
454 + use sh && append-flags -mieee
455 +
456 + # Socks support via dante
457 + if use socks5 ; then
458 + # Socks support can't be disabled as long as SOCKS_SERVER is
459 + # set and socks library is present, so need to unset
460 + # SOCKS_SERVER in that case.
461 + unset SOCKS_SERVER
462 + fi
463 +
464 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
465 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
466 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
467 + fi
468 +
469 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
470 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
471 +
472 + # Determine which modules *not* to build depending in the USE flags.
473 + if ! use berkdb ; then
474 + modules="${modules},dbm"
475 + fi
476 + if ! use gdbm ; then
477 + modules="${modules},gdbm"
478 + fi
479 + if ! use ssl ; then
480 + modules="${modules},openssl"
481 + fi
482 + if ! use tk ; then
483 + modules="${modules},tk"
484 + fi
485 +
486 + # Provide an empty LIBPATHENV because we disable rpath but we do not
487 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
488 + # #564272
489 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
490 + --program-suffix=${MY_SUFFIX} \
491 + --with-soname=ruby${MY_SUFFIX} \
492 + --docdir=${EPREFIX}/usr/share/doc/${P} \
493 + --enable-shared \
494 + --enable-pthread \
495 + --disable-rpath \
496 + --with-out-ext="${modules}" \
497 + $(use_with jemalloc jemalloc) \
498 + $(use_enable jit jit-support ) \
499 + $(use_enable socks5 socks) \
500 + $(use_enable doc install-doc) \
501 + --enable-ipv6 \
502 + $(use_enable static-libs static) \
503 + $(use_enable static-libs install-static-library) \
504 + $(use_with static-libs static-linked-ext) \
505 + $(use_enable debug) \
506 + ${myconf} \
507 + --enable-option-checking=no \
508 + || die "econf failed"
509 +
510 + # Makefile is broken because it lacks -ldl
511 + rm -rf ext/-test-/popen_deadlock || die
512 +}
513 +
514 +src_compile() {
515 + emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS="" || die "emake failed"
516 +}
517 +
518 +src_test() {
519 + emake -j1 V=1 test || die "make test failed"
520 +
521 + elog "Ruby's make test has been run. Ruby also ships with a make check"
522 + elog "that cannot be run until after ruby has been installed."
523 + elog
524 + if use rubytests; then
525 + elog "You have enabled rubytests, so they will be installed to"
526 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
527 + elog "than root, and you must place them into a writeable directory."
528 + elog "Then call: "
529 + elog
530 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
531 + else
532 + elog "Enable the rubytests USE flag to install the make check tests"
533 + fi
534 +}
535 +
536 +src_install() {
537 + # Remove the remaining bundled gems. We do this late in the process
538 + # since they are used during the build to e.g. create the
539 + # documentation.
540 + rm -rf ext/json || die
541 + rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || die
542 +
543 + # Ruby is involved in the install process, we don't want interference here.
544 + unset RUBYOPT
545 +
546 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
547 +
548 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
549 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
550 + for d in $(find "${S}/ext" -type d) ; do
551 + RUBYLIB="${RUBYLIB}:$d"
552 + done
553 + export LD_LIBRARY_PATH RUBYLIB
554 +
555 + # Create directory for the default gems
556 + local gem_home="${EPREFIX}/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}"
557 + mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed"
558 +
559 + emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install || die "make install failed"
560 +
561 + # Remove installed rubygems and rdoc copy
562 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
563 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
564 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
565 + rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
566 +
567 + if use doc; then
568 + emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc || die "make install-doc failed"
569 + fi
570 +
571 + if use examples; then
572 + insinto /usr/share/doc/${PF}
573 + doins -r sample
574 + fi
575 +
576 + dodoc ChangeLog NEWS doc/NEWS* README* || die
577 +
578 + if use rubytests; then
579 + pushd test
580 + insinto /usr/share/${PN}-${SLOT}/test
581 + doins -r .
582 + popd
583 + fi
584 +}
585 +
586 +pkg_postinst() {
587 + if [[ ! -n $(readlink "${EROOT}"usr/bin/ruby) ]] ; then
588 + eselect ruby set ruby${MY_SUFFIX}
589 + fi
590 +
591 + elog
592 + elog "To switch between available Ruby profiles, execute as root:"
593 + elog "\teselect ruby set ruby(23|24|...)"
594 + elog
595 +}
596 +
597 +pkg_postrm() {
598 + eselect ruby cleanup
599 +}