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

Contents of /eclass/ruby-ng.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.37 - (hide annotations) (download)
Fri Jul 22 09:10:22 2011 UTC (3 years, 4 months ago) by graaff
Branch: MAIN
Changes since 1.36: +12 -1 lines
Provide a convenience method to get a list of all ruby targets enabled by the user. Useful in RUBY_OPTIONAL=yes ebuilds to provide custom handling of ruby. Patch by Matthew Schultz in bug 373227.

1 a3li 1.6 # Copyright 1999-2009 Gentoo Foundation
2 graaff 1.1 # Distributed under the terms of the GNU General Public License v2
3 graaff 1.37 # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.36 2011/07/22 09:08:59 graaff Exp $
4 graaff 1.1 #
5     # @ECLASS: ruby-ng.eclass
6     # @MAINTAINER:
7     # Ruby herd <ruby@gentoo.org>
8     #
9     # Author: Diego E. Pettenò <flameeyes@gentoo.org>
10     #
11     # Author: Alex Legler <a3li@gentoo.org>
12     #
13     # Author: Hans de Graaff <graaff@gentoo.org>
14     #
15     # @BLURB: An eclass for installing Ruby packages with proper support for multiple Ruby slots.
16     # @DESCRIPTION:
17     # The Ruby eclass is designed to allow an easier installation of Ruby packages
18     # and their incorporation into the Gentoo Linux system.
19     #
20     # Currently available targets are:
21     # * ruby18 - Ruby (MRI) 1.8.x
22     # * ruby19 - Ruby (MRI) 1.9.x
23     # * ree18 - Ruby Enterprise Edition 1.8.x
24     # * jruby - JRuby
25     #
26     # This eclass does not define the implementation of the configure,
27     # compile, test, or install phases. Instead, the default phases are
28     # used. Specific implementations of these phases can be provided in
29     # the ebuild either to be run for each Ruby implementation, or for all
30     # Ruby implementations, as follows:
31     #
32     # * each_ruby_configure
33     # * all_ruby_configure
34    
35     # @ECLASS-VARIABLE: USE_RUBY
36 graaff 1.26 # @REQUIRED
37 graaff 1.1 # @DESCRIPTION:
38     # This variable contains a space separated list of targets (see above) a package
39     # is compatible to. It must be set before the `inherit' call. There is no
40     # default. All ebuilds are expected to set this variable.
41    
42     # @ECLASS-VARIABLE: RUBY_PATCHES
43 graaff 1.26 # @DEFAULT_UNSET
44 graaff 1.1 # @DESCRIPTION:
45     # A String or Array of filenames of patches to apply to all implementations.
46    
47     # @ECLASS-VARIABLE: RUBY_OPTIONAL
48     # @DESCRIPTION:
49     # Set the value to "yes" to make the dependency on a Ruby interpreter optional.
50    
51 graaff 1.31 # @ECLASS-VARIABLE: RUBY_S
52     # @DEFAULT_UNSET
53     # @DESCRIPTION:
54     # If defined this variable determines the source directory name after
55     # unpacking. This defaults to the name of the package. Note that this
56     # variable supports a wildcard mechanism to help with github tarballs
57     # that contain the commit hash as part of the directory name.
58    
59 graaff 1.34 # @ECLASS-VARIABLE: RUBY_QA_ALLOWED_LIBS
60     # @DEFAULT_UNSET
61     # @DESCRIPTION:
62     # If defined this variable contains a whitelist of shared objects that
63     # are allowed to exist even if they don't link to libruby. This avoids
64     # the QA check that makes this mandatory. This is most likely not what
65     # you are looking for if you get the related "Missing links" QA warning,
66     # since the proper fix is almost always to make sure the shared object
67     # is linked against libruby. There are cases were this is not the case
68     # and the shared object is generic code to be used in some other way
69     # (e.g. selenium's firefox driver extension). When set this argument is
70     # passed to "grep -E" to remove reporting of these shared objects.
71    
72 graaff 1.1 inherit eutils toolchain-funcs
73    
74     EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup
75    
76     case ${EAPI} in
77     0|1)
78     die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;;
79 flameeyes 1.24 2|3) ;;
80 graaff 1.31 4)
81     # S is no longer automatically assigned when it doesn't exist.
82     S="${WORKDIR}"
83     ;;
84 graaff 1.1 *)
85     die "Unknown EAPI=${EAPI} for ruby-ng.eclass"
86     esac
87    
88     # @FUNCTION: ruby_implementation_depend
89     # @USAGE: target [comparator [version]]
90     # @RETURN: Package atom of a Ruby implementation to be used in dependencies.
91     # @DESCRIPTION:
92     # This function returns the formal package atom for a Ruby implementation.
93     #
94     # `target' has to be one of the valid values for USE_RUBY (see above)
95     #
96     # Set `comparator' and `version' to include a comparator (=, >=, etc.) and a
97     # version string to the returned string
98     ruby_implementation_depend() {
99     local rubypn=
100     local rubyslot=
101    
102     case $1 in
103     ruby18)
104     rubypn="dev-lang/ruby"
105     rubyslot=":1.8"
106     ;;
107     ruby19)
108     rubypn="dev-lang/ruby"
109     rubyslot=":1.9"
110     ;;
111     ree18)
112     rubypn="dev-lang/ruby-enterprise"
113     rubyslot=":1.8"
114     ;;
115     jruby)
116     rubypn="dev-java/jruby"
117     rubyslot=""
118     ;;
119     *) die "$1: unknown Ruby implementation"
120     esac
121    
122     echo "$2${rubypn}$3${rubyslot}"
123     }
124    
125     # @FUNCTION: ruby_samelib
126     # @RETURN: use flag string with current ruby implementations
127     # @DESCRIPTION:
128     # Convenience function to output the use dependency part of a
129     # dependency. Used as a building block for ruby_add_rdepend() and
130     # ruby_add_bdepend(), but may also be useful in an ebuild to specify
131     # more complex dependencies.
132     ruby_samelib() {
133     local res=
134     for _ruby_implementation in $USE_RUBY; do
135     has -${_ruby_implementation} $@ || \
136     res="${res}ruby_targets_${_ruby_implementation}?,"
137     done
138    
139     echo "[${res%,}]"
140     }
141    
142 flameeyes 1.17 _ruby_atoms_samelib_generic() {
143 flameeyes 1.18 eshopts_push -o noglob
144 flameeyes 1.17 echo "RUBYTARGET? ("
145 flameeyes 1.14 for token in $*; do
146     case "$token" in
147 flameeyes 1.16 "||" | "(" | ")" | *"?")
148 flameeyes 1.14 echo "${token}" ;;
149 flameeyes 1.21 *])
150     echo "${token%[*}[RUBYTARGET,${token/*[}" ;;
151 flameeyes 1.14 *)
152 flameeyes 1.17 echo "${token}[RUBYTARGET]" ;;
153 flameeyes 1.14 esac
154     done
155 flameeyes 1.17 echo ")"
156 flameeyes 1.18 eshopts_pop
157 flameeyes 1.17 }
158    
159 flameeyes 1.27 # @FUNCTION: ruby_implementation_command
160     # @RETURN: the path to the given ruby implementation
161     # @DESCRIPTION:
162     # Not all implementations have the same command basename as the
163     # target; namely Ruby Enterprise 1.8 uses ree18 and rubyee18
164     # respectively. This function translate between the two
165     ruby_implementation_command() {
166     local _ruby_name=$1
167    
168     # Add all USE_RUBY values where the flag name diverts from the binary here
169     case $1 in
170     ree18)
171     _ruby_name=rubyee18
172     ;;
173     esac
174    
175     echo $(type -p ${_ruby_name} 2>/dev/null)
176     }
177    
178 flameeyes 1.17 _ruby_atoms_samelib() {
179     local atoms=$(_ruby_atoms_samelib_generic "$*")
180    
181     for _ruby_implementation in $USE_RUBY; do
182     echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
183     done
184 flameeyes 1.14 }
185    
186 flameeyes 1.16 _ruby_wrap_conditions() {
187     local conditions="$1"
188     local atoms="$2"
189    
190     for condition in $conditions; do
191     atoms="${condition}? ( ${atoms} )"
192     done
193    
194     echo "$atoms"
195     }
196    
197 graaff 1.1 # @FUNCTION: ruby_add_rdepend
198 flameeyes 1.16 # @USAGE: dependencies
199 graaff 1.1 # @DESCRIPTION:
200 flameeyes 1.16 # Adds the specified dependencies, with use condition(s) to RDEPEND,
201     # taking the current set of ruby targets into account. This makes sure
202     # that all ruby dependencies of the package are installed for the same
203     # ruby targets. Use this function for all ruby dependencies instead of
204     # setting RDEPEND yourself. The list of atoms uses the same syntax as
205     # normal dependencies.
206     #
207     # Note: runtime dependencies are also added as build-time test
208     # dependencies.
209 graaff 1.1 ruby_add_rdepend() {
210     case $# in
211 flameeyes 1.16 1) ;;
212 graaff 1.1 2)
213 flameeyes 1.16 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF"
214     ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")"
215     return
216 graaff 1.1 ;;
217     *)
218     die "bad number of arguments to $0"
219     ;;
220     esac
221    
222 flameeyes 1.16 local dependency=$(_ruby_atoms_samelib "$1")
223    
224     RDEPEND="${RDEPEND} $dependency"
225    
226     # Add the dependency as a test-dependency since we're going to
227     # execute the code during test phase.
228 flameeyes 1.20 DEPEND="${DEPEND} test? ( ${dependency} )"
229 ssuominen 1.33 has test "$IUSE" || IUSE="${IUSE} test"
230 graaff 1.1 }
231    
232     # @FUNCTION: ruby_add_bdepend
233 flameeyes 1.16 # @USAGE: dependencies
234 graaff 1.1 # @DESCRIPTION:
235 flameeyes 1.16 # Adds the specified dependencies, with use condition(s) to DEPEND,
236     # taking the current set of ruby targets into account. This makes sure
237     # that all ruby dependencies of the package are installed for the same
238     # ruby targets. Use this function for all ruby dependencies instead of
239     # setting DEPEND yourself. The list of atoms uses the same syntax as
240     # normal dependencies.
241 graaff 1.1 ruby_add_bdepend() {
242     case $# in
243 flameeyes 1.16 1) ;;
244 graaff 1.1 2)
245 flameeyes 1.16 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF"
246     ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")"
247     return
248 graaff 1.1 ;;
249     *)
250     die "bad number of arguments to $0"
251     ;;
252     esac
253    
254 flameeyes 1.16 local dependency=$(_ruby_atoms_samelib "$1")
255    
256     DEPEND="${DEPEND} $dependency"
257 flameeyes 1.19 RDEPEND="${RDEPEND}"
258 graaff 1.1 }
259    
260 graaff 1.37 # @FUNCTION: ruby_get_use_implementations
261     # @DESCRIPTION:
262     # Gets an array of ruby use targets enabled by the user
263     ruby_get_use_implementations() {
264     local i implementation
265     for implementation in ${USE_RUBY}; do
266     use ruby_targets_${implementation} && i+=" ${implementation}"
267     done
268     echo $i
269     }
270    
271 graaff 1.36 # @FUNCTION: ruby_get_use_targets
272     # @DESCRIPTION:
273     # Gets an array of ruby use targets that the ebuild sets
274     ruby_get_use_targets() {
275     local t implementation
276     for implementation in ${USE_RUBY}; do
277     t+=" ruby_targets_${implementation}"
278     done
279     echo $t
280     }
281    
282     if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then
283     REQUIRED_USE=" || ( $(ruby_get_use_targets) )"
284     fi
285    
286 graaff 1.1 for _ruby_implementation in $USE_RUBY; do
287     IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
288    
289     # If you specify RUBY_OPTIONAL you also need to take care of
290     # ruby useflag and dependency.
291     if [[ ${RUBY_OPTIONAL} != "yes" ]]; then
292     DEPEND="${DEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
293     RDEPEND="${RDEPEND} ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
294     fi
295     done
296    
297     _ruby_invoke_environment() {
298     old_S=${S}
299 graaff 1.31 case ${EAPI} in
300     4)
301 graaff 1.32 if [ -z ${RUBY_S} ]; then
302     sub_S=${P}
303     else
304     sub_S=${RUBY_S}
305     fi
306 graaff 1.31 ;;
307     *)
308     sub_S=${S#${WORKDIR}/}
309     ;;
310     esac
311 flameeyes 1.12
312     # Special case, for the always-lovely GitHub fetches. With this,
313     # we allow the star glob to just expand to whatever directory it's
314     # called.
315 flameeyes 1.28 if [[ ${sub_S} = *"*"* ]]; then
316 graaff 1.35 case ${EAPI} in
317     2|3)
318     #The old method of setting S depends on undefined package
319     # manager behaviour, so encourage upgrading to EAPI=4.
320     eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead."
321     ;;
322     esac
323 flameeyes 1.12 pushd "${WORKDIR}"/all &>/dev/null
324 flameeyes 1.13 sub_S=$(eval ls -d ${sub_S} 2>/dev/null)
325 flameeyes 1.12 popd &>/dev/null
326     fi
327 graaff 1.1
328     environment=$1; shift
329    
330     my_WORKDIR="${WORKDIR}"/${environment}
331     S="${my_WORKDIR}"/"${sub_S}"
332    
333     if [[ -d "${S}" ]]; then
334     pushd "$S" &>/dev/null
335     elif [[ -d "${my_WORKDIR}" ]]; then
336     pushd "${my_WORKDIR}" &>/dev/null
337     else
338     pushd "${WORKDIR}" &>/dev/null
339     fi
340    
341     ebegin "Running ${_PHASE:-${EBUILD_PHASE}} phase for $environment"
342     "$@"
343     popd &>/dev/null
344    
345     S=${old_S}
346     }
347    
348     _ruby_each_implementation() {
349     local invoked=no
350     for _ruby_implementation in ${USE_RUBY}; do
351     # only proceed if it's requested
352     use ruby_targets_${_ruby_implementation} || continue
353    
354 flameeyes 1.27 RUBY=$(ruby_implementation_command ${_ruby_implementation})
355 graaff 1.1 invoked=yes
356    
357     if [[ -n "$1" ]]; then
358 flameeyes 1.27 _ruby_invoke_environment ${_ruby_implementation} "$@"
359 graaff 1.1 fi
360    
361     unset RUBY
362     done
363    
364     [[ ${invoked} == "no" ]] && die "You need to select at least one Ruby implementation by setting RUBY_TARGETS in /etc/make.conf."
365     }
366    
367     # @FUNCTION: ruby-ng_pkg_setup
368     # @DESCRIPTION:
369     # Check whether at least one ruby target implementation is present.
370     ruby-ng_pkg_setup() {
371     # This only checks that at least one implementation is present
372     # before doing anything; by leaving the parameters empty we know
373     # it's a special case.
374     _ruby_each_implementation
375     }
376    
377     # @FUNCTION: ruby-ng_src_unpack
378     # @DESCRIPTION:
379 graaff 1.5 # Unpack the source archive.
380 graaff 1.1 ruby-ng_src_unpack() {
381     mkdir "${WORKDIR}"/all
382     pushd "${WORKDIR}"/all &>/dev/null
383    
384     # We don't support an each-unpack, it's either all or nothing!
385     if type all_ruby_unpack &>/dev/null; then
386     _ruby_invoke_environment all all_ruby_unpack
387     else
388     [[ -n ${A} ]] && unpack ${A}
389     fi
390    
391     popd &>/dev/null
392     }
393    
394     _ruby_apply_patches() {
395     for patch in "${RUBY_PATCHES[@]}"; do
396     if [ -f "${patch}" ]; then
397     epatch "${patch}"
398     elif [ -f "${FILESDIR}/${patch}" ]; then
399     epatch "${FILESDIR}/${patch}"
400     else
401     die "Cannot find patch ${patch}"
402     fi
403     done
404    
405     # This is a special case: instead of executing just in the special
406     # "all" environment, this will actually copy the effects on _all_
407     # the other environments, and is thus executed before the copy
408     type all_ruby_prepare &>/dev/null && all_ruby_prepare
409     }
410    
411     _ruby_source_copy() {
412     # Until we actually find a reason not to, we use hardlinks, this
413     # should reduce the amount of disk space that is wasted by this.
414 fauli 1.30 cp -prl all ${_ruby_implementation} \
415 graaff 1.1 || die "Unable to copy ${_ruby_implementation} environment"
416     }
417    
418     # @FUNCTION: ruby-ng_src_prepare
419     # @DESCRIPTION:
420     # Apply patches and prepare versions for each ruby target
421     # implementation. Also carry out common clean up tasks.
422     ruby-ng_src_prepare() {
423     # Way too many Ruby packages are prepared on OSX without removing
424     # the extra data forks, we do it here to avoid repeating it for
425     # almost every other ebuild.
426     find . -name '._*' -delete
427    
428     _ruby_invoke_environment all _ruby_apply_patches
429    
430 flameeyes 1.7 _PHASE="source copy" \
431     _ruby_each_implementation _ruby_source_copy
432 graaff 1.1
433     if type each_ruby_prepare &>/dev/null; then
434     _ruby_each_implementation each_ruby_prepare
435     fi
436     }
437    
438     # @FUNCTION: ruby-ng_src_configure
439     # @DESCRIPTION:
440     # Configure the package.
441     ruby-ng_src_configure() {
442     if type each_ruby_configure &>/dev/null; then
443     _ruby_each_implementation each_ruby_configure
444     fi
445    
446     type all_ruby_configure &>/dev/null && \
447     _ruby_invoke_environment all all_ruby_configure
448     }
449    
450     # @FUNCTION: ruby-ng_src_compile
451     # @DESCRIPTION:
452     # Compile the package.
453     ruby-ng_src_compile() {
454     if type each_ruby_compile &>/dev/null; then
455     _ruby_each_implementation each_ruby_compile
456     fi
457    
458     type all_ruby_compile &>/dev/null && \
459     _ruby_invoke_environment all all_ruby_compile
460     }
461    
462     # @FUNCTION: ruby-ng_src_test
463     # @DESCRIPTION:
464     # Run tests for the package.
465     ruby-ng_src_test() {
466     if type each_ruby_test &>/dev/null; then
467     _ruby_each_implementation each_ruby_test
468     fi
469    
470     type all_ruby_test &>/dev/null && \
471     _ruby_invoke_environment all all_ruby_test
472     }
473    
474     _each_ruby_check_install() {
475 flameeyes 1.24 local scancmd=scanelf
476     # we have a Mach-O object here
477     [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho
478    
479     has "${EAPI}" 2 && ! use prefix && EPREFIX=
480    
481 graaff 1.1 local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]')
482 flameeyes 1.25 local libruby_soname=$(basename $(${scancmd} -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") 2>/dev/null)
483 flameeyes 1.2 local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]')
484     local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]')
485    
486     # Look for wrong files in sitedir
487 flameeyes 1.22 # if [[ -d "${D}${sitedir}" ]]; then
488     # local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}")
489     # if [[ -n ${f} ]]; then
490     # eerror "Found files in sitedir, outsite sitelibdir:"
491     # eerror "${f}"
492     # die "Misplaced files in sitedir"
493     # fi
494     # fi
495 graaff 1.1
496     # The current implementation lacks libruby (i.e.: jruby)
497     [[ -z ${libruby_soname} ]] && return 0
498    
499 flameeyes 1.23 # Check also the gems directory, since we could be installing compiled
500     # extensions via ruby-fakegem; make sure to check only in sitelibdir, since
501     # that's what changes between two implementations (otherwise you'd get false
502     # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8)
503 flameeyes 1.24 ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \
504 graaff 1.1 | fgrep -v "${libruby_soname}" \
505 graaff 1.34 | grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \
506 graaff 1.1 > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log
507    
508     if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then
509 flameeyes 1.15 ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}"
510 graaff 1.1 ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log )
511 flameeyes 1.15 die "Missing links to ${libruby_soname}"
512 graaff 1.1 fi
513     }
514    
515     # @FUNCTION: ruby-ng_src_install
516     # @DESCRIPTION:
517     # Install the package for each ruby target implementation.
518     ruby-ng_src_install() {
519     if type each_ruby_install &>/dev/null; then
520     _ruby_each_implementation each_ruby_install
521     fi
522    
523     type all_ruby_install &>/dev/null && \
524     _ruby_invoke_environment all all_ruby_install
525    
526     _PHASE="check install" \
527     _ruby_each_implementation _each_ruby_check_install
528     }
529    
530 a3li 1.11 # @FUNCTION: ruby_rbconfig_value
531     # @USAGE: rbconfig item
532     # @RETURN: Returns the value of the given rbconfig item of the Ruby interpreter in ${RUBY}.
533     ruby_rbconfig_value() {
534     echo $(${RUBY} -rrbconfig -e "puts Config::CONFIG['$1']")
535     }
536    
537 graaff 1.1 # @FUNCTION: doruby
538     # @USAGE: file [file...]
539     # @DESCRIPTION:
540     # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}.
541     doruby() {
542 flameeyes 1.4 [[ -z ${RUBY} ]] && die "\$RUBY is not set"
543 flameeyes 1.24 has "${EAPI}" 2 && ! use prefix && EPREFIX=
544 graaff 1.1 ( # don't want to pollute calling env
545 flameeyes 1.24 sitelibdir=$(ruby_rbconfig_value 'sitelibdir')
546     insinto ${sitelibdir#${EPREFIX}}
547 graaff 1.1 insopts -m 0644
548     doins "$@"
549     ) || die "failed to install $@"
550     }
551    
552     # @FUNCTION: ruby_get_libruby
553     # @RETURN: The location of libruby*.so belonging to the Ruby interpreter in ${RUBY}.
554     ruby_get_libruby() {
555     ${RUBY} -rrbconfig -e 'puts File.join(Config::CONFIG["libdir"], Config::CONFIG["LIBRUBY"])'
556     }
557    
558     # @FUNCTION: ruby_get_hdrdir
559     # @RETURN: The location of the header files belonging to the Ruby interpreter in ${RUBY}.
560     ruby_get_hdrdir() {
561 a3li 1.11 local rubyhdrdir=$(ruby_rbconfig_value 'rubyhdrdir')
562 graaff 1.1
563     if [[ "${rubyhdrdir}" = "nil" ]] ; then
564 a3li 1.11 rubyhdrdir=$(ruby_rbconfig_value 'archdir')
565 graaff 1.1 fi
566    
567     echo "${rubyhdrdir}"
568     }
569 a3li 1.10
570     # @FUNCTION: ruby_get_version
571     # @RETURN: The version of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
572     ruby_get_version() {
573     local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
574    
575     echo $(${ruby} -e 'puts RUBY_VERSION')
576     }
577    
578     # @FUNCTION: ruby_get_implementation
579     # @RETURN: The implementation of the Ruby interpreter in ${RUBY}, or what 'ruby' points to.
580     ruby_get_implementation() {
581     local ruby=${RUBY:-$(type -p ruby 2>/dev/null)}
582    
583     case $(${ruby} --version) in
584     *Enterprise*)
585     echo "ree"
586     ;;
587     *jruby*)
588     echo "jruby"
589     ;;
590     *)
591     echo "mri"
592     ;;
593     esac
594     }

  ViewVC Help
Powered by ViewVC 1.1.20