1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 # Ruby team <ruby@gentoo.org>
9 # Author: Hans de Graaff <graaff@gentoo.org>
10 # Based on python-single-r1 by: Michał Górny <mgorny@gentoo.org>
11 # @BLURB: An eclass for Ruby packages not installed for multiple implementations.
13 # An eclass for packages which don't support being installed for
14 # multiple Ruby implementations. This mostly includes ruby-based
15 # scripts. Set USE_RUBY to include all the ruby targets that have been
16 # verified to work and include the eclass. RUBY_DEPS is now available to
17 # pull in the dependency on the requested ruby targets.
20 # USE_RUBY="ruby20 ruby21"
22 # RDEPEND="${RUBY_DEPS}"
27 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
32 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
36 if [[ ! ${_RUBY_SINGLE} ]]; then
40 # @ECLASS-VARIABLE: USE_RUBY
44 # This variable contains a space separated list of targets (see above) a package
45 # is compatible to. It must be set before the `inherit' call. There is no
46 # default. All ebuilds are expected to set this variable.
49 # @ECLASS-VARIABLE: RUBY_DEPS
52 # This is an eclass-generated Ruby dependency string for all
53 # implementations listed in USE_RUBY. Any one of the supported ruby
54 # targets will satisfy this dependency. A dependency on
55 # virtual/rubygems is also added to ensure that this is installed
56 # in time for the package to use it.
60 # RDEPEND="${RUBY_DEPS}
62 # BDEPEND="${RDEPEND}"
67 # || ( dev-lang/ruby:2.0 dev-lang/ruby:1.9 ) virtual/rubygems
70 # The order of dependencies will change over time to best match the
71 # current state of ruby targets, e.g. stable version first.
73 _ruby_single_implementations_depend() {
75 for _ruby_implementation in ${RUBY_TARGETS_PREFERENCE}; do
76 if [[ ${USE_RUBY} =~ ${_ruby_implementation} ]]; then
77 depend="${depend} $(_ruby_implementation_depend $_ruby_implementation)"
80 echo "|| ( ${depend} ) virtual/rubygems"
83 _ruby_single_set_globals() {
84 RUBY_DEPS=$(_ruby_single_implementations_depend)
86 _ruby_single_set_globals