| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2012 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.21 2010/07/08 04:00:57 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.49 2012/08/13 21:18:41 flameeyes Exp $ |
| 4 | # |
4 | |
| 5 | # @ECLASS: ruby-ng.eclass |
5 | # @ECLASS: ruby-ng.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Ruby herd <ruby@gentoo.org> |
7 | # Ruby herd <ruby@gentoo.org> |
| 8 | # |
8 | # @AUTHOR: |
| 9 | # Author: Diego E. Pettenò <flameeyes@gentoo.org> |
9 | # Author: Diego E. Pettenò <flameeyes@gentoo.org> |
| 10 | # |
|
|
| 11 | # Author: Alex Legler <a3li@gentoo.org> |
10 | # Author: Alex Legler <a3li@gentoo.org> |
| 12 | # |
|
|
| 13 | # Author: Hans de Graaff <graaff@gentoo.org> |
11 | # Author: Hans de Graaff <graaff@gentoo.org> |
| 14 | # |
|
|
| 15 | # @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots. |
12 | # @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots. |
| 16 | # @DESCRIPTION: |
13 | # @DESCRIPTION: |
| 17 | # The Ruby eclass is designed to allow an easier installation of Ruby packages |
14 | # The Ruby eclass is designed to allow an easier installation of Ruby packages |
| 18 | # and their incorporation into the Gentoo Linux system. |
15 | # and their incorporation into the Gentoo Linux system. |
| 19 | # |
16 | # |
| 20 | # Currently available targets are: |
17 | # Currently available targets are: |
| 21 | # * ruby18 - Ruby (MRI) 1.8.x |
18 | # * ruby18 - Ruby (MRI) 1.8.x |
| 22 | # * ruby19 - Ruby (MRI) 1.9.x |
19 | # * ruby19 - Ruby (MRI) 1.9.x |
| 23 | # * ree18 - Ruby Enterprise Edition 1.8.x |
20 | # * ree18 - Ruby Enterprise Edition 1.8.x |
| 24 | # * jruby - JRuby |
21 | # * jruby - JRuby |
|
|
22 | # * rbx - Rubinius |
| 25 | # |
23 | # |
| 26 | # This eclass does not define the implementation of the configure, |
24 | # This eclass does not define the implementation of the configure, |
| 27 | # compile, test, or install phases. Instead, the default phases are |
25 | # compile, test, or install phases. Instead, the default phases are |
| 28 | # used. Specific implementations of these phases can be provided in |
26 | # used. Specific implementations of these phases can be provided in |
| 29 | # the ebuild either to be run for each Ruby implementation, or for all |
27 | # the ebuild either to be run for each Ruby implementation, or for all |
| … | |
… | |
| 31 | # |
29 | # |
| 32 | # * each_ruby_configure |
30 | # * each_ruby_configure |
| 33 | # * all_ruby_configure |
31 | # * all_ruby_configure |
| 34 | |
32 | |
| 35 | # @ECLASS-VARIABLE: USE_RUBY |
33 | # @ECLASS-VARIABLE: USE_RUBY |
|
|
34 | # @REQUIRED |
| 36 | # @DESCRIPTION: |
35 | # @DESCRIPTION: |
| 37 | # This variable contains a space separated list of targets (see above) a package |
36 | # This variable contains a space separated list of targets (see above) a package |
| 38 | # is compatible to. It must be set before the `inherit' call. There is no |
37 | # is compatible to. It must be set before the `inherit' call. There is no |
| 39 | # default. All ebuilds are expected to set this variable. |
38 | # default. All ebuilds are expected to set this variable. |
| 40 | |
39 | |
| 41 | # @ECLASS-VARIABLE: RUBY_PATCHES |
40 | # @ECLASS-VARIABLE: RUBY_PATCHES |
|
|
41 | # @DEFAULT_UNSET |
| 42 | # @DESCRIPTION: |
42 | # @DESCRIPTION: |
| 43 | # A String or Array of filenames of patches to apply to all implementations. |
43 | # A String or Array of filenames of patches to apply to all implementations. |
| 44 | |
44 | |
| 45 | # @ECLASS-VARIABLE: RUBY_OPTIONAL |
45 | # @ECLASS-VARIABLE: RUBY_OPTIONAL |
| 46 | # @DESCRIPTION: |
46 | # @DESCRIPTION: |
| 47 | # Set the value to "yes" to make the dependency on a Ruby interpreter optional. |
47 | # Set the value to "yes" to make the dependency on a Ruby interpreter |
|
|
48 | # optional and then ruby_implementations_depend() to help populate |
|
|
49 | # DEPEND and RDEPEND. |
| 48 | |
50 | |
| 49 | inherit eutils toolchain-funcs |
51 | # @ECLASS-VARIABLE: RUBY_S |
|
|
52 | # @DEFAULT_UNSET |
|
|
53 | # @DESCRIPTION: |
|
|
54 | # If defined this variable determines the source directory name after |
|
|
55 | # unpacking. This defaults to the name of the package. Note that this |
|
|
56 | # variable supports a wildcard mechanism to help with github tarballs |
|
|
57 | # that contain the commit hash as part of the directory name. |
|
|
58 | |
|
|
59 | # @ECLASS-VARIABLE: RUBY_QA_ALLOWED_LIBS |
|
|
60 | # @DEFAULT_UNSET |
|
|
61 | # @DESCRIPTION: |
|
|
62 | # If defined this variable contains a whitelist of shared objects that |
|
|
63 | # are allowed to exist even if they don't link to libruby. This avoids |
|
|
64 | # the QA check that makes this mandatory. This is most likely not what |
|
|
65 | # you are looking for if you get the related "Missing links" QA warning, |
|
|
66 | # since the proper fix is almost always to make sure the shared object |
|
|
67 | # is linked against libruby. There are cases were this is not the case |
|
|
68 | # and the shared object is generic code to be used in some other way |
|
|
69 | # (e.g. selenium's firefox driver extension). When set this argument is |
|
|
70 | # passed to "grep -E" to remove reporting of these shared objects. |
|
|
71 | |
|
|
72 | inherit eutils java-utils-2 multilib toolchain-funcs |
| 50 | |
73 | |
| 51 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup |
74 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup |
| 52 | |
75 | |
| 53 | case ${EAPI} in |
76 | case ${EAPI} in |
| 54 | 0|1) |
77 | 0|1) |
| 55 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
78 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
| 56 | 2) ;; |
79 | 2|3) ;; |
|
|
80 | 4) |
|
|
81 | # S is no longer automatically assigned when it doesn't exist. |
|
|
82 | S="${WORKDIR}" |
|
|
83 | ;; |
| 57 | *) |
84 | *) |
| 58 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
85 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
| 59 | esac |
86 | esac |
| 60 | |
87 | |
| 61 | # @FUNCTION: ruby_implementation_depend |
88 | # @FUNCTION: ruby_implementation_depend |
| … | |
… | |
| 85 | rubypn="dev-lang/ruby-enterprise" |
112 | rubypn="dev-lang/ruby-enterprise" |
| 86 | rubyslot=":1.8" |
113 | rubyslot=":1.8" |
| 87 | ;; |
114 | ;; |
| 88 | jruby) |
115 | jruby) |
| 89 | rubypn="dev-java/jruby" |
116 | rubypn="dev-java/jruby" |
|
|
117 | rubyslot="" |
|
|
118 | ;; |
|
|
119 | rbx) |
|
|
120 | rubypn="dev-lang/rubinius" |
| 90 | rubyslot="" |
121 | rubyslot="" |
| 91 | ;; |
122 | ;; |
| 92 | *) die "$1: unknown Ruby implementation" |
123 | *) die "$1: unknown Ruby implementation" |
| 93 | esac |
124 | esac |
| 94 | |
125 | |
| … | |
… | |
| 125 | echo "${token}[RUBYTARGET]" ;; |
156 | echo "${token}[RUBYTARGET]" ;; |
| 126 | esac |
157 | esac |
| 127 | done |
158 | done |
| 128 | echo ")" |
159 | echo ")" |
| 129 | eshopts_pop |
160 | eshopts_pop |
|
|
161 | } |
|
|
162 | |
|
|
163 | # @FUNCTION: ruby_implementation_command |
|
|
164 | # @RETURN: the path to the given ruby implementation |
|
|
165 | # @DESCRIPTION: |
|
|
166 | # Not all implementations have the same command basename as the |
|
|
167 | # target; namely Ruby Enterprise 1.8 uses ree18 and rubyee18 |
|
|
168 | # respectively. This function translate between the two |
|
|
169 | ruby_implementation_command() { |
|
|
170 | local _ruby_name=$1 |
|
|
171 | |
|
|
172 | # Add all USE_RUBY values where the flag name diverts from the binary here |
|
|
173 | case $1 in |
|
|
174 | ree18) |
|
|
175 | _ruby_name=rubyee18 |
|
|
176 | ;; |
|
|
177 | esac |
|
|
178 | |
|
|
179 | echo $(type -p ${_ruby_name} 2>/dev/null) |
| 130 | } |
180 | } |
| 131 | |
181 | |
| 132 | _ruby_atoms_samelib() { |
182 | _ruby_atoms_samelib() { |
| 133 | local atoms=$(_ruby_atoms_samelib_generic "$*") |
183 | local atoms=$(_ruby_atoms_samelib_generic "$*") |
| 134 | |
184 | |
| … | |
… | |
| 178 | RDEPEND="${RDEPEND} $dependency" |
228 | RDEPEND="${RDEPEND} $dependency" |
| 179 | |
229 | |
| 180 | # Add the dependency as a test-dependency since we're going to |
230 | # Add the dependency as a test-dependency since we're going to |
| 181 | # execute the code during test phase. |
231 | # execute the code during test phase. |
| 182 | DEPEND="${DEPEND} test? ( ${dependency} )" |
232 | DEPEND="${DEPEND} test? ( ${dependency} )" |
| 183 | hasq test "$IUSE" || IUSE="${IUSE} test" |
233 | has test "$IUSE" || IUSE="${IUSE} test" |
| 184 | } |
234 | } |
| 185 | |
235 | |
| 186 | # @FUNCTION: ruby_add_bdepend |
236 | # @FUNCTION: ruby_add_bdepend |
| 187 | # @USAGE: dependencies |
237 | # @USAGE: dependencies |
| 188 | # @DESCRIPTION: |
238 | # @DESCRIPTION: |
| … | |
… | |
| 209 | |
259 | |
| 210 | DEPEND="${DEPEND} $dependency" |
260 | DEPEND="${DEPEND} $dependency" |
| 211 | RDEPEND="${RDEPEND}" |
261 | RDEPEND="${RDEPEND}" |
| 212 | } |
262 | } |
| 213 | |
263 | |
|
|
264 | # @FUNCTION: ruby_get_use_implementations |
|
|
265 | # @DESCRIPTION: |
|
|
266 | # Gets an array of ruby use targets enabled by the user |
|
|
267 | ruby_get_use_implementations() { |
|
|
268 | local i implementation |
|
|
269 | for implementation in ${USE_RUBY}; do |
|
|
270 | use ruby_targets_${implementation} && i+=" ${implementation}" |
|
|
271 | done |
|
|
272 | echo $i |
|
|
273 | } |
|
|
274 | |
|
|
275 | # @FUNCTION: ruby_get_use_targets |
|
|
276 | # @DESCRIPTION: |
|
|
277 | # Gets an array of ruby use targets that the ebuild sets |
|
|
278 | ruby_get_use_targets() { |
|
|
279 | local t implementation |
|
|
280 | for implementation in ${USE_RUBY}; do |
|
|
281 | t+=" ruby_targets_${implementation}" |
|
|
282 | done |
|
|
283 | echo $t |
|
|
284 | } |
|
|
285 | |
|
|
286 | # @FUNCTION: ruby_implementations_depend |
|
|
287 | # @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND. |
|
|
288 | # @DESCRIPTION: |
|
|
289 | # Produces the dependency string for the various implementations of ruby |
|
|
290 | # which the package is being built against. This should not be used when |
|
|
291 | # RUBY_OPTIONAL is unset but must be used if RUBY_OPTIONAL=yes. Do not |
|
|
292 | # confuse this function with ruby_implementation_depend(). |
|
|
293 | # |
|
|
294 | # @EXAMPLE: |
|
|
295 | # EAPI=4 |
|
|
296 | # RUBY_OPTIONAL=yes |
|
|
297 | # |
|
|
298 | # inherit ruby-ng |
|
|
299 | # ... |
|
|
300 | # DEPEND="ruby? ( $(ruby_implementations_depend) )" |
|
|
301 | # RDEPEND="${DEPEND}" |
|
|
302 | ruby_implementations_depend() { |
|
|
303 | local depend |
| 214 | for _ruby_implementation in $USE_RUBY; do |
304 | for _ruby_implementation in ${USE_RUBY}; do |
| 215 | IUSE="${IUSE} ruby_targets_${_ruby_implementation}" |
305 | depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
|
|
306 | done |
|
|
307 | echo "${depend}" |
|
|
308 | } |
| 216 | |
309 | |
|
|
310 | IUSE+=" $(ruby_get_use_targets)" |
| 217 | # If you specify RUBY_OPTIONAL you also need to take care of |
311 | # If you specify RUBY_OPTIONAL you also need to take care of |
| 218 | # ruby useflag and dependency. |
312 | # ruby useflag and dependency. |
| 219 | if [[ ${RUBY_OPTIONAL} != "yes" ]]; then |
313 | if [[ ${RUBY_OPTIONAL} != yes ]]; then |
| 220 | DEPEND="${DEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
314 | DEPEND="${DEPEND} $(ruby_implementations_depend)" |
| 221 | RDEPEND="${RDEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
315 | RDEPEND="${RDEPEND} $(ruby_implementations_depend)" |
|
|
316 | |
|
|
317 | [[ ${EAPI:-0} -ge 4 ]] && REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" |
| 222 | fi |
318 | fi |
| 223 | done |
|
|
| 224 | |
319 | |
| 225 | _ruby_invoke_environment() { |
320 | _ruby_invoke_environment() { |
| 226 | old_S=${S} |
321 | old_S=${S} |
|
|
322 | case ${EAPI} in |
|
|
323 | 4) |
|
|
324 | if [ -z ${RUBY_S} ]; then |
|
|
325 | sub_S=${P} |
|
|
326 | else |
|
|
327 | sub_S=${RUBY_S} |
|
|
328 | fi |
|
|
329 | ;; |
|
|
330 | *) |
| 227 | sub_S=${S#${WORKDIR}/} |
331 | sub_S=${S#${WORKDIR}/} |
|
|
332 | ;; |
|
|
333 | esac |
| 228 | |
334 | |
| 229 | # Special case, for the always-lovely GitHub fetches. With this, |
335 | # Special case, for the always-lovely GitHub fetches. With this, |
| 230 | # we allow the star glob to just expand to whatever directory it's |
336 | # we allow the star glob to just expand to whatever directory it's |
| 231 | # called. |
337 | # called. |
| 232 | if [[ ${sub_S} = *"*" ]]; then |
338 | if [[ ${sub_S} = *"*"* ]]; then |
|
|
339 | case ${EAPI} in |
|
|
340 | 2|3) |
|
|
341 | #The old method of setting S depends on undefined package |
|
|
342 | # manager behaviour, so encourage upgrading to EAPI=4. |
|
|
343 | eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead." |
|
|
344 | ;; |
|
|
345 | esac |
| 233 | pushd "${WORKDIR}"/all &>/dev/null |
346 | pushd "${WORKDIR}"/all &>/dev/null |
| 234 | sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
347 | sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
| 235 | popd &>/dev/null |
348 | popd &>/dev/null |
| 236 | fi |
349 | fi |
| 237 | |
350 | |
| … | |
… | |
| 259 | local invoked=no |
372 | local invoked=no |
| 260 | for _ruby_implementation in ${USE_RUBY}; do |
373 | for _ruby_implementation in ${USE_RUBY}; do |
| 261 | # only proceed if it's requested |
374 | # only proceed if it's requested |
| 262 | use ruby_targets_${_ruby_implementation} || continue |
375 | use ruby_targets_${_ruby_implementation} || continue |
| 263 | |
376 | |
| 264 | local _ruby_name=$_ruby_implementation |
377 | RUBY=$(ruby_implementation_command ${_ruby_implementation}) |
| 265 | |
|
|
| 266 | # Add all USE_RUBY values where the flag name diverts from the binary here |
|
|
| 267 | case $_ruby_implementation in |
|
|
| 268 | ree18) |
|
|
| 269 | _ruby_name=rubyee18 |
|
|
| 270 | ;; |
|
|
| 271 | esac |
|
|
| 272 | |
|
|
| 273 | RUBY=$(type -p $_ruby_name 2>/dev/null) |
|
|
| 274 | invoked=yes |
378 | invoked=yes |
| 275 | |
379 | |
| 276 | if [[ -n "$1" ]]; then |
380 | if [[ -n "$1" ]]; then |
| 277 | _ruby_invoke_environment $_ruby_implementation "$@" |
381 | _ruby_invoke_environment ${_ruby_implementation} "$@" |
| 278 | fi |
382 | fi |
| 279 | |
383 | |
| 280 | unset RUBY |
384 | unset RUBY |
| 281 | done |
385 | done |
| 282 | |
386 | |
| 283 | [[ ${invoked} == "no" ]] && die "You need to select at least one Ruby implementation by setting RUBY_TARGETS in /etc/make.conf." |
387 | if [[ ${invoked} == "no" ]]; then |
|
|
388 | eerror "You need to select at least one compatible Ruby installation target via RUBY_TARGETS in make.conf." |
|
|
389 | eerror "Compatible targets for this package are: ${USE_RUBY}" |
|
|
390 | eerror |
|
|
391 | eerror "See http://www.gentoo.org/proj/en/prog_lang/ruby/index.xml#doc_chap3 for more information." |
|
|
392 | eerror |
|
|
393 | die "No compatible Ruby target selected." |
|
|
394 | fi |
| 284 | } |
395 | } |
| 285 | |
396 | |
| 286 | # @FUNCTION: ruby-ng_pkg_setup |
397 | # @FUNCTION: ruby-ng_pkg_setup |
| 287 | # @DESCRIPTION: |
398 | # @DESCRIPTION: |
| 288 | # Check whether at least one ruby target implementation is present. |
399 | # Check whether at least one ruby target implementation is present. |
| 289 | ruby-ng_pkg_setup() { |
400 | ruby-ng_pkg_setup() { |
| 290 | # This only checks that at least one implementation is present |
401 | # This only checks that at least one implementation is present |
| 291 | # before doing anything; by leaving the parameters empty we know |
402 | # before doing anything; by leaving the parameters empty we know |
| 292 | # it's a special case. |
403 | # it's a special case. |
| 293 | _ruby_each_implementation |
404 | _ruby_each_implementation |
|
|
405 | |
|
|
406 | has ruby_targets_jruby ${IUSE} && use ruby_targets_jruby && java-pkg_setup-vm |
| 294 | } |
407 | } |
| 295 | |
408 | |
| 296 | # @FUNCTION: ruby-ng_src_unpack |
409 | # @FUNCTION: ruby-ng_src_unpack |
| 297 | # @DESCRIPTION: |
410 | # @DESCRIPTION: |
| 298 | # Unpack the source archive. |
411 | # Unpack the source archive. |
| … | |
… | |
| 389 | type all_ruby_test &>/dev/null && \ |
502 | type all_ruby_test &>/dev/null && \ |
| 390 | _ruby_invoke_environment all all_ruby_test |
503 | _ruby_invoke_environment all all_ruby_test |
| 391 | } |
504 | } |
| 392 | |
505 | |
| 393 | _each_ruby_check_install() { |
506 | _each_ruby_check_install() { |
|
|
507 | local scancmd=scanelf |
|
|
508 | # we have a Mach-O object here |
|
|
509 | [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho |
|
|
510 | |
|
|
511 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
|
|
512 | |
| 394 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') |
513 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["LIBRUBY_SO"]') |
| 395 | local libruby_soname=$(scanelf -qS "/usr/$(get_libdir)/${libruby_basename}" | awk '{ print $1 }') |
514 | local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null) |
| 396 | local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') |
515 | local sitedir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]') |
| 397 | local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') |
516 | local sitelibdir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]') |
| 398 | |
517 | |
| 399 | # Look for wrong files in sitedir |
518 | # Look for wrong files in sitedir |
| 400 | if [[ -d "${D}${sitedir}" ]]; then |
519 | # if [[ -d "${D}${sitedir}" ]]; then |
| 401 | local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") |
520 | # local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") |
| 402 | if [[ -n ${f} ]]; then |
521 | # if [[ -n ${f} ]]; then |
| 403 | eerror "Found files in sitedir, outsite sitelibdir:" |
522 | # eerror "Found files in sitedir, outsite sitelibdir:" |
| 404 | eerror "${f}" |
523 | # eerror "${f}" |
| 405 | die "Misplaced files in sitedir" |
524 | # die "Misplaced files in sitedir" |
| 406 | fi |
525 | # fi |
| 407 | fi |
526 | # fi |
| 408 | |
527 | |
| 409 | # The current implementation lacks libruby (i.e.: jruby) |
528 | # The current implementation lacks libruby (i.e.: jruby) |
| 410 | [[ -z ${libruby_soname} ]] && return 0 |
529 | [[ -z ${libruby_soname} ]] && return 0 |
| 411 | |
530 | |
| 412 | scanelf -qnR "${D}${sitedir}" \ |
531 | # Check also the gems directory, since we could be installing compiled |
|
|
532 | # extensions via ruby-fakegem; make sure to check only in sitelibdir, since |
|
|
533 | # that's what changes between two implementations (otherwise you'd get false |
|
|
534 | # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8) |
|
|
535 | ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \ |
| 413 | | fgrep -v "${libruby_soname}" \ |
536 | | fgrep -v "${libruby_soname}" \ |
|
|
537 | | grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \ |
| 414 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
538 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
| 415 | |
539 | |
| 416 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
540 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
| 417 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}" |
541 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}" |
| 418 | ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) |
542 | ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) |
| … | |
… | |
| 437 | |
561 | |
| 438 | # @FUNCTION: ruby_rbconfig_value |
562 | # @FUNCTION: ruby_rbconfig_value |
| 439 | # @USAGE: rbconfig item |
563 | # @USAGE: rbconfig item |
| 440 | # @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}. |
564 | # @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}. |
| 441 | ruby_rbconfig_value() { |
565 | ruby_rbconfig_value() { |
| 442 | echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']") |
566 | echo $(${RUBY} -rrbconfig -e "puts RbConfig::CONFIG['$1']") |
| 443 | } |
567 | } |
| 444 | |
568 | |
| 445 | # @FUNCTION: doruby |
569 | # @FUNCTION: doruby |
| 446 | # @USAGE: file [file...] |
570 | # @USAGE: file [file...] |
| 447 | # @DESCRIPTION: |
571 | # @DESCRIPTION: |
| 448 | # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. |
572 | # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. |
| 449 | doruby() { |
573 | doruby() { |
| 450 | [[ -z ${RUBY} ]] && die "\$RUBY is not set" |
574 | [[ -z ${RUBY} ]] && die "\$RUBY is not set" |
|
|
575 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
| 451 | ( # don't want to pollute calling env |
576 | ( # don't want to pollute calling env |
| 452 | insinto $(ruby_rbconfig_value 'sitelibdir') |
577 | sitelibdir=$(ruby_rbconfig_value 'sitelibdir') |
|
|
578 | insinto ${sitelibdir#${EPREFIX}} |
| 453 | insopts -m 0644 |
579 | insopts -m 0644 |
| 454 | doins "$@" |
580 | doins "$@" |
| 455 | ) || die "failed to install $@" |
581 | ) || die "failed to install $@" |
| 456 | } |
582 | } |
| 457 | |
583 | |
| 458 | # @FUNCTION: ruby_get_libruby |
584 | # @FUNCTION: ruby_get_libruby |
| 459 | # @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}. |
585 | # @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}. |
| 460 | ruby_get_libruby() { |
586 | ruby_get_libruby() { |
| 461 | ${RUBY} -rrbconfig -e 'puts File.join(Config::CONFIG["libdir"], Config::CONFIG["LIBRUBY"])' |
587 | ${RUBY} -rrbconfig -e 'puts File.join(RbConfig::CONFIG["libdir"], RbConfig::CONFIG["LIBRUBY"])' |
| 462 | } |
588 | } |
| 463 | |
589 | |
| 464 | # @FUNCTION: ruby_get_hdrdir |
590 | # @FUNCTION: ruby_get_hdrdir |
| 465 | # @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}. |
591 | # @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}. |
| 466 | ruby_get_hdrdir() { |
592 | ruby_get_hdrdir() { |
| … | |
… | |
| 491 | echo "ree" |
617 | echo "ree" |
| 492 | ;; |
618 | ;; |
| 493 | *jruby*) |
619 | *jruby*) |
| 494 | echo "jruby" |
620 | echo "jruby" |
| 495 | ;; |
621 | ;; |
|
|
622 | *rubinius*) |
|
|
623 | echo "rbx" |
|
|
624 | ;; |
| 496 | *) |
625 | *) |
| 497 | echo "mri" |
626 | echo "mri" |
| 498 | ;; |
627 | ;; |
| 499 | esac |
628 | esac |
| 500 | } |
629 | } |
|
|
630 | |
|
|
631 | # @FUNCTION: ruby-ng_rspec |
|
|
632 | # @DESCRIPTION: |
|
|
633 | # This is simply a wrapper around the rspec command (executed by $RUBY}) |
|
|
634 | # which also respects TEST_VERBOSE and NOCOLOR environment variables. |
|
|
635 | ruby-ng_rspec() { |
|
|
636 | if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then |
|
|
637 | ewarn "Missing dev-ruby/rspec in \${DEPEND}" |
|
|
638 | fi |
|
|
639 | |
|
|
640 | local rspec_params= |
|
|
641 | case ${NOCOLOR} in |
|
|
642 | 1|yes|true) |
|
|
643 | rspec_params+=" --no-color" |
|
|
644 | ;; |
|
|
645 | *) |
|
|
646 | rspec_params+=" --color" |
|
|
647 | ;; |
|
|
648 | esac |
|
|
649 | |
|
|
650 | case ${TEST_VERBOSE} in |
|
|
651 | 1|yes|true) |
|
|
652 | rspec_params+=" --format documentation" |
|
|
653 | ;; |
|
|
654 | *) |
|
|
655 | rspec_params+=" --format progress" |
|
|
656 | ;; |
|
|
657 | esac |
|
|
658 | |
|
|
659 | ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed" |
|
|
660 | } |
|
|
661 | |
|
|
662 | # @FUNCTION: ruby-ng_cucumber |
|
|
663 | # @DESCRIPTION: |
|
|
664 | # This is simply a wrapper around the cucumber command (executed by $RUBY}) |
|
|
665 | # which also respects TEST_VERBOSE and NOCOLOR environment variables. |
|
|
666 | ruby-ng_cucumber() { |
|
|
667 | if [[ ${DEPEND} != *"dev-util/cucumber"* ]]; then |
|
|
668 | ewarn "Missing dev-util/cucumber in \${DEPEND}" |
|
|
669 | fi |
|
|
670 | |
|
|
671 | local cucumber_params= |
|
|
672 | case ${NOCOLOR} in |
|
|
673 | 1|yes|true) |
|
|
674 | cucumber_params+=" --no-color" |
|
|
675 | ;; |
|
|
676 | *) |
|
|
677 | cucumber_params+=" --color" |
|
|
678 | ;; |
|
|
679 | esac |
|
|
680 | |
|
|
681 | case ${TEST_VERBOSE} in |
|
|
682 | 1|yes|true) |
|
|
683 | cucumber_params+=" --format pretty" |
|
|
684 | ;; |
|
|
685 | *) |
|
|
686 | cucumber_params+=" --format progress" |
|
|
687 | ;; |
|
|
688 | esac |
|
|
689 | |
|
|
690 | ${RUBY} -S cucumber ${cucumber_params} "$@" || die "cucumber failed" |
|
|
691 | } |
|
|
692 | |
|
|
693 | # @FUNCTION: ruby-ng_testrb-2 |
|
|
694 | # @DESCRIPTION: |
|
|
695 | # This is simply a replacement for the testrb command that load the test |
|
|
696 | # files and execute them, with test-unit 2.x. This actually requires |
|
|
697 | # either an old test-unit-2 version or 2.5.1-r1 or later, as they remove |
|
|
698 | # their script and we installed a broken wrapper for a while. |
|
|
699 | # This also respects TEST_VERBOSE and NOCOLOR environment variables. |
|
|
700 | ruby-ng_testrb-2() { |
|
|
701 | if [[ ${DEPEND} != *"dev-ruby/test-unit"* ]]; then |
|
|
702 | ewarn "Missing dev-ruby/test-unit in \${DEPEND}" |
|
|
703 | fi |
|
|
704 | |
|
|
705 | local testrb_params= |
|
|
706 | case ${NOCOLOR} in |
|
|
707 | 1|yes|true) |
|
|
708 | testrb_params+=" --no-use-color" |
|
|
709 | ;; |
|
|
710 | *) |
|
|
711 | testrb_params+=" --use-color=auto" |
|
|
712 | ;; |
|
|
713 | esac |
|
|
714 | |
|
|
715 | case ${TEST_VERBOSE} in |
|
|
716 | 1|yes|true) |
|
|
717 | testrb_params+=" --verbose=verbose" |
|
|
718 | ;; |
|
|
719 | *) |
|
|
720 | testrb_params+=" --verbose=normal" |
|
|
721 | ;; |
|
|
722 | esac |
|
|
723 | |
|
|
724 | ${RUBY} -S testrb-2 ${testrb_params} "$@" || die "testrb-2 failed" |
|
|
725 | } |