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.7/
Date: Thu, 26 Dec 2019 11:06:05
Message-Id: 1577358350.b50ab6e68f8b771dd06f0b473d24b490abed2d51.graaff@gentoo
1 commit: b50ab6e68f8b771dd06f0b473d24b490abed2d51
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 26 09:40:34 2019 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 26 11:05:50 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b50ab6e6
7
8 dev-lang/ruby: add ruby 2.7
9
10 Package-Manager: Portage-2.3.79, Repoman-2.3.16
11 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
12
13 dev-lang/ruby/Manifest | 1 +
14 .../ruby/files/2.7/010-default-gem-location.patch | 20 ++
15 dev-lang/ruby/ruby-2.7.0.ebuild | 238 +++++++++++++++++++++
16 3 files changed, 259 insertions(+)
17
18 diff --git a/dev-lang/ruby/Manifest b/dev-lang/ruby/Manifest
19 index cb24cfa0976..b61365d960f 100644
20 --- a/dev-lang/ruby/Manifest
21 +++ b/dev-lang/ruby/Manifest
22 @@ -1,3 +1,4 @@
23 DIST ruby-2.4.9.tar.xz 10078316 BLAKE2B ad83adf6b884a9a36e83cc754077f706afa221a9e8b81d92f6b6a1b829dc0350bdacd67b0b4e1e196a17e3f7d1c65f1e9b38e245aeddf089576eaca7d051701b SHA512 9046575315c29c789427c2d00c832f0c0970e47fd158bbe8e4f2df5cff2ea9c06c65c3493adb4656e5b32ebfdc546092911f98a8ad7f698bc001c290db5888c7
24 DIST ruby-2.5.7.tar.xz 11296440 BLAKE2B 6f3590f30c7b196145a83490abed24b0059521374a03086646186b20670bfed548ea744c910c8eda0d11607d8673644d7fb23ff9091dd2f6dfcbc43080fe0f97 SHA512 63b7c75fab44cd1bd22f22ddec00c740cf379ac7240da0dfafcec54347766695faef47428ce1c433fd77fa96992e976c984697067fa526236d383b12adc9ce75
25 DIST ruby-2.6.5.tar.xz 11553580 BLAKE2B 07739a92ff17467fe6d31bb4dce56ae35fd9c67bb697ebc00b4845474c75d8377c77916e6e129512cfffcf76bd60e6327e818e899b6160f3222912654d5eb118 SHA512 e8ae3b5d4d23a93d0ef6057235ad0e573665a8b4b6544e1c70b4cce9c4d2fb9094e5c8fe8a9ab7b9996efe3ada603f9b4ef1fd08fb5a83253c1ae2b5e3f202db
26 +DIST ruby-2.7.0.tar.xz 11990900 BLAKE2B 0f4969780618979190a92ca317963f825d854ecb437e7031cb7848b04bc9cb9532145968e33f5b8022449bccd1b0828b87a0ed0c0a09b182e2484d0811975a0d SHA512 dd5690c631bf3a2b76cdc06902bcd76a89713a045e136debab9b8a81ff8c433bbb254aa09e4014ca1cf85a69ff4bcb13de11da5e40c224e7268be43ef2194af7
27
28 diff --git a/dev-lang/ruby/files/2.7/010-default-gem-location.patch b/dev-lang/ruby/files/2.7/010-default-gem-location.patch
29 new file mode 100644
30 index 00000000000..7a50c35ff6c
31 --- /dev/null
32 +++ b/dev-lang/ruby/files/2.7/010-default-gem-location.patch
33 @@ -0,0 +1,20 @@
34 +--- a/tool/rbinstall.rb.~1~ 2019-01-24 02:00:07.000000000 +0100
35 ++++ b/tool/rbinstall.rb 2019-02-03 08:39:49.778007118 +0100
36 +@@ -806,7 +806,7 @@
37 + end
38 +
39 + def install_default_gem(dir, srcdir)
40 +- gem_dir = Gem.default_dir
41 ++ gem_dir = ENV['GEM_DESTDIR']
42 + directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
43 + prepare "default gems from #{dir}", gem_dir, directories
44 +
45 +@@ -844,7 +844,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 + directories = Gem.ensure_gem_subdirectories(gem_dir, :mode => $dir_mode)
52 + prepare "bundled gems", gem_dir, directories
53 + install_dir = with_destdir(gem_dir)
54
55 diff --git a/dev-lang/ruby/ruby-2.7.0.ebuild b/dev-lang/ruby/ruby-2.7.0.ebuild
56 new file mode 100644
57 index 00000000000..4d60f09d1e3
58 --- /dev/null
59 +++ b/dev-lang/ruby/ruby-2.7.0.ebuild
60 @@ -0,0 +1,238 @@
61 +# Copyright 1999-2019 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 ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
81 +IUSE="berkdb debug doc examples gdbm ipv6 jemalloc jit libressl +rdoc rubytests socks5 +ssl static-libs 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 + tk? (
94 + dev-lang/tcl:0=[threads]
95 + dev-lang/tk:0=[threads]
96 + )
97 + dev-libs/libyaml
98 + virtual/libffi:=
99 + sys-libs/readline:0=
100 + sys-libs/zlib
101 + >=app-eselect/eselect-ruby-20171225
102 +"
103 +
104 +DEPEND="${RDEPEND}"
105 +
106 +BUNDLED_GEMS="
107 + >=dev-ruby/minitest-5.13.0[ruby_targets_ruby27]
108 + >=dev-ruby/net-telnet-0.2.0[ruby_targets_ruby27]
109 + >=dev-ruby/power_assert-1.1.5[ruby_targets_ruby27]
110 + >=dev-ruby/rake-13.0.1[ruby_targets_ruby27]
111 + >=dev-ruby/test-unit-3.3.4[ruby_targets_ruby27]
112 + >=dev-ruby/xmlrpc-0.3.0[ruby_targets_ruby27]
113 +"
114 +
115 +PDEPEND="
116 + ${BUNDLED_GEMS}
117 + virtual/rubygems[ruby_targets_ruby27]
118 + >=dev-ruby/bundler-2.1.0[ruby_targets_ruby27]
119 + >=dev-ruby/did_you_mean-1.3.1[ruby_targets_ruby27]
120 + >=dev-ruby/json-2.0.2[ruby_targets_ruby27]
121 + rdoc? ( >=dev-ruby/rdoc-6.1.2[ruby_targets_ruby27] )
122 + xemacs? ( app-xemacs/ruby-modes )"
123 +
124 +src_prepare() {
125 + # 005 does not compile bigdecimal and is questionable because it
126 + # compiles ruby in a non-standard way, may be dropped
127 + eapply "${FILESDIR}"/2.7/010*.patch
128 +
129 + einfo "Unbundling gems..."
130 + cd "$S"
131 + # Remove bundled gems that we will install via PDEPEND, bug
132 + # 539700.
133 + rm -fr gems/* || die
134 + # Don't install CLI tools since they will clash with the gem
135 + rm -f bin/{racc,racc2y,y2racc} || die
136 + sed -i -e '/executables/ s:^:#:' lib/racc/racc.gemspec || die
137 +
138 + einfo "Removing bundled libraries..."
139 + rm -fr ext/fiddle/libffi-3.2.1 || die
140 +
141 + eapply_user
142 +
143 + eautoreconf
144 +}
145 +
146 +src_configure() {
147 + local modules= myconf=
148 +
149 + # -fomit-frame-pointer makes ruby segfault, see bug #150413.
150 + filter-flags -fomit-frame-pointer
151 + # In many places aliasing rules are broken; play it safe
152 + # as it's risky with newer compilers to leave it as it is.
153 + append-flags -fno-strict-aliasing
154 + # SuperH needs this
155 + use sh && append-flags -mieee
156 +
157 + # Socks support via dante
158 + if use socks5 ; then
159 + # Socks support can't be disabled as long as SOCKS_SERVER is
160 + # set and socks library is present, so need to unset
161 + # SOCKS_SERVER in that case.
162 + unset SOCKS_SERVER
163 + fi
164 +
165 + # Increase GC_MALLOC_LIMIT if set (default is 8000000)
166 + if [ -n "${RUBY_GC_MALLOC_LIMIT}" ] ; then
167 + append-flags "-DGC_MALLOC_LIMIT=${RUBY_GC_MALLOC_LIMIT}"
168 + fi
169 +
170 + # ipv6 hack, bug 168939. Needs --enable-ipv6.
171 + use ipv6 || myconf="${myconf} --with-lookup-order-hack=INET"
172 +
173 + # Determine which modules *not* to build depending in the USE flags.
174 + if ! use berkdb ; then
175 + modules="${modules},dbm"
176 + fi
177 + if ! use gdbm ; then
178 + modules="${modules},gdbm"
179 + fi
180 + if ! use ssl ; then
181 + modules="${modules},openssl"
182 + fi
183 + if ! use tk ; then
184 + modules="${modules},tk"
185 + fi
186 +
187 + # Provide an empty LIBPATHENV because we disable rpath but we do not
188 + # need LD_LIBRARY_PATH by default since that breaks USE=multitarget
189 + # #564272
190 + INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
191 + --program-suffix=${MY_SUFFIX} \
192 + --with-soname=ruby${MY_SUFFIX} \
193 + --docdir=${EPREFIX}/usr/share/doc/${P} \
194 + --enable-shared \
195 + --enable-pthread \
196 + --disable-rpath \
197 + --with-out-ext="${modules}" \
198 + $(use_with jemalloc jemalloc) \
199 + $(use_enable jit jit-support ) \
200 + $(use_enable socks5 socks) \
201 + $(use_enable doc install-doc) \
202 + --enable-ipv6 \
203 + $(use_enable static-libs static) \
204 + $(use_enable static-libs install-static-library) \
205 + $(use_with static-libs static-linked-ext) \
206 + $(use_enable debug) \
207 + ${myconf} \
208 + --enable-option-checking=no
209 +
210 + # Makefile is broken because it lacks -ldl
211 + rm -rf ext/-test-/popen_deadlock || die
212 +}
213 +
214 +src_compile() {
215 + emake V=1 EXTLDFLAGS="${LDFLAGS}" MJIT_CFLAGS="${CFLAGS}" MJIT_OPTFLAGS="" MJIT_DEBUGFLAGS=""
216 +}
217 +
218 +src_test() {
219 + emake -j1 V=1 test
220 +
221 + elog "Ruby's make test has been run. Ruby also ships with a make check"
222 + elog "that cannot be run until after ruby has been installed."
223 + elog
224 + if use rubytests; then
225 + elog "You have enabled rubytests, so they will be installed to"
226 + elog "/usr/share/${PN}-${SLOT}/test. To run them you must be a user other"
227 + elog "than root, and you must place them into a writeable directory."
228 + elog "Then call: "
229 + elog
230 + elog "ruby${MY_SUFFIX} -C /location/of/tests runner.rb"
231 + else
232 + elog "Enable the rubytests USE flag to install the make check tests"
233 + fi
234 +}
235 +
236 +src_install() {
237 + # Remove the remaining bundled gems. We do this late in the process
238 + # since they are used during the build to e.g. create the
239 + # documentation.
240 + rm -rf ext/json || die
241 + rm -rf lib/bundler* lib/rdoc/rdoc.gemspec || die
242 +
243 + # Ruby is involved in the install process, we don't want interference here.
244 + unset RUBYOPT
245 +
246 + local MINIRUBY=$(echo -e 'include Makefile\ngetminiruby:\n\t@echo $(MINIRUBY)'|make -f - getminiruby)
247 +
248 + LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
249 + RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
250 + for d in $(find "${S}/ext" -type d) ; do
251 + RUBYLIB="${RUBYLIB}:$d"
252 + done
253 + export LD_LIBRARY_PATH RUBYLIB
254 +
255 + # Create directory for the default gems
256 + local gem_home="${EPREFIX}/usr/$(get_libdir)/ruby/gems/${RUBYVERSION}"
257 + mkdir -p "${D}/${gem_home}" || die "mkdir gem home failed"
258 +
259 + emake V=1 DESTDIR="${D}" GEM_DESTDIR=${gem_home} install
260 +
261 + # Remove installed rubygems and rdoc copy
262 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}/rubygems" || die "rm rubygems failed"
263 + rm -rf "${ED}/usr/bin/"gem"${MY_SUFFIX}" || die "rm rdoc bins failed"
264 + rm -rf "${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"/rdoc* || die "rm rdoc failed"
265 + rm -rf "${ED}/usr/bin/"{bundle,bundler,ri,rdoc}"${MY_SUFFIX}" || die "rm rdoc bins failed"
266 +
267 + if use doc; then
268 + emake DESTDIR="${D}" GEM_DESTDIR=${gem_home} install-doc
269 + fi
270 +
271 + if use examples; then
272 + dodoc -r sample
273 + fi
274 +
275 + dodoc ChangeLog NEWS doc/NEWS* README*
276 +
277 + if use rubytests; then
278 + pushd test
279 + insinto /usr/share/${PN}-${SLOT}/test
280 + doins -r .
281 + popd
282 + fi
283 +}
284 +
285 +pkg_postinst() {
286 + if [[ ! -n $(readlink "${EROOT}"/usr/bin/ruby) ]] ; then
287 + eselect ruby set ruby${MY_SUFFIX}
288 + fi
289 +
290 + elog
291 + elog "To switch between available Ruby profiles, execute as root:"
292 + elog "\teselect ruby set ruby(23|24|...)"
293 + elog
294 +}
295 +
296 +pkg_postrm() {
297 + eselect ruby cleanup
298 +}