/[gentoo-x86]/eclass/ruby-ng.eclass
Gentoo

Diff of /eclass/ruby-ng.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.39 Revision 1.46
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.39 2011/08/22 04:46:32 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.46 2012/06/02 19:16:31 zmedico 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:
17# Currently available targets are: 17# Currently available targets are:
18# * ruby18 - Ruby (MRI) 1.8.x 18# * ruby18 - Ruby (MRI) 1.8.x
19# * ruby19 - Ruby (MRI) 1.9.x 19# * ruby19 - Ruby (MRI) 1.9.x
20# * ree18 - Ruby Enterprise Edition 1.8.x 20# * ree18 - Ruby Enterprise Edition 1.8.x
21# * jruby - JRuby 21# * jruby - JRuby
22# * rbx - Rubinius
22# 23#
23# This eclass does not define the implementation of the configure, 24# This eclass does not define the implementation of the configure,
24# compile, test, or install phases. Instead, the default phases are 25# compile, test, or install phases. Instead, the default phases are
25# used. Specific implementations of these phases can be provided in 26# used. Specific implementations of these phases can be provided in
26# 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
66# is linked against libruby. There are cases were this is not the case 67# is linked against libruby. There are cases were this is not the case
67# and the shared object is generic code to be used in some other way 68# and the shared object is generic code to be used in some other way
68# (e.g. selenium's firefox driver extension). When set this argument is 69# (e.g. selenium's firefox driver extension). When set this argument is
69# passed to "grep -E" to remove reporting of these shared objects. 70# passed to "grep -E" to remove reporting of these shared objects.
70 71
71inherit eutils toolchain-funcs 72inherit eutils java-utils-2 multilib toolchain-funcs
72 73
73EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup 74EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup
74 75
75case ${EAPI} in 76case ${EAPI} in
76 0|1) 77 0|1)
111 rubypn="dev-lang/ruby-enterprise" 112 rubypn="dev-lang/ruby-enterprise"
112 rubyslot=":1.8" 113 rubyslot=":1.8"
113 ;; 114 ;;
114 jruby) 115 jruby)
115 rubypn="dev-java/jruby" 116 rubypn="dev-java/jruby"
117 rubyslot=""
118 ;;
119 rbx)
120 rubypn="dev-lang/rubinius"
116 rubyslot="" 121 rubyslot=""
117 ;; 122 ;;
118 *) die "$1: unknown Ruby implementation" 123 *) die "$1: unknown Ruby implementation"
119 esac 124 esac
120 125
276 t+=" ruby_targets_${implementation}" 281 t+=" ruby_targets_${implementation}"
277 done 282 done
278 echo $t 283 echo $t
279} 284}
280 285
281if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then
282 REQUIRED_USE=" || ( $(ruby_get_use_targets) )"
283fi
284
285# @FUNCTION: ruby_implementations_depend 286# @FUNCTION: ruby_implementations_depend
286# @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND. 287# @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND.
287# @DESCRIPTION: 288# @DESCRIPTION:
288# Produces the dependency string for the various implementations of ruby 289# Produces the dependency string for the various implementations of ruby
289# 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
304 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) )"
305 done 306 done
306 echo "${depend}" 307 echo "${depend}"
307} 308}
308 309
309for _ruby_implementation in ${USE_RUBY}; do 310IUSE+=" $(ruby_get_use_targets)"
310 IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
311done
312# 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
313# ruby useflag and dependency. 312# ruby useflag and dependency.
314if [[ ${RUBY_OPTIONAL} != yes ]]; then 313if [[ ${RUBY_OPTIONAL} != yes ]]; then
315 DEPEND="${DEPEND} $(ruby_implementations_depend)" 314 DEPEND="${DEPEND} $(ruby_implementations_depend)"
316 RDEPEND="${RDEPEND} $(ruby_implementations_depend)" 315 RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
316
317 [[ ${EAPI:-0} -ge 4 ]] && REQUIRED_USE+=" || ( $(ruby_get_use_targets) )"
317fi 318fi
318 319
319_ruby_invoke_environment() { 320_ruby_invoke_environment() {
320 old_S=${S} 321 old_S=${S}
321 case ${EAPI} in 322 case ${EAPI} in
381 fi 382 fi
382 383
383 unset RUBY 384 unset RUBY
384 done 385 done
385 386
386 [[ ${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
387} 395}
388 396
389# @FUNCTION: ruby-ng_pkg_setup 397# @FUNCTION: ruby-ng_pkg_setup
390# @DESCRIPTION: 398# @DESCRIPTION:
391# Check whether at least one ruby target implementation is present. 399# Check whether at least one ruby target implementation is present.
392ruby-ng_pkg_setup() { 400ruby-ng_pkg_setup() {
393 # This only checks that at least one implementation is present 401 # This only checks that at least one implementation is present
394 # before doing anything; by leaving the parameters empty we know 402 # before doing anything; by leaving the parameters empty we know
395 # it's a special case. 403 # it's a special case.
396 _ruby_each_implementation 404 _ruby_each_implementation
405
406 has ruby_targets_jruby ${IUSE} && use ruby_targets_jruby && java-pkg_setup-vm
397} 407}
398 408
399# @FUNCTION: ruby-ng_src_unpack 409# @FUNCTION: ruby-ng_src_unpack
400# @DESCRIPTION: 410# @DESCRIPTION:
401# Unpack the source archive. 411# Unpack the source archive.
498 # we have a Mach-O object here 508 # we have a Mach-O object here
499 [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho 509 [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho
500 510
501 has "${EAPI}" 2 && ! use prefix && EPREFIX= 511 has "${EAPI}" 2 && ! use prefix && EPREFIX=
502 512
503 local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') 513 local libruby_basename=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["LIBRUBY_SO"]')
504 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)
505 local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') 515 local sitedir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]')
506 local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') 516 local sitelibdir=$(${RUBY} -rrbconfig -e 'puts RbConfig::CONFIG["sitelibdir"]')
507 517
508 # Look for wrong files in sitedir 518 # Look for wrong files in sitedir
509 # if [[ -d "${D}${sitedir}" ]]; then 519 # if [[ -d "${D}${sitedir}" ]]; then
510 # 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}")
511 # if [[ -n ${f} ]]; then 521 # if [[ -n ${f} ]]; then
551 561
552# @FUNCTION: ruby_rbconfig_value 562# @FUNCTION: ruby_rbconfig_value
553# @USAGE: rbconfig item 563# @USAGE: rbconfig item
554# @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}.
555ruby_rbconfig_value() { 565ruby_rbconfig_value() {
556 echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']") 566 echo $(${RUBY} -rrbconfig -e "puts RbConfig::CONFIG['$1']")
557} 567}
558 568
559# @FUNCTION: doruby 569# @FUNCTION: doruby
560# @USAGE: file [file...] 570# @USAGE: file [file...]
561# @DESCRIPTION: 571# @DESCRIPTION:
572} 582}
573 583
574# @FUNCTION: ruby_get_libruby 584# @FUNCTION: ruby_get_libruby
575# @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}.
576ruby_get_libruby() { 586ruby_get_libruby() {
577 ${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"])'
578} 588}
579 589
580# @FUNCTION: ruby_get_hdrdir 590# @FUNCTION: ruby_get_hdrdir
581# @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}.
582ruby_get_hdrdir() { 592ruby_get_hdrdir() {
607 echo "ree" 617 echo "ree"
608 ;; 618 ;;
609 *jruby*) 619 *jruby*)
610 echo "jruby" 620 echo "jruby"
611 ;; 621 ;;
622 *rubinius*)
623 echo "rbx"
624 ;;
612 *) 625 *)
613 echo "mri" 626 echo "mri"
614 ;; 627 ;;
615 esac 628 esac
616} 629}

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.46

  ViewVC Help
Powered by ViewVC 1.1.20