| 1 | # Copyright 1999-2011 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.42 2011/10/22 10:08:44 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.45 2012/02/23 23:06:13 a3li 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 | # @AUTHOR: |
8 | # @AUTHOR: |
| … | |
… | |
| 281 | t+=" ruby_targets_${implementation}" |
281 | t+=" ruby_targets_${implementation}" |
| 282 | done |
282 | done |
| 283 | echo $t |
283 | echo $t |
| 284 | } |
284 | } |
| 285 | |
285 | |
| 286 | if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then |
|
|
| 287 | REQUIRED_USE=" || ( $(ruby_get_use_targets) )" |
|
|
| 288 | fi |
|
|
| 289 | |
|
|
| 290 | # @FUNCTION: ruby_implementations_depend |
286 | # @FUNCTION: ruby_implementations_depend |
| 291 | # @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND. |
287 | # @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND. |
| 292 | # @DESCRIPTION: |
288 | # @DESCRIPTION: |
| 293 | # Produces the dependency string for the various implementations of ruby |
289 | # Produces the dependency string for the various implementations of ruby |
| 294 | # which the package is being built against. This should not be used when |
290 | # which the package is being built against. This should not be used when |
| … | |
… | |
| 309 | depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
305 | depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )" |
| 310 | done |
306 | done |
| 311 | echo "${depend}" |
307 | echo "${depend}" |
| 312 | } |
308 | } |
| 313 | |
309 | |
| 314 | for _ruby_implementation in ${USE_RUBY}; do |
310 | IUSE+=" $(ruby_get_use_targets)" |
| 315 | IUSE="${IUSE} ruby_targets_${_ruby_implementation}" |
|
|
| 316 | done |
|
|
| 317 | # 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 |
| 318 | # ruby useflag and dependency. |
312 | # ruby useflag and dependency. |
| 319 | if [[ ${RUBY_OPTIONAL} != yes ]]; then |
313 | if [[ ${RUBY_OPTIONAL} != yes ]]; then |
| 320 | DEPEND="${DEPEND} $(ruby_implementations_depend)" |
314 | DEPEND="${DEPEND} $(ruby_implementations_depend)" |
| 321 | RDEPEND="${RDEPEND} $(ruby_implementations_depend)" |
315 | RDEPEND="${RDEPEND} $(ruby_implementations_depend)" |
|
|
316 | |
|
|
317 | [[ ${EAPI:-0} -ge 4 ]] && REQUIRED_USE+=" || ( $(ruby_get_use_targets) )" |
| 322 | fi |
318 | fi |
| 323 | |
319 | |
| 324 | _ruby_invoke_environment() { |
320 | _ruby_invoke_environment() { |
| 325 | old_S=${S} |
321 | old_S=${S} |
| 326 | case ${EAPI} in |
322 | case ${EAPI} in |
| … | |
… | |
| 386 | fi |
382 | fi |
| 387 | |
383 | |
| 388 | unset RUBY |
384 | unset RUBY |
| 389 | done |
385 | done |
| 390 | |
386 | |
| 391 | [[ ${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 |
| 392 | } |
395 | } |
| 393 | |
396 | |
| 394 | # @FUNCTION: ruby-ng_pkg_setup |
397 | # @FUNCTION: ruby-ng_pkg_setup |
| 395 | # @DESCRIPTION: |
398 | # @DESCRIPTION: |
| 396 | # Check whether at least one ruby target implementation is present. |
399 | # Check whether at least one ruby target implementation is present. |
| … | |
… | |
| 505 | # we have a Mach-O object here |
508 | # we have a Mach-O object here |
| 506 | [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho |
509 | [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho |
| 507 | |
510 | |
| 508 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
511 | has "${EAPI}" 2 && ! use prefix && EPREFIX= |
| 509 | |
512 | |
| 510 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') |
513 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["LIBRUBY_SO"]') |
| 511 | local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null) |
514 | local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null) |
| 512 | local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') |
515 | local sitedir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]') |
| 513 | local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') |
516 | local sitelibdir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]') |
| 514 | |
517 | |
| 515 | # Look for wrong files in sitedir |
518 | # Look for wrong files in sitedir |
| 516 | # if [[ -d "${D}${sitedir}" ]]; then |
519 | # if [[ -d "${D}${sitedir}" ]]; then |
| 517 | # 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}") |
| 518 | # if [[ -n ${f} ]]; then |
521 | # if [[ -n ${f} ]]; then |
| … | |
… | |
| 558 | |
561 | |
| 559 | # @FUNCTION: ruby_rbconfig_value |
562 | # @FUNCTION: ruby_rbconfig_value |
| 560 | # @USAGE: rbconfig item |
563 | # @USAGE: rbconfig item |
| 561 | # @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}. |
| 562 | ruby_rbconfig_value() { |
565 | ruby_rbconfig_value() { |
| 563 | echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']") |
566 | echo $(${RUBY} -rrbconfig -e "puts RbConfig::CONFIG['$1']") |
| 564 | } |
567 | } |
| 565 | |
568 | |
| 566 | # @FUNCTION: doruby |
569 | # @FUNCTION: doruby |
| 567 | # @USAGE: file [file...] |
570 | # @USAGE: file [file...] |
| 568 | # @DESCRIPTION: |
571 | # @DESCRIPTION: |
| … | |
… | |
| 579 | } |
582 | } |
| 580 | |
583 | |
| 581 | # @FUNCTION: ruby_get_libruby |
584 | # @FUNCTION: ruby_get_libruby |
| 582 | # @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}. |
| 583 | ruby_get_libruby() { |
586 | ruby_get_libruby() { |
| 584 | ${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"])' |
| 585 | } |
588 | } |
| 586 | |
589 | |
| 587 | # @FUNCTION: ruby_get_hdrdir |
590 | # @FUNCTION: ruby_get_hdrdir |
| 588 | # @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}. |
| 589 | ruby_get_hdrdir() { |
592 | ruby_get_hdrdir() { |