# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.10 2010/04/05 07:41:09 a3li Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.11 2010/04/26 15:07:58 a3li Exp $
#
# @ECLASS: ruby-ng.eclass
# @MAINTAINER:
_ruby_each_implementation _each_ruby_check_install
}
+# @FUNCTION: ruby_rbconfig_value
+# @USAGE: rbconfig item
+# @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}.
+ruby_rbconfig_value() {
+ echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']")
+}
+
# @FUNCTION: doruby
# @USAGE: file [file...]
# @DESCRIPTION:
doruby() {
[[ -z ${RUBY} ]] && die "\$RUBY is not set"
( # don't want to pollute calling env
- insinto $(${RUBY} -rrbconfig -e 'print Config::CONFIG["sitelibdir"]')
+ insinto $(ruby_rbconfig_value 'sitelibdir')
insopts -m 0644
doins "$@"
) || die "failed to install $@"
# @FUNCTION: ruby_get_hdrdir
# @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}.
ruby_get_hdrdir() {
- local rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"]')
+ local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir')
if [[ "${rubyhdrdir}" = "nil" ]] ; then
- rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["archdir"]')
+ rubyhdrdir=$(ruby_rbconfig_value 'archdir')
fi
echo "${rubyhdrdir}"