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

Contents of /eclass/ruby-single.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Thu Jul 9 07:11:25 2015 UTC (3 years, 9 months ago) by graaff
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +14 -3 lines
Update documentation.

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-single.eclass,v 1.2 2015/05/31 06:14:54 graaff Exp $
4
5 # @ECLASS: ruby-single
6 # @MAINTAINER:
7 # Ruby team <ruby@gentoo.org>
8 # @AUTHOR:
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.
12 # @DESCRIPTION:
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.
18 #
19 # @CODE
20 # USE_RUBY="ruby20 ruby21"
21 # inherit ruby-single
22 # RDEPEND="${RUBY_DEPS}"
23 # @CODE
24
25 case "${EAPI:-0}" in
26 0|1|2|3)
27 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
28 ;;
29 4|5)
30 ;;
31 *)
32 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
33 ;;
34 esac
35
36 if [[ ! ${_RUBY_SINGLE} ]]; then
37
38 inherit ruby-utils
39
40 # @ECLASS-VARIABLE: USE_RUBY
41 # @DEFAULT_UNSET
42 # @REQUIRED
43 # @DESCRIPTION:
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.
47
48
49 # @ECLASS-VARIABLE: RUBY_DEPS
50 # @DESCRIPTION:
51 #
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.
57 #
58 # Example use:
59 # @CODE
60 # RDEPEND="${RUBY_DEPS}
61 # dev-foo/mydep"
62 # BDEPEND="${RDEPEND}"
63 # @CODE
64 #
65 # Example value:
66 # @CODE
67 # || ( dev-lang/ruby:2.0 dev-lang/ruby:1.9 ) virtual/rubygems
68 # @CODE
69 #
70 # The order of dependencies will change over time to best match the
71 # current state of ruby targets, e.g. stable version first.
72
73 _ruby_single_implementations_depend() {
74 local 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)"
78 fi
79 done
80 echo "|| ( ${depend} ) virtual/rubygems"
81 }
82
83 _ruby_single_set_globals() {
84 RUBY_DEPS=$(_ruby_single_implementations_depend)
85 }
86 _ruby_single_set_globals
87
88
89 _RUBY_SINGLE=1
90 fi

  ViewVC Help
Powered by ViewVC 1.1.20