/[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.4 Revision 1.38
1# Copyright 1999-2004 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.4 2009/12/05 11:33:10 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.38 2011/07/22 09:41:17 graaff 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#
31# 31#
32# * each_ruby_configure 32# * each_ruby_configure
33# * all_ruby_configure 33# * all_ruby_configure
34 34
35# @ECLASS-VARIABLE: USE_RUBY 35# @ECLASS-VARIABLE: USE_RUBY
36# @REQUIRED
36# @DESCRIPTION: 37# @DESCRIPTION:
37# This variable contains a space separated list of targets (see above) a package 38# 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 39# is compatible to. It must be set before the `inherit' call. There is no
39# default. All ebuilds are expected to set this variable. 40# default. All ebuilds are expected to set this variable.
40 41
41# @ECLASS-VARIABLE: RUBY_PATCHES 42# @ECLASS-VARIABLE: RUBY_PATCHES
43# @DEFAULT_UNSET
42# @DESCRIPTION: 44# @DESCRIPTION:
43# A String or Array of filenames of patches to apply to all implementations. 45# A String or Array of filenames of patches to apply to all implementations.
44 46
45# @ECLASS-VARIABLE: RUBY_OPTIONAL 47# @ECLASS-VARIABLE: RUBY_OPTIONAL
46# @DESCRIPTION: 48# @DESCRIPTION:
47# Set the value to "yes" to make the dependency on a Ruby interpreter optional. 49# Set the value to "yes" to make the dependency on a Ruby interpreter
50# optional and then ruby_implementations_depend() to help populate
51# DEPEND and RDEPEND.
52
53# @ECLASS-VARIABLE: RUBY_S
54# @DEFAULT_UNSET
55# @DESCRIPTION:
56# If defined this variable determines the source directory name after
57# unpacking. This defaults to the name of the package. Note that this
58# variable supports a wildcard mechanism to help with github tarballs
59# that contain the commit hash as part of the directory name.
60
61# @ECLASS-VARIABLE: RUBY_QA_ALLOWED_LIBS
62# @DEFAULT_UNSET
63# @DESCRIPTION:
64# If defined this variable contains a whitelist of shared objects that
65# are allowed to exist even if they don't link to libruby. This avoids
66# the QA check that makes this mandatory. This is most likely not what
67# you are looking for if you get the related "Missing links" QA warning,
68# since the proper fix is almost always to make sure the shared object
69# is linked against libruby. There are cases were this is not the case
70# and the shared object is generic code to be used in some other way
71# (e.g. selenium's firefox driver extension). When set this argument is
72# passed to "grep -E" to remove reporting of these shared objects.
48 73
49inherit eutils toolchain-funcs 74inherit eutils toolchain-funcs
50 75
51EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup 76EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup
52 77
53case ${EAPI} in 78case ${EAPI} in
54 0|1) 79 0|1)
55 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; 80 die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
56 2) ;; 81 2|3) ;;
82 4)
83 # S is no longer automatically assigned when it doesn't exist.
84 S="${WORKDIR}"
85 ;;
57 *) 86 *)
58 die "Unknown EAPI=${EAPI} for ruby-ng.eclass" 87 die "Unknown EAPI=${EAPI} for ruby-ng.eclass"
59esac 88esac
60 89
61# @FUNCTION: ruby_implementation_depend 90# @FUNCTION: ruby_implementation_depend
110 done 139 done
111 140
112 echo "[${res%,}]" 141 echo "[${res%,}]"
113} 142}
114 143
144_ruby_atoms_samelib_generic() {
145 eshopts_push -o noglob
146 echo "RUBYTARGET? ("
147 for token in $*; do
148 case "$token" in
149 "||" | "(" | ")" | *"?")
150 echo "${token}" ;;
151 *])
152 echo "${token%[*}[RUBYTARGET,${token/*[}" ;;
153 *)
154 echo "${token}[RUBYTARGET]" ;;
155 esac
156 done
157 echo ")"
158 eshopts_pop
159}
160
161# @FUNCTION: ruby_implementation_command
162# @RETURN: the path to the given ruby implementation
163# @DESCRIPTION:
164# Not all implementations have the same command basename as the
165# target; namely Ruby Enterprise 1.8 uses ree18 and rubyee18
166# respectively. This function translate between the two
115_ruby_implementation_depend() { 167ruby_implementation_command() {
116 echo "ruby_targets_${1}? ( ${2}[ruby_targets_${1}] )" 168 local _ruby_name=$1
117}
118 169
119_ruby_add_bdepend() { 170 # Add all USE_RUBY values where the flag name diverts from the binary here
120 local atom=$1 171 case $1 in
172 ree18)
173 _ruby_name=rubyee18
174 ;;
175 esac
176
177 echo $(type -p ${_ruby_name} 2>/dev/null)
178}
179
180_ruby_atoms_samelib() {
181 local atoms=$(_ruby_atoms_samelib_generic "$*")
182
183 for _ruby_implementation in $USE_RUBY; do
184 echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
185 done
186}
187
188_ruby_wrap_conditions() {
121 local conditions=$2 189 local conditions="$1"
190 local atoms="$2"
122 191
123 for condition in $conditions; do 192 for condition in $conditions; do
124 atom="${condition}? ( ${atom} )" 193 atoms="${condition}? ( ${atoms} )"
125 done 194 done
126 195
127 DEPEND="${DEPEND} ${atom}" 196 echo "$atoms"
128 RDEPEND="${RDEPEND}"
129}
130
131_ruby_add_rdepend() {
132 local atom=$1
133 local conditions=$2
134
135 for condition in $conditions; do
136 atom="${condition}? ( ${atom} )"
137 done
138
139 RDEPEND="${RDEPEND} ${atom}"
140 _ruby_add_bdepend "$atom" test
141} 197}
142 198
143# @FUNCTION: ruby_add_rdepend 199# @FUNCTION: ruby_add_rdepend
144# @USAGE: [conditions] atom 200# @USAGE: dependencies
145# @DESCRIPTION: 201# @DESCRIPTION:
146# Adds the specified atom(s) with optional use condition(s) to 202# Adds the specified dependencies, with use condition(s) to RDEPEND,
147# RDEPEND, taking the current set of ruby targets into account. This 203# taking the current set of ruby targets into account. This makes sure
148# makes sure that all ruby dependencies of the package are installed 204# that all ruby dependencies of the package are installed for the same
149# for the same ruby targets. Use this function for all ruby 205# ruby targets. Use this function for all ruby dependencies instead of
150# dependencies instead of setting RDEPEND yourself. Both atom and 206# setting RDEPEND yourself. The list of atoms uses the same syntax as
151# conditions can be a space-separated list of atoms or conditions. 207# normal dependencies.
208#
209# Note: runtime dependencies are also added as build-time test
210# dependencies.
152ruby_add_rdepend() { 211ruby_add_rdepend() {
153 local atoms=
154 local conditions=
155 case $# in 212 case $# in
156 1) 213 1) ;;
157 atoms=$1
158 ;;
159 2) 214 2)
160 conditions=$1 215 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF"
161 atoms=$2 216 ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")"
217 return
162 ;; 218 ;;
163 *) 219 *)
164 die "bad number of arguments to $0" 220 die "bad number of arguments to $0"
165 ;; 221 ;;
166 esac 222 esac
167 223
168 for atom in $atoms; do 224 local dependency=$(_ruby_atoms_samelib "$1")
169 _ruby_add_rdepend "${atom}$(ruby_samelib)" "$conditions" 225
170 done 226 RDEPEND="${RDEPEND} $dependency"
227
228 # Add the dependency as a test-dependency since we're going to
229 # execute the code during test phase.
230 DEPEND="${DEPEND} test? ( ${dependency} )"
231 has test "$IUSE" || IUSE="${IUSE} test"
171} 232}
172 233
173# @FUNCTION: ruby_add_bdepend 234# @FUNCTION: ruby_add_bdepend
174# @USAGE: [conditions] atom 235# @USAGE: dependencies
175# @DESCRIPTION: 236# @DESCRIPTION:
176# Adds the specified atom(s) with optional use condition(s) to both 237# Adds the specified dependencies, with use condition(s) to DEPEND,
177# DEPEND and RDEPEND, taking the current set of ruby targets into 238# taking the current set of ruby targets into account. This makes sure
178# account. This makes sure that all ruby dependencies of the package 239# that all ruby dependencies of the package are installed for the same
179# are installed for the same ruby targets. Use this function for all 240# ruby targets. Use this function for all ruby dependencies instead of
180# ruby dependencies instead of setting DEPEND and RDEPEND 241# setting DEPEND yourself. The list of atoms uses the same syntax as
181# yourself. Both atom and conditions can be a space-separated list of 242# normal dependencies.
182# atoms or conditions.
183ruby_add_bdepend() { 243ruby_add_bdepend() {
184 local atoms=
185 local conditions=
186 case $# in 244 case $# in
187 1) 245 1) ;;
188 atoms=$1
189 ;;
190 2) 246 2)
191 conditions=$1 247 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF"
192 atoms=$2 248 ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")"
249 return
193 ;; 250 ;;
194 *) 251 *)
195 die "bad number of arguments to $0" 252 die "bad number of arguments to $0"
196 ;; 253 ;;
197 esac 254 esac
198 255
199 for atom in $atoms; do 256 local dependency=$(_ruby_atoms_samelib "$1")
200 _ruby_add_bdepend "${atom}$(ruby_samelib)" "$conditions"
201 done
202}
203 257
258 DEPEND="${DEPEND} $dependency"
259 RDEPEND="${RDEPEND}"
260}
261
262# @FUNCTION: ruby_get_use_implementations
263# @DESCRIPTION:
264# Gets an array of ruby use targets enabled by the user
265ruby_get_use_implementations() {
266 local i implementation
267 for implementation in ${USE_RUBY}; do
268 use ruby_targets_${implementation} && i+=" ${implementation}"
269 done
270 echo $i
271}
272
273# @FUNCTION: ruby_get_use_targets
274# @DESCRIPTION:
275# Gets an array of ruby use targets that the ebuild sets
276ruby_get_use_targets() {
277 local t implementation
278 for implementation in ${USE_RUBY}; do
279 t+=" ruby_targets_${implementation}"
280 done
281 echo $t
282}
283
284if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then
285 REQUIRED_USE=" || ( $(ruby_get_use_targets) )"
286fi
287
288# @FUNCTION: ruby_implementations_depend
289# @RETURN: Dependencies suitable for injection into DEPEND and RDEPEND.
290# @DESCRIPTION:
291# Produces the dependency string for the various implementations of ruby
292# which the package is being built against. This should not be used when
293# RUBY_OPTIONAL is unset but must be used if RUBY_OPTIONAL=yes. Do not
294# confuse this function with ruby_implementation_depend().
295#
296# @EXAMPLE:
297# EAPI=4
298# RUBY_OPTIONAL=yes
299#
300# inherit ruby-ng
301# ...
302# DEPEND="ruby? ( $(ruby_implementations_depend) )"
303# RDEPEND="${DEPEND}"
304ruby_implementations_depend() {
305 local depend
306 for _ruby_implementation in ${USE_RUBY}; do
307 depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
308 done
309 echo "${depend}"
310}
311
204for _ruby_implementation in $USE_RUBY; do 312for _ruby_implementation in ${USE_RUBY}; do
205 IUSE="${IUSE} ruby_targets_${_ruby_implementation}" 313 IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
206
207 # If you specify RUBY_OPTIONAL you also need to take care of
208 # ruby useflag and dependency.
209 if [[ ${RUBY_OPTIONAL} != "yes" ]]; then
210 DEPEND="${DEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
211 RDEPEND="${RDEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
212 fi
213done 314done
315# If you specify RUBY_OPTIONAL you also need to take care of
316# ruby useflag and dependency.
317if [[ ${RUBY_OPTIONAL} != yes ]]; then
318 DEPEND="${DEPEND} $(ruby_implementations_depend)"
319 RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
320fi
214 321
215_ruby_invoke_environment() { 322_ruby_invoke_environment() {
216 old_S=${S} 323 old_S=${S}
324 case ${EAPI} in
325 4)
326 if [ -z ${RUBY_S} ]; then
327 sub_S=${P}
328 else
329 sub_S=${RUBY_S}
330 fi
331 ;;
332 *)
217 sub_S=${S#${WORKDIR}} 333 sub_S=${S#${WORKDIR}/}
334 ;;
335 esac
336
337 # Special case, for the always-lovely GitHub fetches. With this,
338 # we allow the star glob to just expand to whatever directory it's
339 # called.
340 if [[ ${sub_S} = *"*"* ]]; then
341 case ${EAPI} in
342 2|3)
343 #The old method of setting S depends on undefined package
344 # manager behaviour, so encourage upgrading to EAPI=4.
345 eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead."
346 ;;
347 esac
348 pushd "${WORKDIR}"/all &>/dev/null
349 sub_S=$(eval ls -d ${sub_S} 2>/dev/null)
350 popd &>/dev/null
351 fi
218 352
219 environment=$1; shift 353 environment=$1; shift
220 354
221 my_WORKDIR="${WORKDIR}"/${environment} 355 my_WORKDIR="${WORKDIR}"/${environment}
222 S="${my_WORKDIR}"/"${sub_S}" 356 S="${my_WORKDIR}"/"${sub_S}"
240 local invoked=no 374 local invoked=no
241 for _ruby_implementation in ${USE_RUBY}; do 375 for _ruby_implementation in ${USE_RUBY}; do
242 # only proceed if it's requested 376 # only proceed if it's requested
243 use ruby_targets_${_ruby_implementation} || continue 377 use ruby_targets_${_ruby_implementation} || continue
244 378
245 RUBY=$(type -p $_ruby_implementation 2>/dev/null) 379 RUBY=$(ruby_implementation_command ${_ruby_implementation})
246 invoked=yes 380 invoked=yes
247 381
248 if [[ -n "$1" ]]; then 382 if [[ -n "$1" ]]; then
249 _ruby_invoke_environment $_ruby_implementation "$@" 383 _ruby_invoke_environment ${_ruby_implementation} "$@"
250 fi 384 fi
251 385
252 unset RUBY 386 unset RUBY
253 done 387 done
254 388
265 _ruby_each_implementation 399 _ruby_each_implementation
266} 400}
267 401
268# @FUNCTION: ruby-ng_src_unpack 402# @FUNCTION: ruby-ng_src_unpack
269# @DESCRIPTION: 403# @DESCRIPTION:
270# Unpack the source archive, including gems. 404# Unpack the source archive.
271ruby-ng_src_unpack() { 405ruby-ng_src_unpack() {
272 mkdir "${WORKDIR}"/all 406 mkdir "${WORKDIR}"/all
273 pushd "${WORKDIR}"/all &>/dev/null 407 pushd "${WORKDIR}"/all &>/dev/null
274 408
275 # We don't support an each-unpack, it's either all or nothing! 409 # We don't support an each-unpack, it's either all or nothing!
316 # almost every other ebuild. 450 # almost every other ebuild.
317 find . -name '._*' -delete 451 find . -name '._*' -delete
318 452
319 _ruby_invoke_environment all _ruby_apply_patches 453 _ruby_invoke_environment all _ruby_apply_patches
320 454
455 _PHASE="source copy" \
321 _ruby_each_implementation _ruby_source_copy 456 _ruby_each_implementation _ruby_source_copy
322 457
323 if type each_ruby_prepare &>/dev/null; then 458 if type each_ruby_prepare &>/dev/null; then
324 _ruby_each_implementation each_ruby_prepare 459 _ruby_each_implementation each_ruby_prepare
325 fi 460 fi
326} 461}
360 type all_ruby_test &>/dev/null && \ 495 type all_ruby_test &>/dev/null && \
361 _ruby_invoke_environment all all_ruby_test 496 _ruby_invoke_environment all all_ruby_test
362} 497}
363 498
364_each_ruby_check_install() { 499_each_ruby_check_install() {
500 local scancmd=scanelf
501 # we have a Mach-O object here
502 [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho
503
504 has "${EAPI}" 2 && ! use prefix && EPREFIX=
505
365 local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') 506 local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]')
366 local libruby_soname=$(scanelf -qS "/usr/$(get_libdir)/${libruby_basename}" | awk '{ print $1 }') 507 local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null)
367 local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') 508 local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]')
368 local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') 509 local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]')
369 510
370 # Look for wrong files in sitedir 511 # Look for wrong files in sitedir
371 if [[ -d "${D}${sitedir}" ]]; then 512 # if [[ -d "${D}${sitedir}" ]]; then
372 local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") 513 # local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}")
373 if [[ -n ${f} ]]; then 514 # if [[ -n ${f} ]]; then
374 eerror "Found files in sitedir, outsite sitelibdir:" 515 # eerror "Found files in sitedir, outsite sitelibdir:"
375 eerror "${f}" 516 # eerror "${f}"
376 die "Misplaced files in sitedir" 517 # die "Misplaced files in sitedir"
377 fi 518 # fi
378 fi 519 # fi
379 520
380 # The current implementation lacks libruby (i.e.: jruby) 521 # The current implementation lacks libruby (i.e.: jruby)
381 [[ -z ${libruby_soname} ]] && return 0 522 [[ -z ${libruby_soname} ]] && return 0
382 523
383 scanelf -qnR "${D}${sitedir}" \ 524 # Check also the gems directory, since we could be installing compiled
525 # extensions via ruby-fakegem; make sure to check only in sitelibdir, since
526 # that's what changes between two implementations (otherwise you'd get false
527 # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8)
528 ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \
384 | fgrep -v "${libruby_soname}" \ 529 | fgrep -v "${libruby_soname}" \
530 | grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \
385 > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log 531 > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log
386 532
387 if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then 533 if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then
388 ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby}" 534 ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}"
389 ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) 535 ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log )
390 die "Missing links to ${libruby}" 536 die "Missing links to ${libruby_soname}"
391 fi 537 fi
392} 538}
393 539
394# @FUNCTION: ruby-ng_src_install 540# @FUNCTION: ruby-ng_src_install
395# @DESCRIPTION: 541# @DESCRIPTION:
404 550
405 _PHASE="check install" \ 551 _PHASE="check install" \
406 _ruby_each_implementation _each_ruby_check_install 552 _ruby_each_implementation _each_ruby_check_install
407} 553}
408 554
555# @FUNCTION: ruby_rbconfig_value
556# @USAGE: rbconfig item
557# @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}.
558ruby_rbconfig_value() {
559 echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']")
560}
561
409# @FUNCTION: doruby 562# @FUNCTION: doruby
410# @USAGE: file [file...] 563# @USAGE: file [file...]
411# @DESCRIPTION: 564# @DESCRIPTION:
412# Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. 565# Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}.
413doruby() { 566doruby() {
414 [[ -z ${RUBY} ]] && die "\$RUBY is not set" 567 [[ -z ${RUBY} ]] && die "\$RUBY is not set"
568 has "${EAPI}" 2 && ! use prefix && EPREFIX=
415 ( # don't want to pollute calling env 569 ( # don't want to pollute calling env
416 insinto $(${RUBY} -rrbconfig -e 'print Config::CONFIG["sitelibdir"]') 570 sitelibdir=$(ruby_rbconfig_value 'sitelibdir')
571 insinto ${sitelibdir#${EPREFIX}}
417 insopts -m 0644 572 insopts -m 0644
418 doins "$@" 573 doins "$@"
419 ) || die "failed to install $@" 574 ) || die "failed to install $@"
420} 575}
421 576
426} 581}
427 582
428# @FUNCTION: ruby_get_hdrdir 583# @FUNCTION: ruby_get_hdrdir
429# @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}. 584# @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}.
430ruby_get_hdrdir() { 585ruby_get_hdrdir() {
431 local rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["rubyhdrdir"]') 586 local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir')
432 587
433 if [[ "${rubyhdrdir}" = "nil" ]] ; then 588 if [[ "${rubyhdrdir}" = "nil" ]] ; then
434 rubyhdrdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["archdir"]') 589 rubyhdrdir=$(ruby_rbconfig_value 'archdir')
435 fi 590 fi
436 591
437 echo "${rubyhdrdir}" 592 echo "${rubyhdrdir}"
438} 593}
594
595# @FUNCTION: ruby_get_version
596# @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
597ruby_get_version() {
598 local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
599
600 echo $(${ruby} -e 'puts RUBY_VERSION')
601}
602
603# @FUNCTION: ruby_get_implementation
604# @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
605ruby_get_implementation() {
606 local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
607
608 case $(${ruby} --version) in
609 *Enterprise*)
610 echo "ree"
611 ;;
612 *jruby*)
613 echo "jruby"
614 ;;
615 *)
616 echo "mri"
617 ;;
618 esac
619}

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.20