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: Mon, 16 Jul 2018 07:10:20
Message-Id: 1531724994.38207207860018eb0a2170cfea41db2b75dc468f.graaff@gentoo
1 commit: 38207207860018eb0a2170cfea41db2b75dc468f
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 16 07:09:23 2018 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 16 07:09:54 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38207207
7
8 dev-lang/ruby: EAPI 7, fix libressl 2.7
9
10 Convert to EAPI 7
11 Fix compilation with libressl 2.7, bug 656584
12 Use patches in FILESDIR instead of patchset
13
14 Package-Manager: Portage-2.3.40, Repoman-2.3.9
15
16 ...-ia64-specific-code-to-use-execution-cont.patch | 67 ++++++
17 dev-lang/ruby/files/2.5/005_no-undefined-ext.patch | 11 +
18 dev-lang/ruby/files/2.5/009_no-gems.patch | 95 +++++++++
19 dev-lang/ruby/files/2.5/010-libressl_2.7.patch | 15 ++
20 dev-lang/ruby/ruby-2.5.1-r1.ebuild | 224 +++++++++++++++++++++
21 5 files changed, 412 insertions(+)
22
23 diff --git a/dev-lang/ruby/files/2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch b/dev-lang/ruby/files/2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch
24 new file mode 100644
25 index 00000000000..2ade8b8d420
26 --- /dev/null
27 +++ b/dev-lang/ruby/files/2.5/001-ia64-update-ia64-specific-code-to-use-execution-cont.patch
28 @@ -0,0 +1,67 @@
29 +From 5af43b1ec2674e9f86090790bc61abdb96be14ff Mon Sep 17 00:00:00 2001
30 +From: hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
31 +Date: Tue, 30 Jan 2018 05:43:42 +0000
32 +Subject: [PATCH] ia64: update ia64-specific code to use execution context
33 +
34 +This change follows commit 837fd5e494731d7d44786f29e7d6e8c27029806f
35 +in '#ifdef __ia64' branches.
36 +
37 +Noticed as a build failure by John Paul Adrian Glaubitz:
38 +
39 +```
40 + cont.c:502:50: error: 'rb_thread_t {aka struct rb_thread_struct}'
41 + has no member named 'machine'
42 + size = cont->machine.register_stack_size =
43 + th->machine.register_stack_end - th->machine.register_stack_start;
44 + ^~
45 +```
46 +
47 +The change is trivial: update 'th->machine' usage to 'th->ec->machine'.
48 +Signed-off-by: Sergei Trofimovich <slyfox@g.o>
49 +
50 +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
51 +---
52 + cont.c | 6 +++---
53 + thread.c | 2 +-
54 + 2 files changed, 4 insertions(+), 4 deletions(-)
55 +
56 +diff --git a/cont.c b/cont.c
57 +index f48fd2e52b..93a64f8fe6 100644
58 +--- a/cont.c
59 ++++ b/cont.c
60 +@@ -475,7 +475,7 @@ cont_save_machine_stack(rb_thread_t *th, rb_context_t *cont)
61 +
62 + SET_MACHINE_STACK_END(&th->ec->machine.stack_end);
63 + #ifdef __ia64
64 +- th->machine.register_stack_end = rb_ia64_bsp();
65 ++ th->ec->machine.register_stack_end = rb_ia64_bsp();
66 + #endif
67 +
68 + if (th->ec->machine.stack_start > th->ec->machine.stack_end) {
69 +@@ -499,8 +499,8 @@ cont_save_machine_stack(rb_thread_t *th, rb_context_t *cont)
70 +
71 + #ifdef __ia64
72 + rb_ia64_flushrs();
73 +- size = cont->machine.register_stack_size = th->machine.register_stack_end - th->machine.register_stack_start;
74 +- cont->machine.register_stack_src = th->machine.register_stack_start;
75 ++ size = cont->machine.register_stack_size = th->ec->machine.register_stack_end - th->ec->machine.register_stack_start;
76 ++ cont->machine.register_stack_src = th->ec->machine.register_stack_start;
77 + if (cont->machine.register_stack) {
78 + REALLOC_N(cont->machine.register_stack, VALUE, size);
79 + }
80 +diff --git a/thread.c b/thread.c
81 +index acb53354fd..23957eba09 100644
82 +--- a/thread.c
83 ++++ b/thread.c
84 +@@ -133,7 +133,7 @@ static inline void blocking_region_end(rb_thread_t *th, struct rb_blocking_regio
85 +
86 + #ifdef __ia64
87 + #define RB_GC_SAVE_MACHINE_REGISTER_STACK(th) \
88 +- do{(th)->machine.register_stack_end = rb_ia64_bsp();}while(0)
89 ++ do{(th)->ec->machine.register_stack_end = rb_ia64_bsp();}while(0)
90 + #else
91 + #define RB_GC_SAVE_MACHINE_REGISTER_STACK(th)
92 + #endif
93 +--
94 +2.16.1
95 +
96
97 diff --git a/dev-lang/ruby/files/2.5/005_no-undefined-ext.patch b/dev-lang/ruby/files/2.5/005_no-undefined-ext.patch
98 new file mode 100644
99 index 00000000000..1f0fdda08da
100 --- /dev/null
101 +++ b/dev-lang/ruby/files/2.5/005_no-undefined-ext.patch
102 @@ -0,0 +1,11 @@
103 +--- a/configure.ac.~1~ 2017-12-15 10:43:40.000000000 +0100
104 ++++ b/configure.ac 2017-12-25 11:02:19.099076831 +0100
105 +@@ -3233,7 +3233,7 @@
106 + [linux* | gnu* | k*bsd*-gnu | netbsd* | bsdi* | kopensolaris*-gnu | haiku*], [
107 + : ${LDSHARED='$(CC) -shared'}
108 + AS_IF([test "$rb_cv_binary_elf" = yes], [
109 +- LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
110 ++ LDFLAGS="$LDFLAGS -Wl,-export-dynamic -Wl,--no-undefined"
111 + ])
112 + rb_cv_dlopen=yes],
113 + [interix*], [ : ${LDSHARED='$(CC) -shared'}
114
115 diff --git a/dev-lang/ruby/files/2.5/009_no-gems.patch b/dev-lang/ruby/files/2.5/009_no-gems.patch
116 new file mode 100644
117 index 00000000000..e12429a4324
118 --- /dev/null
119 +++ b/dev-lang/ruby/files/2.5/009_no-gems.patch
120 @@ -0,0 +1,95 @@
121 +--- a/tool/rbinstall.rb.~1~ 2017-10-30 06:45:20.000000000 +0100
122 ++++ b/tool/rbinstall.rb 2017-12-25 11:06:53.340432435 +0100
123 +@@ -700,20 +700,10 @@
124 + # :startdoc:
125 +
126 + install?(:ext, :comm, :gem, :'default-gems', :'default-gems-comm') do
127 +- install_default_gem('lib', srcdir)
128 ++ # Gems are unbundled in Gentoo
129 + end
130 + install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do
131 +- install_default_gem('ext', srcdir) do |path|
132 +- # assume that gemspec and extconf.rb are placed in the same directory
133 +- success = false
134 +- begin
135 +- IO.foreach(File.dirname(path[(srcdir.size+1)..-1]) + "/Makefile") do |l|
136 +- break success = true if /^TARGET\s*=/ =~ l
137 +- end
138 +- rescue Errno::ENOENT
139 +- end
140 +- success
141 +- end
142 ++ # Gems are unbundled in Gentoo
143 + end
144 +
145 + def load_gemspec(file)
146 +@@ -765,68 +755,7 @@
147 + end
148 +
149 + install?(:ext, :comm, :gem, :'bundled-gems') do
150 +- gem_dir = Gem.default_dir
151 +- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
152 +- prepare "bundled gems", gem_dir, directories
153 +- install_dir = with_destdir(gem_dir)
154 +- installed_gems = {}
155 +- options = {
156 +- :install_dir => install_dir,
157 +- :bin_dir => with_destdir(bindir),
158 +- :domain => :local,
159 +- :ignore_dependencies => true,
160 +- :dir_mode => $dir_mode,
161 +- :data_mode => $data_mode,
162 +- :prog_mode => $prog_mode,
163 +- :wrappers => true,
164 +- :format_executable => true,
165 +- }
166 +- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
167 +- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
168 +- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
169 +- spec = load_gemspec(path)
170 +- next unless spec.platform == Gem::Platform::RUBY
171 +- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
172 +- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
173 +- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
174 +- spec.extensions[0] ||= "-"
175 +- end
176 +- ins = RbInstall::UnpackedInstaller.new(spec, options)
177 +- puts "#{INDENT}#{spec.name} #{spec.version}"
178 +- ins.install
179 +- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
180 +- unless spec.extensions.empty?
181 +- install_recursive(ext, spec.extension_dir)
182 +- end
183 +- installed_gems[spec.full_name] = true
184 +- end
185 +- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
186 +- unless installed_gems.empty?
187 +- install installed_gems, gem_dir+"/cache"
188 +- end
189 +- next if gems.empty?
190 +- if defined?(Zlib)
191 +- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
192 +- silent = Gem::SilentUI.new
193 +- gems.each do |gem|
194 +- inst = Gem::Installer.new(gem, options)
195 +- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
196 +- begin
197 +- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
198 +- rescue Gem::InstallError => e
199 +- next
200 +- end
201 +- gemname = File.basename(gem)
202 +- puts "#{INDENT}#{gemname}"
203 +- end
204 +- # fix directory permissions
205 +- # TODO: Gem.install should accept :dir_mode option or something
206 +- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
207 +- # fix .gemspec permissions
208 +- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
209 +- else
210 +- puts "skip installing bundled gems because of lacking zlib"
211 +- end
212 ++ # Gems are unbundled in Gentoo
213 + end
214 +
215 + parse_args()
216
217 diff --git a/dev-lang/ruby/files/2.5/010-libressl_2.7.patch b/dev-lang/ruby/files/2.5/010-libressl_2.7.patch
218 new file mode 100644
219 index 00000000000..150f43c9e55
220 --- /dev/null
221 +++ b/dev-lang/ruby/files/2.5/010-libressl_2.7.patch
222 @@ -0,0 +1,15 @@
223 +--- a/ext/openssl/extconf.rb.orig 2018-04-02 09:57:14 UTC
224 ++++ b/ext/openssl/extconf.rb
225 +@@ -122,8 +122,11 @@ OpenSSL.check_func_or_macro("SSL_get_ser
226 + have_func("SSL_is_server")
227 +
228 + # added in 1.1.0
229 ++if !have_struct_member("SSL", "ctx", "openssl/ssl.h") ||
230 ++ try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x2070000fL", "openssl/opensslv.h")
231 ++ $defs.push("-DHAVE_OPAQUE_OPENSSL")
232 ++end
233 + have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
234 +-have_struct_member("SSL", "ctx", "openssl/ssl.h") || $defs.push("-DHAVE_OPAQUE_OPENSSL")
235 + have_func("BN_GENCB_new")
236 + have_func("BN_GENCB_free")
237 + have_func("BN_GENCB_get_arg")
238
239 diff --git a/dev-lang/ruby/ruby-2.5.1-r1.ebuild b/dev-lang/ruby/ruby-2.5.1-r1.ebuild
240 new file mode 100644
241 index 00000000000..d5c3f48de2d
242 --- /dev/null
243 +++ b/dev-lang/ruby/ruby-2.5.1-r1.ebuild
244 @@ -0,0 +1,224 @@
245 +# Copyright 1999-2018 Gentoo Foundation
246 +# Distributed under the terms of the GNU General Public License v2
247 +
248 +EAPI=7
249 +
250 +inherit autotools flag-o-matic multilib
251 +
252 +MY_P="${PN}-$(ver_cut 1-3)"
253 +S=${WORKDIR}/${MY_P}
254 +
255 +SLOT=$(ver_cut 1-2)
256 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
257 +RUBYVERSION=${SLOT}.0
258 +
259 +DESCRIPTION="An object-oriented scripting language"
260 +HOMEPAGE="https://www.ruby-lang.org/"
261 +SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.xz"
262 +
263 +LICENSE="|| ( Ruby-BSD BSD-2 )"
264 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
265 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc libressl +rdoc rubytests socks5 ssl static-libs tk xemacs"
266 +
267 +RDEPEND="
268 + berkdb? ( sys-libs/db:= )
269 + gdbm? ( sys-libs/gdbm:= )
270 + jemalloc? ( dev-libs/jemalloc )
271 + ssl? (
272 + !libressl? ( dev-libs/openssl:0= )
273 + libressl? ( dev-libs/libressl )
274 + )
275 + socks5? ( >=net-proxy/dante-1.1.13 )
276 + tk? (
277 + dev-lang/tcl:0=[threads]
278 + dev-lang/tk:0=[threads]
279 + )
280 + dev-libs/libyaml
281 + virtual/libffi
282 + sys-libs/zlib
283 + >=app-eselect/eselect-ruby-20171225
284 +"
285 +
286 +DEPEND="${RDEPEND}"
287 +
288 +BUNDLED_GEMS="
289 + >=dev-ruby/did_you_mean-1.2.0:2.5[ruby_targets_ruby25]
290 + >=dev-ruby/minitest-5.10.3[ruby_targets_ruby25]
291 + >=dev-ruby/net-telnet-0.1.1[ruby_targets_ruby25]
292 + >=dev-ruby/power_assert-1.1.1[ruby_targets_ruby25]
293 + >=dev-ruby/rake-12.3.0[ruby_targets_ruby25]
294 + >=dev-ruby/test-unit-3.2.7[ruby_targets_ruby25]
295 + >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby25]
296 +"
297 +
298 +PDEPEND="
299 + ${BUNDLED_GEMS}
300 + virtual/rubygems[ruby_targets_ruby25]
301 + >=dev-ruby/json-2.0.2[ruby_targets_ruby25]
302 + rdoc? ( >=dev-ruby/rdoc-5.1.0[ruby_targets_ruby25] )
303 + xemacs? ( app-xemacs/ruby-modes )"
304 +
305 +src_prepare() {
306 + eapply "${FILESDIR}"/${SLOT}/*.patch
307 +
308 + einfo "Unbundling gems..."
309 + cd "$S"
310 + # Remove bundled gems that we will install via PDEPEND, bug
311 + # 539700. Use explicit version numbers to ensure rm fails when they
312 + # change so we can update dependencies accordingly.
313 + 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
314 +
315 + einfo "Removing bundled libraries..."
316 + rm -fr ext/fiddle/libffi-3.2.1 || die
317 +
318 + eapply_user
319 +
320 + eautoreconf
321 +}
322 +
323 +src_configure() {
324 + local modules= myconf=
325 +
326 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
327 + filter-flags -fomit-frame-pointer
328 + # In many places aliasing rules are broken; play it safe
329 + # as it's risky with newer compilers to leave it as it is.
330 + append-flags -fno-strict-aliasing
331 + # SuperH needs this
332 + use sh && append-flags -mieee
333 +
334 + # Socks support via dante
335 + if use socks5 ; then
336 + # Socks support can't be disabled as long as SOCKS_SERVER is
337 + # set and socks library is present, so need to unset
338 + # SOCKS_SERVER in that case.
339 + unset SOCKS_SERVER
340 + fi
341 +
342 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
343 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
344 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
345 + fi
346 +
347 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
348 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
349 +
350 + # Determine which modules *not* to build depending in the USE flags.
351 + if ! use berkdb ; then
352 + modules="${modules},dbm"
353 + fi
354 + if ! use gdbm ; then
355 + modules="${modules},gdbm"
356 + fi
357 + if ! use ssl ; then
358 + modules="${modules},openssl"
359 + fi
360 + if ! use tk ; then
361 + modules="${modules},tk"
362 + fi
363 +
364 + # Provide an empty LIBPATHENV because we disable rpath but we do not
365 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
366 + # #564272
367 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
368 + --program-suffix=${MY_SUFFIX} \
369 + --with-soname=ruby${MY_SUFFIX} \
370 + --docdir=${EPREFIX}/usr/share/doc/${P} \
371 + --enable-shared \
372 + --enable-pthread \
373 + --disable-rpath \
374 + --with-out-ext="${modules}" \
375 + $(use_with jemalloc jemalloc) \
376 + $(use_enable socks5 socks) \
377 + $(use_enable doc install-doc) \
378 + --enable-ipv6 \
379 + $(use_enable static-libs static) \
380 + $(use_enable static-libs install-static-library) \
381 + $(use_with static-libs static-linked-ext) \
382 + $(use_enable debug) \
383 + ${myconf} \
384 + --enable-option-checking=no \
385 + || die "econf failed"
386 +}
387 +
388 +src_compile() {
389 + emake V=1 EXTLDFLAGS="${LDFLAGS}" || die "emake failed"
390 +}
391 +
392 +src_test() {
393 + emake -j1 V=1 test || die "make test failed"
394 +
395 + elog "Ruby's make test has been run. Ruby also ships with a make check"
396 + elog "that cannot be run until after ruby has been installed."
397 + elog
398 + if use rubytests; then
399 + elog "You have enabled rubytests, so they will be installed to"
400 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
401 + elog "than root, and you must place them into a writeable directory."
402 + elog "Then call: "
403 + elog
404 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
405 + else
406 + elog "Enable the rubytests USE flag to install the make check tests"
407 + fi
408 +}
409 +
410 +src_install() {
411 + # Remove the remaining bundled gems. We do this late in the process
412 + # since they are used during the build to e.g. create the
413 + # documentation.
414 + rm -rf ext/json || die
415 +
416 + # Ruby is involved in the install process, we don't want interference here.
417 + unset RUBYOPT
418 +
419 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
420 +
421 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
422 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
423 + for d in $(find "${S}/ext" -type d) ; do
424 + RUBYLIB="${RUBYLIB}:$d"
425 + done
426 + export LD_LIBRARY_PATH RUBYLIB
427 +
428 + emake V=1 DESTDIR="${D}" install || die "make install failed"
429 +
430 + # Remove installed rubygems and rdoc copy
431 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
432 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
433 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
434 + rm -rf "${ED}/usr/bin/"{ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
435 +
436 + if use doc; then
437 + make DESTDIR="${D}" install-doc || die "make install-doc failed"
438 + fi
439 +
440 + if use examples; then
441 + insinto /usr/share/doc/${PF}
442 + doins -r sample
443 + fi
444 +
445 + dodoc ChangeLog NEWS doc/NEWS* README* || die
446 +
447 + if use rubytests; then
448 + pushd test
449 + insinto /usr/share/${PN}-${SLOT}/test
450 + doins -r .
451 + popd
452 + fi
453 +}
454 +
455 +pkg_postinst() {
456 + if [[ ! -n $(readlink "${EROOT}"usr/bin/ruby) ]] ; then
457 + eselect ruby set ruby${MY_SUFFIX}
458 + fi
459 +
460 + elog
461 + elog "To switch between available Ruby profiles, execute as root:"
462 + elog "\teselect ruby set ruby(23|24|...)"
463 + elog
464 +}
465 +
466 +pkg_postrm() {
467 + eselect ruby cleanup
468 +}