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/2.6/
Date: Thu, 27 Dec 2018 19:06:47
Message-Id: 1545937593.6e2686448ec8ff2355fecee39426a20bac4cb61f.graaff@gentoo
1 commit: 6e2686448ec8ff2355fecee39426a20bac4cb61f
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 27 18:21:12 2018 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 27 19:06:33 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e268644
7
8 dev-lang/ruby: fix various install issues
9
10 Properly unbundle rdoc and bundler which we install via the gems.
11 Fix install path for default bundled gemspec, fixing file collisions
12 without FEATURES=userpriv.
13 Add USE flag for jit, but note that this does not fully disable jit, and
14 jit does not work due to issues with the .pch file generated for it.
15 Add missing PDEPEND on bundler since we now unbundle it properly.
16
17 Fixes: https://bugs.gentoo.org/673760
18 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
19 Package-Manager: Portage-2.3.51, Repoman-2.3.11
20
21 dev-lang/ruby/files/2.6/009_no-gems.patch | 88 ++-------
22 dev-lang/ruby/files/2.6/010-libressl_2.7.patch | 15 --
23 dev-lang/ruby/ruby-2.6.0-r1.ebuild | 236 +++++++++++++++++++++++++
24 3 files changed, 252 insertions(+), 87 deletions(-)
25
26 diff --git a/dev-lang/ruby/files/2.6/009_no-gems.patch b/dev-lang/ruby/files/2.6/009_no-gems.patch
27 index e12429a4324..f98801d5031 100644
28 --- a/dev-lang/ruby/files/2.6/009_no-gems.patch
29 +++ b/dev-lang/ruby/files/2.6/009_no-gems.patch
30 @@ -1,12 +1,8 @@
31 ---- a/tool/rbinstall.rb.~1~ 2017-10-30 06:45:20.000000000 +0100
32 -+++ b/tool/rbinstall.rb 2017-12-25 11:06:53.340432435 +0100
33 -@@ -700,20 +700,10 @@
34 +--- a/tool/rbinstall.rb.~1~ 2018-12-27 07:43:59.938638174 +0100
35 ++++ b/tool/rbinstall.rb 2018-12-27 07:51:09.096382161 +0100
36 +@@ -723,17 +723,7 @@
37 # :startdoc:
38
39 - install?(:ext, :comm, :gem, :'default-gems', :'default-gems-comm') do
40 -- install_default_gem('lib', srcdir)
41 -+ # Gems are unbundled in Gentoo
42 - end
43 install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do
44 - install_default_gem('ext', srcdir) do |path|
45 - # assume that gemspec and extconf.rb are placed in the same directory
46 @@ -23,73 +19,21 @@
47 end
48
49 def load_gemspec(file)
50 -@@ -765,68 +755,7 @@
51 +@@ -743,7 +743,7 @@
52 end
53
54 - install?(:ext, :comm, :gem, :'bundled-gems') do
55 + def install_default_gem(dir, srcdir)
56 - gem_dir = Gem.default_dir
57 -- directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
58 -- prepare "bundled gems", gem_dir, directories
59 -- install_dir = with_destdir(gem_dir)
60 -- installed_gems = {}
61 -- options = {
62 -- :install_dir => install_dir,
63 -- :bin_dir => with_destdir(bindir),
64 -- :domain => :local,
65 -- :ignore_dependencies => true,
66 -- :dir_mode => $dir_mode,
67 -- :data_mode => $data_mode,
68 -- :prog_mode => $prog_mode,
69 -- :wrappers => true,
70 -- :format_executable => true,
71 -- }
72 -- gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
73 -- extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
74 -- Gem::Specification.each_gemspec([srcdir+'/gems/*']) do |path|
75 -- spec = load_gemspec(path)
76 -- next unless spec.platform == Gem::Platform::RUBY
77 -- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
78 -- spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
79 -- if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
80 -- spec.extensions[0] ||= "-"
81 -- end
82 -- ins = RbInstall::UnpackedInstaller.new(spec, options)
83 -- puts "#{INDENT}#{spec.name} #{spec.version}"
84 -- ins.install
85 -- File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
86 -- unless spec.extensions.empty?
87 -- install_recursive(ext, spec.extension_dir)
88 -- end
89 -- installed_gems[spec.full_name] = true
90 -- end
91 -- installed_gems, gems = Dir.glob(srcdir+'/gems/*.gem').partition {|gem| installed_gems.key?(File.basename(gem, '.gem'))}
92 -- unless installed_gems.empty?
93 -- install installed_gems, gem_dir+"/cache"
94 -- end
95 -- next if gems.empty?
96 -- if defined?(Zlib)
97 -- Gem.instance_variable_set(:@ruby, with_destdir(File.join(bindir, ruby_install_name)))
98 -- silent = Gem::SilentUI.new
99 -- gems.each do |gem|
100 -- inst = Gem::Installer.new(gem, options)
101 -- inst.spec.extension_dir = with_destdir(inst.spec.extension_dir)
102 -- begin
103 -- Gem::DefaultUserInteraction.use_ui(silent) {inst.install}
104 -- rescue Gem::InstallError => e
105 -- next
106 -- end
107 -- gemname = File.basename(gem)
108 -- puts "#{INDENT}#{gemname}"
109 -- end
110 -- # fix directory permissions
111 -- # TODO: Gem.install should accept :dir_mode option or something
112 -- File.chmod($dir_mode, *Dir.glob(install_dir+"/**/"))
113 -- # fix .gemspec permissions
114 -- File.chmod($data_mode, *Dir.glob(install_dir+"/specifications/*.gemspec"))
115 -- else
116 -- puts "skip installing bundled gems because of lacking zlib"
117 -- end
118 -+ # Gems are unbundled in Gentoo
119 ++ gem_dir = ENV['GEM_DESTDIR'] ; puts "gem_dir for default gems = #{gem_dir}"
120 + directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
121 + prepare "default gems from #{dir}", gem_dir, directories
122 +
123 +@@ -777,7 +777,7 @@
124 end
125
126 - parse_args()
127 + install?(:ext, :comm, :gem, :'bundled-gems') do
128 +- gem_dir = Gem.default_dir
129 ++ gem_dir = ENV['GEM_DESTDIR']
130 + directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
131 + prepare "bundled gems", gem_dir, directories
132 + install_dir = with_destdir(gem_dir)
133
134 diff --git a/dev-lang/ruby/files/2.6/010-libressl_2.7.patch b/dev-lang/ruby/files/2.6/010-libressl_2.7.patch
135 deleted file mode 100644
136 index 150f43c9e55..00000000000
137 --- a/dev-lang/ruby/files/2.6/010-libressl_2.7.patch
138 +++ /dev/null
139 @@ -1,15 +0,0 @@
140 ---- a/ext/openssl/extconf.rb.orig 2018-04-02 09:57:14 UTC
141 -+++ b/ext/openssl/extconf.rb
142 -@@ -122,8 +122,11 @@ OpenSSL.check_func_or_macro("SSL_get_ser
143 - have_func("SSL_is_server")
144 -
145 - # added in 1.1.0
146 -+if !have_struct_member("SSL", "ctx", "openssl/ssl.h") ||
147 -+ try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x2070000fL", "openssl/opensslv.h")
148 -+ $defs.push("-DHAVE_OPAQUE_OPENSSL")
149 -+end
150 - have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
151 --have_struct_member("SSL", "ctx", "openssl/ssl.h") || $defs.push("-DHAVE_OPAQUE_OPENSSL")
152 - have_func("BN_GENCB_new")
153 - have_func("BN_GENCB_free")
154 - have_func("BN_GENCB_get_arg")
155
156 diff --git a/dev-lang/ruby/ruby-2.6.0-r1.ebuild b/dev-lang/ruby/ruby-2.6.0-r1.ebuild
157 new file mode 100644
158 index 00000000000..ccaa7a4cae2
159 --- /dev/null
160 +++ b/dev-lang/ruby/ruby-2.6.0-r1.ebuild
161 @@ -0,0 +1,236 @@
162 +# Copyright 1999-2018 Gentoo Authors
163 +# Distributed under the terms of the GNU General Public License v2
164 +
165 +EAPI=7
166 +
167 +inherit autotools flag-o-matic multilib
168 +
169 +MY_P="${PN}-$(ver_cut 1-3)"
170 +S=${WORKDIR}/${MY_P}
171 +
172 +SLOT=$(ver_cut 1-2)
173 +MY_SUFFIX=$(ver_rs 1 '' ${SLOT})
174 +RUBYVERSION=${SLOT}.0
175 +
176 +DESCRIPTION="An object-oriented scripting language"
177 +HOMEPAGE="https://www.ruby-lang.org/"
178 +SRC_URI="mirror://ruby/${SLOT}/${MY_P}.tar.xz"
179 +
180 +LICENSE="|| ( Ruby-BSD BSD-2 )"
181 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
182 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit libressl +rdoc rubytests socks5 +ssl static-libs tk xemacs"
183 +
184 +RDEPEND="
185 + berkdb? ( sys-libs/db:= )
186 + gdbm? ( sys-libs/gdbm:= )
187 + jemalloc? ( dev-libs/jemalloc )
188 + jit? ( || ( sys-devel/gcc:* sys-devel/clang:* ) )
189 + ssl? (
190 + !libressl? ( dev-libs/openssl:0= )
191 + libressl? ( dev-libs/libressl )
192 + )
193 + socks5? ( >=net-proxy/dante-1.1.13 )
194 + tk? (
195 + dev-lang/tcl:0=[threads]
196 + dev-lang/tk:0=[threads]
197 + )
198 + dev-libs/libyaml
199 + virtual/libffi:=
200 + sys-libs/zlib
201 + >=app-eselect/eselect-ruby-20171225
202 +"
203 +
204 +DEPEND="${RDEPEND}"
205 +
206 +BUNDLED_GEMS="
207 + >=dev-ruby/did_you_mean-1.2.1[ruby_targets_ruby26]
208 + >=dev-ruby/minitest-5.11.3[ruby_targets_ruby26]
209 + >=dev-ruby/net-telnet-0.2.0[ruby_targets_ruby26]
210 + >=dev-ruby/power_assert-1.1.3[ruby_targets_ruby26]
211 + >=dev-ruby/rake-12.3.2[ruby_targets_ruby26]
212 + >=dev-ruby/test-unit-3.2.9[ruby_targets_ruby26]
213 + >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby26]
214 +"
215 +
216 +PDEPEND="
217 + ${BUNDLED_GEMS}
218 + virtual/rubygems[ruby_targets_ruby26]
219 + >=dev-ruby/bundler-1.17.2[ruby_targets_ruby26]
220 + >=dev-ruby/json-2.0.2[ruby_targets_ruby26]
221 + rdoc? ( >=dev-ruby/rdoc-5.1.0[ruby_targets_ruby26] )
222 + xemacs? ( app-xemacs/ruby-modes )"
223 +
224 +src_prepare() {
225 + # 005 does not compile bigdecimal and is questionable because it
226 + # compiles ruby in a non-standard way, may be dropped
227 + eapply "${FILESDIR}"/2.6/009*.patch
228 +
229 + einfo "Unbundling gems..."
230 + cd "$S"
231 + # Remove bundled gems that we will install via PDEPEND, bug
232 + # 539700.
233 + rm -fr gems/* || die
234 +
235 + einfo "Removing bundled libraries..."
236 + rm -fr ext/fiddle/libffi-3.2.1 || die
237 +
238 + eapply_user
239 +
240 + eautoreconf
241 +}
242 +
243 +src_configure() {
244 + local modules= myconf=
245 +
246 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
247 + filter-flags -fomit-frame-pointer
248 + # In many places aliasing rules are broken; play it safe
249 + # as it's risky with newer compilers to leave it as it is.
250 + append-flags -fno-strict-aliasing
251 + # SuperH needs this
252 + use sh && append-flags -mieee
253 +
254 + # Socks support via dante
255 + if use socks5 ; then
256 + # Socks support can't be disabled as long as SOCKS_SERVER is
257 + # set and socks library is present, so need to unset
258 + # SOCKS_SERVER in that case.
259 + unset SOCKS_SERVER
260 + fi
261 +
262 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
263 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
264 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
265 + fi
266 +
267 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
268 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
269 +
270 + # Determine which modules *not* to build depending in the USE flags.
271 + if ! use berkdb ; then
272 + modules="${modules},dbm"
273 + fi
274 + if ! use gdbm ; then
275 + modules="${modules},gdbm"
276 + fi
277 + if ! use ssl ; then
278 + modules="${modules},openssl"
279 + fi
280 + if ! use tk ; then
281 + modules="${modules},tk"
282 + fi
283 +
284 + # Provide an empty LIBPATHENV because we disable rpath but we do not
285 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
286 + # #564272
287 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
288 + --program-suffix=${MY_SUFFIX} \
289 + --with-soname=ruby${MY_SUFFIX} \
290 + --docdir=${EPREFIX}/usr/share/doc/${P} \
291 + --enable-shared \
292 + --enable-pthread \
293 + --disable-rpath \
294 + --with-out-ext="${modules}" \
295 + $(use_with jemalloc jemalloc) \
296 + $(use_enable jit jit-support ) \
297 + $(use_enable socks5 socks) \
298 + $(use_enable doc install-doc) \
299 + --enable-ipv6 \
300 + $(use_enable static-libs static) \
301 + $(use_enable static-libs install-static-library) \
302 + $(use_with static-libs static-linked-ext) \
303 + $(use_enable debug) \
304 + ${myconf} \
305 + --enable-option-checking=no \
306 + || die "econf failed"
307 +
308 + # Makefile is broken because it lacks -ldl
309 + rm -rf ext/-test-/popen_deadlock || die
310 +}
311 +
312 +src_compile() {
313 + emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS="" || die "emake failed"
314 +}
315 +
316 +src_test() {
317 + emake -j1 V=1 test || die "make test failed"
318 +
319 + elog "Ruby's make test has been run. Ruby also ships with a make check"
320 + elog "that cannot be run until after ruby has been installed."
321 + elog
322 + if use rubytests; then
323 + elog "You have enabled rubytests, so they will be installed to"
324 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
325 + elog "than root, and you must place them into a writeable directory."
326 + elog "Then call: "
327 + elog
328 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
329 + else
330 + elog "Enable the rubytests USE flag to install the make check tests"
331 + fi
332 +}
333 +
334 +src_install() {
335 + # Remove the remaining bundled gems. We do this late in the process
336 + # since they are used during the build to e.g. create the
337 + # documentation.
338 + rm -rf ext/json || die
339 + rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || die
340 +
341 + # Ruby is involved in the install process, we don't want interference here.
342 + unset RUBYOPT
343 +
344 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
345 +
346 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
347 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
348 + for d in $(find "${S}/ext" -type d) ; do
349 + RUBYLIB="${RUBYLIB}:$d"
350 + done
351 + export LD_LIBRARY_PATH RUBYLIB
352 +
353 + # Create directory for the default gems
354 + local gem_home="/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}"
355 + mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed"
356 +
357 + emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install || die "make install failed"
358 +
359 + # Remove installed rubygems and rdoc copy
360 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
361 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
362 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
363 + rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
364 +
365 + if use doc; then
366 + emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc || die "make install-doc failed"
367 + fi
368 +
369 + if use examples; then
370 + insinto /usr/share/doc/${PF}
371 + doins -r sample
372 + fi
373 +
374 + dodoc ChangeLog NEWS doc/NEWS* README* || die
375 +
376 + if use rubytests; then
377 + pushd test
378 + insinto /usr/share/${PN}-${SLOT}/test
379 + doins -r .
380 + popd
381 + fi
382 +}
383 +
384 +pkg_postinst() {
385 + if [[ ! -n $(readlink "${EROOT}"usr/bin/ruby) ]] ; then
386 + eselect ruby set ruby${MY_SUFFIX}
387 + fi
388 +
389 + elog
390 + elog "To switch between available Ruby profiles, execute as root:"
391 + elog "\teselect ruby set ruby(23|24|...)"
392 + elog
393 +}
394 +
395 +pkg_postrm() {
396 + eselect ruby cleanup
397 +}