/[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.9 Revision 1.11
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.9 2010/04/02 20:26:21 a3li Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.11 2010/04/26 15:07:58 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# 8#
416 416
417 _PHASE="check install" \ 417 _PHASE="check install" \
418 _ruby_each_implementation _each_ruby_check_install 418 _ruby_each_implementation _each_ruby_check_install
419} 419}
420 420
421# @FUNCTION: ruby_rbconfig_value
422# @USAGE: rbconfig item
423# @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}.
424ruby_rbconfig_value() {
425 echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']")
426}
427
421# @FUNCTION: doruby 428# @FUNCTION: doruby
422# @USAGE: file [file...] 429# @USAGE: file [file...]
423# @DESCRIPTION: 430# @DESCRIPTION:
424# Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. 431# Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}.
425doruby() { 432doruby() {
426 [[ -z ${RUBY} ]] && die "\$RUBY is not set" 433 [[ -z ${RUBY} ]] && die "\$RUBY is not set"
427 ( # don't want to pollute calling env 434 ( # don't want to pollute calling env
428 insinto $(${RUBY} -rrbconfig -e 'print Config::CONFIG["sitelibdir"]') 435 insinto $(ruby_rbconfig_value 'sitelibdir')
429 insopts -m 0644 436 insopts -m 0644
430 doins "$@" 437 doins "$@"
431 ) || die "failed to install $@" 438 ) || die "failed to install $@"
432} 439}
433 440
438} 445}
439 446
440# @FUNCTION: ruby_get_hdrdir 447# @FUNCTION: ruby_get_hdrdir
441# @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}. 448# @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}.
442ruby_get_hdrdir() { 449ruby_get_hdrdir() {
443 local rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"]') 450 local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir')
444 451
445 if [[ "${rubyhdrdir}" = "nil" ]] ; then 452 if [[ "${rubyhdrdir}" = "nil" ]] ; then
446 rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["archdir"]') 453 rubyhdrdir=$(ruby_rbconfig_value 'archdir')
447 fi 454 fi
448 455
449 echo "${rubyhdrdir}" 456 echo "${rubyhdrdir}"
450} 457}
458
459# @FUNCTION: ruby_get_version
460# @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
461ruby_get_version() {
462 local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
463
464 echo $(${ruby} -e 'puts RUBY_VERSION')
465}
466
467# @FUNCTION: ruby_get_implementation
468# @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
469ruby_get_implementation() {
470 local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
471
472 case $(${ruby} --version) in
473 *Enterprise*)
474 echo "ree"
475 ;;
476 *jruby*)
477 echo "jruby"
478 ;;
479 *)
480 echo "mri"
481 ;;
482 esac
483}

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20