1 |
commit: 87dc62a1354d5b1c582c7964f011688ae55d02ad |
2 |
Author: Hans de Graaff <hans <AT> degraaff <DOT> org> |
3 |
AuthorDate: Sun May 31 05:58:31 2015 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun May 31 05:58:31 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/ruby-overlay.git/commit/?id=87dc62a1 |
7 |
|
8 |
Moved to gentoo repository. |
9 |
|
10 |
eclass/ruby-ng.eclass | 724 ---------------------------------------------- |
11 |
eclass/ruby-single.eclass | 77 ----- |
12 |
eclass/ruby-utils.eclass | 91 ------ |
13 |
3 files changed, 892 deletions(-) |
14 |
|
15 |
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass |
16 |
deleted file mode 100644 |
17 |
index a06fcd4..0000000 |
18 |
--- a/eclass/ruby-ng.eclass |
19 |
+++ /dev/null |
20 |
@@ -1,724 +0,0 @@ |
21 |
-# Copyright 1999-2014 Gentoo Foundation |
22 |
-# Distributed under the terms of the GNU General Public License v2 |
23 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.54 2014/01/16 07:57:40 graaff Exp $ |
24 |
- |
25 |
-# @ECLASS: ruby-ng.eclass |
26 |
-# @MAINTAINER: |
27 |
-# Ruby herd <ruby@g.o> |
28 |
-# @AUTHOR: |
29 |
-# Author: Diego E. Pettenò <flameeyes@g.o> |
30 |
-# Author: Alex Legler <a3li@g.o> |
31 |
-# Author: Hans de Graaff <graaff@g.o> |
32 |
-# @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots. |
33 |
-# @DESCRIPTION: |
34 |
-# The Ruby eclass is designed to allow an easier installation of Ruby packages |
35 |
-# and their incorporation into the Gentoo Linux system. |
36 |
-# |
37 |
-# Currently available targets are: |
38 |
-# * ruby18 - Ruby (MRI) 1.8.x |
39 |
-# * ruby19 - Ruby (MRI) 1.9.x |
40 |
-# * ruby20 - Ruby (MRI) 2.0.x |
41 |
-# * ruby21 - Ruby (MRI) 2.1.x |
42 |
-# * ruby22 - Ruby (MRI) 2.2.x |
43 |
-# * ree18 - Ruby Enterprise Edition 1.8.x |
44 |
-# * jruby - JRuby |
45 |
-# * rbx - Rubinius |
46 |
-# |
47 |
-# This eclass does not define the implementation of the configure, |
48 |
-# compile, test, or install phases. Instead, the default phases are |
49 |
-# used. Specific implementations of these phases can be provided in |
50 |
-# the ebuild either to be run for each Ruby implementation, or for all |
51 |
-# Ruby implementations, as follows: |
52 |
-# |
53 |
-# * each_ruby_configure |
54 |
-# * all_ruby_configure |
55 |
- |
56 |
-# @ECLASS-VARIABLE: USE_RUBY |
57 |
-# @DEFAULT_UNSET |
58 |
-# @REQUIRED |
59 |
-# @DESCRIPTION: |
60 |
-# This variable contains a space separated list of targets (see above) a package |
61 |
-# is compatible to. It must be set before the `inherit' call. There is no |
62 |
-# default. All ebuilds are expected to set this variable. |
63 |
- |
64 |
-# @ECLASS-VARIABLE: RUBY_PATCHES |
65 |
-# @DEFAULT_UNSET |
66 |
-# @DESCRIPTION: |
67 |
-# A String or Array of filenames of patches to apply to all implementations. |
68 |
- |
69 |
-# @ECLASS-VARIABLE: RUBY_OPTIONAL |
70 |
-# @DESCRIPTION: |
71 |
-# Set the value to "yes" to make the dependency on a Ruby interpreter |
72 |
-# optional and then ruby_implementations_depend() to help populate |
73 |
-# DEPEND and RDEPEND. |
74 |
- |
75 |
-# @ECLASS-VARIABLE: RUBY_S |
76 |
-# @DEFAULT_UNSET |
77 |
-# @DESCRIPTION: |
78 |
-# If defined this variable determines the source directory name after |
79 |
-# unpacking. This defaults to the name of the package. Note that this |
80 |
-# variable supports a wildcard mechanism to help with github tarballs |
81 |
-# that contain the commit hash as part of the directory name. |
82 |
- |
83 |
-# @ECLASS-VARIABLE: RUBY_QA_ALLOWED_LIBS |
84 |
-# @DEFAULT_UNSET |
85 |
-# @DESCRIPTION: |
86 |
-# If defined this variable contains a whitelist of shared objects that |
87 |
-# are allowed to exist even if they don't link to libruby. This avoids |
88 |
-# the QA check that makes this mandatory. This is most likely not what |
89 |
-# you are looking for if you get the related "Missing links" QA warning, |
90 |
-# since the proper fix is almost always to make sure the shared object |
91 |
-# is linked against libruby. There are cases were this is not the case |
92 |
-# and the shared object is generic code to be used in some other way |
93 |
-# (e.g. selenium's firefox driver extension). When set this argument is |
94 |
-# passed to "grep -E" to remove reporting of these shared objects. |
95 |
- |
96 |
-inherit eutils java-utils-2 multilib toolchain-funcs ruby-utils |
97 |
- |
98 |
-EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup |
99 |
- |
100 |
-case ${EAPI} in |
101 |
- 0|1) |
102 |
- die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
103 |
- 2|3) ;; |
104 |
- 4|5) |
105 |
- # S is no longer automatically assigned when it doesn't exist. |
106 |
- S="${WORKDIR}" |
107 |
- ;; |
108 |
- *) |
109 |
- die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
110 |
-esac |
111 |
- |
112 |
-# @FUNCTION: ruby_implementation_depend |
113 |
-# @USAGE: target [comparator [version]] |
114 |
-# @RETURN: Package atom of a Ruby implementation to be used in dependencies. |
115 |
-# @DESCRIPTION: |
116 |
-# This function returns the formal package atom for a Ruby implementation. |
117 |
-# |
118 |
-# `target' has to be one of the valid values for USE_RUBY (see above) |
119 |
-# |
120 |
-# Set `comparator' and `version' to include a comparator (=, >=, etc.) and a |
121 |
-# version string to the returned string |
122 |
-ruby_implementation_depend() { |
123 |
- _ruby_implementation_depend $1 |
124 |
-} |
125 |
- |
126 |
-# @FUNCTION: ruby_samelib |
127 |
-# @RETURN: use flag string with current ruby implementations |
128 |
-# @DESCRIPTION: |
129 |
-# Convenience function to output the use dependency part of a |
130 |
-# dependency. Used as a building block for ruby_add_rdepend() and |
131 |
-# ruby_add_bdepend(), but may also be useful in an ebuild to specify |
132 |
-# more complex dependencies. |
133 |
-ruby_samelib() { |
134 |
- local res= |
135 |
- for _ruby_implementation in $USE_RUBY; do |
136 |
- has -${_ruby_implementation} $@ || \ |
137 |
- res="${res}ruby_targets_${_ruby_implementation}?," |
138 |
- done |
139 |
- |
140 |
- echo "[${res%,}]" |
141 |
-} |
142 |
- |
143 |
-_ruby_atoms_samelib_generic() { |
144 |
- eshopts_push -o noglob |
145 |
- echo "RUBYTARGET? (" |
146 |
- for token in $*; do |
147 |
- case "$token" in |
148 |
- "||" | "(" | ")" | *"?") |
149 |
- echo "${token}" ;; |
150 |
- *]) |
151 |
- echo "${token%[*}[RUBYTARGET,${token/*[}" ;; |
152 |
- *) |
153 |
- echo "${token}[RUBYTARGET]" ;; |
154 |
- esac |
155 |
- done |
156 |
- echo ")" |
157 |
- eshopts_pop |
158 |
-} |
159 |
- |
160 |
-# @FUNCTION: ruby_implementation_command |
161 |
-# @RETURN: the path to the given ruby implementation |
162 |
-# @DESCRIPTION: |
163 |
-# Not all implementations have the same command basename as the |
164 |
-# target; namely Ruby Enterprise 1.8 uses ree18 and rubyee18 |
165 |
-# respectively. This function translate between the two |
166 |
-ruby_implementation_command() { |
167 |
- local _ruby_name=$1 |
168 |
- |
169 |
- # Add all USE_RUBY values where the flag name diverts from the binary here |
170 |
- case $1 in |
171 |
- ree18) |
172 |
- _ruby_name=rubyee18 |
173 |
- ;; |
174 |
- esac |
175 |
- |
176 |
- echo $(type -p ${_ruby_name} 2>/dev/null) |
177 |
-} |
178 |
- |
179 |
-_ruby_atoms_samelib() { |
180 |
- local atoms=$(_ruby_atoms_samelib_generic "$*") |
181 |
- |
182 |
- for _ruby_implementation in $USE_RUBY; do |
183 |
- echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}" |
184 |
- done |
185 |
-} |
186 |
- |
187 |
-_ruby_wrap_conditions() { |
188 |
- local conditions="$1" |
189 |
- local atoms="$2" |
190 |
- |
191 |
- for condition in $conditions; do |
192 |
- atoms="${condition}? ( ${atoms} )" |
193 |
- done |
194 |
- |
195 |
- echo "$atoms" |
196 |
-} |
197 |
- |
198 |
-# @FUNCTION: ruby_add_rdepend |
199 |
-# @USAGE: dependencies |
200 |
-# @DESCRIPTION: |
201 |
-# Adds the specified dependencies, with use condition(s) to RDEPEND, |
202 |
-# taking the current set of ruby targets into account. This makes sure |
203 |
-# that all ruby dependencies of the package are installed for the same |
204 |
-# ruby targets. Use this function for all ruby dependencies instead of |
205 |
-# setting RDEPEND yourself. The list of atoms uses the same syntax as |
206 |
-# normal dependencies. |
207 |
-# |
208 |
-# Note: runtime dependencies are also added as build-time test |
209 |
-# dependencies. |
210 |
-ruby_add_rdepend() { |
211 |
- case $# in |
212 |
- 1) ;; |
213 |
- 2) |
214 |
- [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF" |
215 |
- ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")" |
216 |
- return |
217 |
- ;; |
218 |
- *) |
219 |
- die "bad number of arguments to $0" |
220 |
- ;; |
221 |
- esac |
222 |
- |
223 |
- local dependency=$(_ruby_atoms_samelib "$1") |
224 |
- |
225 |
- RDEPEND="${RDEPEND} $dependency" |
226 |
- |
227 |
- # Add the dependency as a test-dependency since we're going to |
228 |
- # execute the code during test phase. |
229 |
- DEPEND="${DEPEND} test? ( ${dependency} )" |
230 |
- has test "$IUSE" || IUSE="${IUSE} test" |
231 |
-} |
232 |
- |
233 |
-# @FUNCTION: ruby_add_bdepend |
234 |
-# @USAGE: dependencies |
235 |
-# @DESCRIPTION: |
236 |
-# Adds the specified dependencies, with use condition(s) to DEPEND, |
237 |
-# taking the current set of ruby targets into account. This makes sure |
238 |
-# that all ruby dependencies of the package are installed for the same |
239 |
-# ruby targets. Use this function for all ruby dependencies instead of |
240 |
-# setting DEPEND yourself. The list of atoms uses the same syntax as |
241 |
-# normal dependencies. |
242 |
-ruby_add_bdepend() { |
243 |
- case $# in |
244 |
- 1) ;; |
245 |
- 2) |
246 |
- [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF" |
247 |
- ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")" |
248 |
- return |
249 |
- ;; |
250 |
- *) |
251 |
- die "bad number of arguments to $0" |
252 |
- ;; |
253 |
- esac |
254 |
- |
255 |
- local dependency=$(_ruby_atoms_samelib "$1") |
256 |
- |
257 |
- DEPEND="${DEPEND} $dependency" |
258 |
- RDEPEND="${RDEPEND}" |
259 |
-} |
260 |
- |
261 |
-# @FUNCTION: ruby_get_use_implementations |
262 |
-# @DESCRIPTION: |
263 |
-# Gets an array of ruby use targets enabled by the user |
264 |
-ruby_get_use_implementations() { |
265 |
- local i implementation |
266 |
- for implementation in ${USE_RUBY}; do |
267 |
- use ruby_targets_${implementation} && i+=" ${implementation}" |
268 |
- done |
269 |
- echo $i |
270 |
-} |
271 |
- |
272 |
-# @FUNCTION: ruby_get_use_targets |
273 |
-# @DESCRIPTION: |
274 |
-# Gets an array of ruby use targets that the ebuild sets |
275 |
-ruby_get_use_targets() { |
276 |
- local t implementation |
277 |
- for implementation in ${USE_RUBY}; do |
278 |
- t+=" ruby_targets_${implementation}" |
279 |
- done |
280 |
- echo $t |
281 |
-} |
282 |
- |
283 |
-# @FUNCTION: ruby_implementations_depend |
284 |
-# @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND. |
285 |
-# @DESCRIPTION: |
286 |
-# Produces the dependency string for the various implementations of ruby |
287 |
-# which the package is being built against. This should not be used when |
288 |
-# RUBY_OPTIONAL is unset but must be used if RUBY_OPTIONAL=yes. Do not |
289 |
-# confuse this function with ruby_implementation_depend(). |
290 |
-# |
291 |
-# @EXAMPLE: |
292 |
-# EAPI=4 |
293 |
-# RUBY_OPTIONAL=yes |
294 |
-# |
295 |
-# inherit ruby-ng |
296 |
-# ... |
297 |
-# DEPEND="ruby? ( $(ruby_implementations_depend) )" |
298 |
-# RDEPEND="${DEPEND}" |
299 |
-ruby_implementations_depend() { |
300 |
- local depend |
301 |
- for _ruby_implementation in ${USE_RUBY}; do |
302 |
- depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
303 |
- done |
304 |
- echo "${depend}" |
305 |
-} |
306 |
- |
307 |
-IUSE+=" $(ruby_get_use_targets)" |
308 |
-# If you specify RUBY_OPTIONAL you also need to take care of |
309 |
-# ruby useflag and dependency. |
310 |
-if [[ ${RUBY_OPTIONAL} != yes ]]; then |
311 |
- DEPEND="${DEPEND} $(ruby_implementations_depend)" |
312 |
- RDEPEND="${RDEPEND} $(ruby_implementations_depend)" |
313 |
- |
314 |
- case ${EAPI:-0} in |
315 |
- 4|5) |
316 |
- REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" |
317 |
- ;; |
318 |
- esac |
319 |
-fi |
320 |
- |
321 |
-_ruby_invoke_environment() { |
322 |
- old_S=${S} |
323 |
- case ${EAPI} in |
324 |
- 4|5) |
325 |
- if [ -z ${RUBY_S} ]; then |
326 |
- sub_S=${P} |
327 |
- else |
328 |
- sub_S=${RUBY_S} |
329 |
- fi |
330 |
- ;; |
331 |
- *) |
332 |
- sub_S=${S#${WORKDIR}/} |
333 |
- ;; |
334 |
- esac |
335 |
- |
336 |
- # Special case, for the always-lovely GitHub fetches. With this, |
337 |
- # we allow the star glob to just expand to whatever directory it's |
338 |
- # called. |
339 |
- if [[ ${sub_S} = *"*"* ]]; then |
340 |
- case ${EAPI} in |
341 |
- 2|3) |
342 |
- #The old method of setting S depends on undefined package |
343 |
- # manager behaviour, so encourage upgrading to EAPI=4. |
344 |
- eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead." |
345 |
- ;; |
346 |
- esac |
347 |
- pushd "${WORKDIR}"/all &>/dev/null |
348 |
- sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
349 |
- popd &>/dev/null |
350 |
- fi |
351 |
- |
352 |
- environment=$1; shift |
353 |
- |
354 |
- my_WORKDIR="${WORKDIR}"/${environment} |
355 |
- S="${my_WORKDIR}"/"${sub_S}" |
356 |
- |
357 |
- if [[ -d "${S}" ]]; then |
358 |
- pushd "$S" &>/dev/null |
359 |
- elif [[ -d "${my_WORKDIR}" ]]; then |
360 |
- pushd "${my_WORKDIR}" &>/dev/null |
361 |
- else |
362 |
- pushd "${WORKDIR}" &>/dev/null |
363 |
- fi |
364 |
- |
365 |
- ebegin "Running ${_PHASE:-${EBUILD_PHASE}} phase for $environment" |
366 |
- "$@" |
367 |
- popd &>/dev/null |
368 |
- |
369 |
- S=${old_S} |
370 |
-} |
371 |
- |
372 |
-_ruby_each_implementation() { |
373 |
- local invoked=no |
374 |
- for _ruby_implementation in ${USE_RUBY}; do |
375 |
- # only proceed if it's requested |
376 |
- use ruby_targets_${_ruby_implementation} || continue |
377 |
- |
378 |
- RUBY=$(ruby_implementation_command ${_ruby_implementation}) |
379 |
- invoked=yes |
380 |
- |
381 |
- if [[ -n "$1" ]]; then |
382 |
- _ruby_invoke_environment ${_ruby_implementation} "$@" |
383 |
- fi |
384 |
- |
385 |
- unset RUBY |
386 |
- done |
387 |
- |
388 |
- if [[ ${invoked} == "no" ]]; then |
389 |
- eerror "You need to select at least one compatible Ruby installation target via RUBY_TARGETS in make.conf." |
390 |
- eerror "Compatible targets for this package are: ${USE_RUBY}" |
391 |
- eerror |
392 |
- eerror "See http://www.gentoo.org/proj/en/prog_lang/ruby/index.xml#doc_chap3 for more information." |
393 |
- eerror |
394 |
- die "No compatible Ruby target selected." |
395 |
- fi |
396 |
-} |
397 |
- |
398 |
-# @FUNCTION: ruby-ng_pkg_setup |
399 |
-# @DESCRIPTION: |
400 |
-# Check whether at least one ruby target implementation is present. |
401 |
-ruby-ng_pkg_setup() { |
402 |
- # This only checks that at least one implementation is present |
403 |
- # before doing anything; by leaving the parameters empty we know |
404 |
- # it's a special case. |
405 |
- _ruby_each_implementation |
406 |
- |
407 |
- has ruby_targets_jruby ${IUSE} && use ruby_targets_jruby && java-pkg_setup-vm |
408 |
-} |
409 |
- |
410 |
-# @FUNCTION: ruby-ng_src_unpack |
411 |
-# @DESCRIPTION: |
412 |
-# Unpack the source archive. |
413 |
-ruby-ng_src_unpack() { |
414 |
- mkdir "${WORKDIR}"/all |
415 |
- pushd "${WORKDIR}"/all &>/dev/null |
416 |
- |
417 |
- # We don't support an each-unpack, it's either all or nothing! |
418 |
- if type all_ruby_unpack &>/dev/null; then |
419 |
- _ruby_invoke_environment all all_ruby_unpack |
420 |
- else |
421 |
- [[ -n ${A} ]] && unpack ${A} |
422 |
- fi |
423 |
- |
424 |
- popd &>/dev/null |
425 |
-} |
426 |
- |
427 |
-_ruby_apply_patches() { |
428 |
- for patch in "${RUBY_PATCHES[@]}"; do |
429 |
- if [ -f "${patch}" ]; then |
430 |
- epatch "${patch}" |
431 |
- elif [ -f "${FILESDIR}/${patch}" ]; then |
432 |
- epatch "${FILESDIR}/${patch}" |
433 |
- else |
434 |
- die "Cannot find patch ${patch}" |
435 |
- fi |
436 |
- done |
437 |
- |
438 |
- # This is a special case: instead of executing just in the special |
439 |
- # "all" environment, this will actually copy the effects on _all_ |
440 |
- # the other environments, and is thus executed before the copy |
441 |
- type all_ruby_prepare &>/dev/null && all_ruby_prepare |
442 |
-} |
443 |
- |
444 |
-_ruby_source_copy() { |
445 |
- # Until we actually find a reason not to, we use hardlinks, this |
446 |
- # should reduce the amount of disk space that is wasted by this. |
447 |
- cp -prlP all ${_ruby_implementation} \ |
448 |
- || die "Unable to copy ${_ruby_implementation} environment" |
449 |
-} |
450 |
- |
451 |
-# @FUNCTION: ruby-ng_src_prepare |
452 |
-# @DESCRIPTION: |
453 |
-# Apply patches and prepare versions for each ruby target |
454 |
-# implementation. Also carry out common clean up tasks. |
455 |
-ruby-ng_src_prepare() { |
456 |
- # Way too many Ruby packages are prepared on OSX without removing |
457 |
- # the extra data forks, we do it here to avoid repeating it for |
458 |
- # almost every other ebuild. |
459 |
- find . -name '._*' -delete |
460 |
- |
461 |
- _ruby_invoke_environment all _ruby_apply_patches |
462 |
- |
463 |
- _PHASE="source copy" \ |
464 |
- _ruby_each_implementation _ruby_source_copy |
465 |
- |
466 |
- if type each_ruby_prepare &>/dev/null; then |
467 |
- _ruby_each_implementation each_ruby_prepare |
468 |
- fi |
469 |
-} |
470 |
- |
471 |
-# @FUNCTION: ruby-ng_src_configure |
472 |
-# @DESCRIPTION: |
473 |
-# Configure the package. |
474 |
-ruby-ng_src_configure() { |
475 |
- if type each_ruby_configure &>/dev/null; then |
476 |
- _ruby_each_implementation each_ruby_configure |
477 |
- fi |
478 |
- |
479 |
- type all_ruby_configure &>/dev/null && \ |
480 |
- _ruby_invoke_environment all all_ruby_configure |
481 |
-} |
482 |
- |
483 |
-# @FUNCTION: ruby-ng_src_compile |
484 |
-# @DESCRIPTION: |
485 |
-# Compile the package. |
486 |
-ruby-ng_src_compile() { |
487 |
- if type each_ruby_compile &>/dev/null; then |
488 |
- _ruby_each_implementation each_ruby_compile |
489 |
- fi |
490 |
- |
491 |
- type all_ruby_compile &>/dev/null && \ |
492 |
- _ruby_invoke_environment all all_ruby_compile |
493 |
-} |
494 |
- |
495 |
-# @FUNCTION: ruby-ng_src_test |
496 |
-# @DESCRIPTION: |
497 |
-# Run tests for the package. |
498 |
-ruby-ng_src_test() { |
499 |
- if type each_ruby_test &>/dev/null; then |
500 |
- _ruby_each_implementation each_ruby_test |
501 |
- fi |
502 |
- |
503 |
- type all_ruby_test &>/dev/null && \ |
504 |
- _ruby_invoke_environment all all_ruby_test |
505 |
-} |
506 |
- |
507 |
-_each_ruby_check_install() { |
508 |
- local scancmd=scanelf |
509 |
- # we have a Mach-O object here |
510 |
- [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho |
511 |
- |
512 |
- has "${EAPI}" 2 && ! use prefix && EPREFIX= |
513 |
- |
514 |
- local libruby_basename=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["LIBRUBY_SO"]') |
515 |
- local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null) |
516 |
- local sitedir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]') |
517 |
- local sitelibdir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]') |
518 |
- |
519 |
- # Look for wrong files in sitedir |
520 |
- # if [[ -d "${D}${sitedir}" ]]; then |
521 |
- # local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") |
522 |
- # if [[ -n ${f} ]]; then |
523 |
- # eerror "Found files in sitedir, outsite sitelibdir:" |
524 |
- # eerror "${f}" |
525 |
- # die "Misplaced files in sitedir" |
526 |
- # fi |
527 |
- # fi |
528 |
- |
529 |
- # The current implementation lacks libruby (i.e.: jruby) |
530 |
- [[ -z ${libruby_soname} ]] && return 0 |
531 |
- |
532 |
- # Check also the gems directory, since we could be installing compiled |
533 |
- # extensions via ruby-fakegem; make sure to check only in sitelibdir, since |
534 |
- # that's what changes between two implementations (otherwise you'd get false |
535 |
- # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8) |
536 |
- ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \ |
537 |
- | fgrep -v "${libruby_soname}" \ |
538 |
- | grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \ |
539 |
- > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
540 |
- |
541 |
- if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
542 |
- ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}" |
543 |
- ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) |
544 |
- die "Missing links to ${libruby_soname}" |
545 |
- fi |
546 |
-} |
547 |
- |
548 |
-# @FUNCTION: ruby-ng_src_install |
549 |
-# @DESCRIPTION: |
550 |
-# Install the package for each ruby target implementation. |
551 |
-ruby-ng_src_install() { |
552 |
- if type each_ruby_install &>/dev/null; then |
553 |
- _ruby_each_implementation each_ruby_install |
554 |
- fi |
555 |
- |
556 |
- type all_ruby_install &>/dev/null && \ |
557 |
- _ruby_invoke_environment all all_ruby_install |
558 |
- |
559 |
- _PHASE="check install" \ |
560 |
- _ruby_each_implementation _each_ruby_check_install |
561 |
-} |
562 |
- |
563 |
-# @FUNCTION: ruby_rbconfig_value |
564 |
-# @USAGE: rbconfig item |
565 |
-# @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}. |
566 |
-ruby_rbconfig_value() { |
567 |
- echo $(${RUBY} -rrbconfig -e "puts RbConfig::CONFIG['$1']") |
568 |
-} |
569 |
- |
570 |
-# @FUNCTION: doruby |
571 |
-# @USAGE: file [file...] |
572 |
-# @DESCRIPTION: |
573 |
-# Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. |
574 |
-doruby() { |
575 |
- [[ -z ${RUBY} ]] && die "\$RUBY is not set" |
576 |
- has "${EAPI}" 2 && ! use prefix && EPREFIX= |
577 |
- ( # don't want to pollute calling env |
578 |
- sitelibdir=$(ruby_rbconfig_value 'sitelibdir') |
579 |
- insinto ${sitelibdir#${EPREFIX}} |
580 |
- insopts -m 0644 |
581 |
- doins "$@" |
582 |
- ) || die "failed to install $@" |
583 |
-} |
584 |
- |
585 |
-# @FUNCTION: ruby_get_libruby |
586 |
-# @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}. |
587 |
-ruby_get_libruby() { |
588 |
- ${RUBY} -rrbconfig -e 'puts File.join(RbConfig::CONFIG["libdir"], RbConfig::CONFIG["LIBRUBY"])' |
589 |
-} |
590 |
- |
591 |
-# @FUNCTION: ruby_get_hdrdir |
592 |
-# @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}. |
593 |
-ruby_get_hdrdir() { |
594 |
- local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir') |
595 |
- |
596 |
- if [[ "${rubyhdrdir}" = "nil" ]] ; then |
597 |
- rubyhdrdir=$(ruby_rbconfig_value 'archdir') |
598 |
- fi |
599 |
- |
600 |
- echo "${rubyhdrdir}" |
601 |
-} |
602 |
- |
603 |
-# @FUNCTION: ruby_get_version |
604 |
-# @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to. |
605 |
-ruby_get_version() { |
606 |
- local ruby=${RUBY:-$(type -p ruby 2>/dev/null)} |
607 |
- |
608 |
- echo $(${ruby} -e 'puts RUBY_VERSION') |
609 |
-} |
610 |
- |
611 |
-# @FUNCTION: ruby_get_implementation |
612 |
-# @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to. |
613 |
-ruby_get_implementation() { |
614 |
- local ruby=${RUBY:-$(type -p ruby 2>/dev/null)} |
615 |
- |
616 |
- case $(${ruby} --version) in |
617 |
- *Enterprise*) |
618 |
- echo "ree" |
619 |
- ;; |
620 |
- *jruby*) |
621 |
- echo "jruby" |
622 |
- ;; |
623 |
- *rubinius*) |
624 |
- echo "rbx" |
625 |
- ;; |
626 |
- *) |
627 |
- echo "mri" |
628 |
- ;; |
629 |
- esac |
630 |
-} |
631 |
- |
632 |
-# @FUNCTION: ruby-ng_rspec <arguments> |
633 |
-# @DESCRIPTION: |
634 |
-# This is simply a wrapper around the rspec command (executed by $RUBY}) |
635 |
-# which also respects TEST_VERBOSE and NOCOLOR environment variables. |
636 |
-# Optionally takes arguments to pass on to the rspec invocation. The |
637 |
-# environment variable RSPEC_VERSION can be used to control the specific |
638 |
-# rspec version that must be executed. It defaults to 2 for historical |
639 |
-# compatibility. |
640 |
-ruby-ng_rspec() { |
641 |
- local version=${RSPEC_VERSION-2} |
642 |
- local files="$@" |
643 |
- |
644 |
- # Explicitly pass the expected spec directory since the versioned |
645 |
- # rspec wrappers don't handle this automatically. |
646 |
- if [ ${#@} -eq 0 ]; then |
647 |
- files="spec" |
648 |
- fi |
649 |
- |
650 |
- if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then |
651 |
- ewarn "Missing dev-ruby/rspec in \${DEPEND}" |
652 |
- fi |
653 |
- |
654 |
- local rspec_params= |
655 |
- case ${NOCOLOR} in |
656 |
- 1|yes|true) |
657 |
- rspec_params+=" --no-color" |
658 |
- ;; |
659 |
- *) |
660 |
- rspec_params+=" --color" |
661 |
- ;; |
662 |
- esac |
663 |
- |
664 |
- case ${TEST_VERBOSE} in |
665 |
- 1|yes|true) |
666 |
- rspec_params+=" --format documentation" |
667 |
- ;; |
668 |
- *) |
669 |
- rspec_params+=" --format progress" |
670 |
- ;; |
671 |
- esac |
672 |
- |
673 |
- ${RUBY} -S rspec-${version} ${rspec_params} ${files} || die "rspec failed" |
674 |
-} |
675 |
- |
676 |
-# @FUNCTION: ruby-ng_cucumber |
677 |
-# @DESCRIPTION: |
678 |
-# This is simply a wrapper around the cucumber command (executed by $RUBY}) |
679 |
-# which also respects TEST_VERBOSE and NOCOLOR environment variables. |
680 |
-ruby-ng_cucumber() { |
681 |
- if [[ ${DEPEND} != *"dev-util/cucumber"* ]]; then |
682 |
- ewarn "Missing dev-util/cucumber in \${DEPEND}" |
683 |
- fi |
684 |
- |
685 |
- local cucumber_params= |
686 |
- case ${NOCOLOR} in |
687 |
- 1|yes|true) |
688 |
- cucumber_params+=" --no-color" |
689 |
- ;; |
690 |
- *) |
691 |
- cucumber_params+=" --color" |
692 |
- ;; |
693 |
- esac |
694 |
- |
695 |
- case ${TEST_VERBOSE} in |
696 |
- 1|yes|true) |
697 |
- cucumber_params+=" --format pretty" |
698 |
- ;; |
699 |
- *) |
700 |
- cucumber_params+=" --format progress" |
701 |
- ;; |
702 |
- esac |
703 |
- |
704 |
- if [[ ${RUBY} == *jruby ]]; then |
705 |
- ewarn "Skipping cucumber tests on JRuby (unsupported)." |
706 |
- return 0 |
707 |
- fi |
708 |
- |
709 |
- ${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed" |
710 |
-} |
711 |
- |
712 |
-# @FUNCTION: ruby-ng_testrb-2 |
713 |
-# @DESCRIPTION: |
714 |
-# This is simply a replacement for the testrb command that load the test |
715 |
-# files and execute them, with test-unit 2.x. This actually requires |
716 |
-# either an old test-unit-2 version or 2.5.1-r1 or later, as they remove |
717 |
-# their script and we installed a broken wrapper for a while. |
718 |
-# This also respects TEST_VERBOSE and NOCOLOR environment variables. |
719 |
-ruby-ng_testrb-2() { |
720 |
- if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then |
721 |
- ewarn "Missing dev-ruby/test-unit in \${DEPEND}" |
722 |
- fi |
723 |
- |
724 |
- local testrb_params= |
725 |
- case ${NOCOLOR} in |
726 |
- 1|yes|true) |
727 |
- testrb_params+=" --no-use-color" |
728 |
- ;; |
729 |
- *) |
730 |
- testrb_params+=" --use-color=auto" |
731 |
- ;; |
732 |
- esac |
733 |
- |
734 |
- case ${TEST_VERBOSE} in |
735 |
- 1|yes|true) |
736 |
- testrb_params+=" --verbose=verbose" |
737 |
- ;; |
738 |
- *) |
739 |
- testrb_params+=" --verbose=normal" |
740 |
- ;; |
741 |
- esac |
742 |
- |
743 |
- ${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed" |
744 |
-} |
745 |
|
746 |
diff --git a/eclass/ruby-single.eclass b/eclass/ruby-single.eclass |
747 |
deleted file mode 100644 |
748 |
index 1570052..0000000 |
749 |
--- a/eclass/ruby-single.eclass |
750 |
+++ /dev/null |
751 |
@@ -1,77 +0,0 @@ |
752 |
-# Copyright 1999-2014 Gentoo Foundation |
753 |
-# Distributed under the terms of the GNU General Public License v2 |
754 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.26 2014/05/26 16:13:35 mgorny Exp $ |
755 |
- |
756 |
-# @ECLASS: ruby-single |
757 |
-# @MAINTAINER: |
758 |
-# Ruby team <ruby@g.o> |
759 |
-# @AUTHOR: |
760 |
-# Author: Hans de Graaff <graaff@g.o> |
761 |
-# Based on python-single-r1 by: Michał Górny <mgorny@g.o> |
762 |
-# @BLURB: An eclass for Ruby packages not installed for multiple implementations. |
763 |
-# @DESCRIPTION: |
764 |
-# An eclass for packages which don't support being installed for |
765 |
-# multiple Ruby implementations. This mostly includes ruby-based |
766 |
-# scripts. |
767 |
- |
768 |
-case "${EAPI:-0}" in |
769 |
- 0|1|2|3) |
770 |
- die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" |
771 |
- ;; |
772 |
- 4|5) |
773 |
- ;; |
774 |
- *) |
775 |
- die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" |
776 |
- ;; |
777 |
-esac |
778 |
- |
779 |
-if [[ ! ${_RUBY_SINGLE} ]]; then |
780 |
- |
781 |
-inherit ruby-utils |
782 |
- |
783 |
-# @ECLASS-VARIABLE: USE_RUBY |
784 |
-# @DEFAULT_UNSET |
785 |
-# @REQUIRED |
786 |
-# @DESCRIPTION: |
787 |
-# This variable contains a space separated list of targets (see above) a package |
788 |
-# is compatible to. It must be set before the `inherit' call. There is no |
789 |
-# default. All ebuilds are expected to set this variable. |
790 |
- |
791 |
- |
792 |
-# @ECLASS-VARIABLE: RUBY_DEPS |
793 |
-# @DESCRIPTION: |
794 |
-# |
795 |
-# This is an eclass-generated Ruby dependency string for all |
796 |
-# implementations listed in USE_RUBY. Any one of the supported ruby |
797 |
-# targets will satisfy this dependency. |
798 |
-# |
799 |
-# Example use: |
800 |
-# @CODE |
801 |
-# RDEPEND="${RUBY_DEPS} |
802 |
-# dev-foo/mydep" |
803 |
-# BDEPEND="${RDEPEND}" |
804 |
-# @ |
805 |
-# |
806 |
-# Example value: |
807 |
-# @CODE |
808 |
-# || ( dev-lang/ruby:2.0 dev-lang/ruby:1.9 ) |
809 |
-# @CODE |
810 |
- |
811 |
-_ruby_single_implementations_depend() { |
812 |
- local depend |
813 |
- for _ruby_implementation in ${RUBY_TARGETS_PREFERENCE}; do |
814 |
- if [[ ${USE_RUBY} =~ ${_ruby_implementation} ]]; then |
815 |
- depend="${depend} $(_ruby_implementation_depend $_ruby_implementation)" |
816 |
- fi |
817 |
- done |
818 |
- echo "|| ( ${depend} )" |
819 |
-} |
820 |
- |
821 |
-_ruby_single_set_globals() { |
822 |
- RUBY_DEPS=$(_ruby_single_implementations_depend) |
823 |
-} |
824 |
-_ruby_single_set_globals |
825 |
- |
826 |
- |
827 |
-_RUBY_SINGLE=1 |
828 |
-fi |
829 |
|
830 |
diff --git a/eclass/ruby-utils.eclass b/eclass/ruby-utils.eclass |
831 |
deleted file mode 100644 |
832 |
index 8d045d9..0000000 |
833 |
--- a/eclass/ruby-utils.eclass |
834 |
+++ /dev/null |
835 |
@@ -1,91 +0,0 @@ |
836 |
-# Copyright 1999-2013 Gentoo Foundation |
837 |
-# Distributed under the terms of the GNU General Public License v2 |
838 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.53 2013/12/26 07:11:48 graaff Exp $ |
839 |
- |
840 |
-# @ECLASS: ruby-utils.eclass |
841 |
-# @MAINTAINER: |
842 |
-# Ruby team <ruby@g.o> |
843 |
-# @AUTHOR: |
844 |
-# Author: Hans de Graaff <graaff@g.o> |
845 |
-# @BLURB: An eclass for supporting ruby scripts and bindings in non-ruby packages |
846 |
-# @DESCRIPTION: |
847 |
-# The ruby-utils eclass is designed to allow an easier installation of |
848 |
-# Ruby scripts and bindings for non-ruby packages. |
849 |
-# |
850 |
-# This eclass does not set any metadata variables nor export any phase |
851 |
-# functions. It can be inherited safely. |
852 |
- |
853 |
- |
854 |
-case ${EAPI} in |
855 |
- 0|1|2) |
856 |
- die "Unsupported EAPI=${EAPI} (too old) for ${ECLASS}" ;; |
857 |
- 3|4|5) ;; |
858 |
- *) |
859 |
- die "Unknown EAPI=${EAPI} for ${ECLASS}" |
860 |
-esac |
861 |
- |
862 |
-if [[ ! ${_RUBY_UTILS} ]]; then |
863 |
- |
864 |
- |
865 |
-# @ECLASS-VARIABLE: RUBY_TARGETS_PREFERENCE |
866 |
-# @DESCRIPTION: |
867 |
-# This variable lists all the known ruby targets in preference of use as |
868 |
-# determined by the ruby team. By using this ordering rather than the |
869 |
-# USE_RUBY mandated ordering we have more control over which ruby |
870 |
-# implementation will be installed first (and thus eselected). This will |
871 |
-# provide for a better first installation experience. |
872 |
- |
873 |
-# All RUBY_TARGETS |
874 |
-RUBY_TARGETS_PREFERENCE="ruby20 ruby19 " |
875 |
- |
876 |
-# All other active ruby targets |
877 |
-RUBY_TARGETS_PREFERENCE+="ruby21 ruby22 " |
878 |
- |
879 |
- |
880 |
-_ruby_implementation_depend() { |
881 |
- local rubypn= |
882 |
- local rubyslot= |
883 |
- |
884 |
- case $1 in |
885 |
- ruby18) |
886 |
- rubypn="dev-lang/ruby" |
887 |
- rubyslot=":1.8" |
888 |
- ;; |
889 |
- ruby19) |
890 |
- rubypn="dev-lang/ruby" |
891 |
- rubyslot=":1.9" |
892 |
- ;; |
893 |
- ruby20) |
894 |
- rubypn="dev-lang/ruby" |
895 |
- rubyslot=":2.0" |
896 |
- ;; |
897 |
- ruby21) |
898 |
- rubypn="dev-lang/ruby" |
899 |
- rubyslot=":2.1" |
900 |
- ;; |
901 |
- ruby22) |
902 |
- rubypn="dev-lang/ruby" |
903 |
- rubyslot=":2.2" |
904 |
- ;; |
905 |
- ree18) |
906 |
- rubypn="dev-lang/ruby-enterprise" |
907 |
- rubyslot=":1.8" |
908 |
- ;; |
909 |
- jruby) |
910 |
- rubypn="dev-java/jruby" |
911 |
- rubyslot="" |
912 |
- ;; |
913 |
- rbx) |
914 |
- rubypn="dev-lang/rubinius" |
915 |
- rubyslot="" |
916 |
- ;; |
917 |
- *) die "$1: unknown Ruby implementation" |
918 |
- esac |
919 |
- |
920 |
- echo "$2${rubypn}$3${rubyslot}" |
921 |
-} |
922 |
- |
923 |
- |
924 |
- |
925 |
-_RUBY_UTILS=1 |
926 |
-fi |