/[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.15 Revision 1.16
1# Copyright 1999-2009 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.15 2010/05/22 03:39:50 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.16 2010/05/22 12:18:07 flameeyes 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#
114 114
115_ruby_implementation_depend() { 115_ruby_implementation_depend() {
116 echo "ruby_targets_${1}? ( ${2}[ruby_targets_${1}] )" 116 echo "ruby_targets_${1}? ( ${2}[ruby_targets_${1}] )"
117} 117}
118 118
119_ruby_add_bdepend() {
120 local atom=$1
121 local conditions=$2
122
123 for condition in $conditions; do
124 hasq $condition "$IUSE" || IUSE="${IUSE} $condition"
125 atom="${condition}? ( ${atom} )"
126 done
127
128 DEPEND="${DEPEND} ${atom}"
129 RDEPEND="${RDEPEND}"
130}
131
132_ruby_add_rdepend() {
133 local atom=$1
134 local conditions=$2
135
136 for condition in $conditions; do
137 hasq $condition "$IUSE" || IUSE="${IUSE} $condition"
138 atom="${condition}? ( ${atom} )"
139 done
140
141 RDEPEND="${RDEPEND} ${atom}"
142 _ruby_add_bdepend "$atom" test
143}
144
145_ruby_atoms_samelib() { 119_ruby_atoms_samelib() {
146 local samelib=$(ruby_samelib) 120 local samelib=$(ruby_samelib)
147 121
148 for token in $*; do 122 for token in $*; do
149 case "$token" in 123 case "$token" in
150 "||" | "(" | ")" ) 124 "||" | "(" | ")" | *"?")
151 echo "${token}" ;; 125 echo "${token}" ;;
152 *) 126 *)
153 echo "${token}${samelib}" ;; 127 echo "${token}${samelib}" ;;
154 esac 128 esac
155 done 129 done
156} 130}
157 131
132_ruby_wrap_conditions() {
133 local conditions="$1"
134 local atoms="$2"
135
136 for condition in $conditions; do
137 hasq $condition "$IUSE" || IUSE="${IUSE} $condition"
138 atoms="${condition}? ( ${atoms} )"
139 done
140
141 echo "$atoms"
142}
143
158# @FUNCTION: ruby_add_rdepend 144# @FUNCTION: ruby_add_rdepend
159# @USAGE: [conditions] atom 145# @USAGE: dependencies
160# @DESCRIPTION: 146# @DESCRIPTION:
161# Adds the specified atom(s) with optional use condition(s) to 147# Adds the specified dependencies, with use condition(s) to RDEPEND,
162# RDEPEND, taking the current set of ruby targets into account. This 148# taking the current set of ruby targets into account. This makes sure
163# makes sure that all ruby dependencies of the package are installed 149# that all ruby dependencies of the package are installed for the same
164# for the same ruby targets. Use this function for all ruby 150# ruby targets. Use this function for all ruby dependencies instead of
165# dependencies instead of setting RDEPEND yourself. Both atom and 151# setting RDEPEND yourself. The list of atoms uses the same syntax as
166# conditions can be a space-separated list of atoms or conditions. 152# normal dependencies.
153#
154# Note: runtime dependencies are also added as build-time test
155# dependencies.
167ruby_add_rdepend() { 156ruby_add_rdepend() {
168 local atoms=
169 local conditions=
170 case $# in 157 case $# in
171 1) 158 1) ;;
172 atoms=$1
173 ;;
174 2) 159 2)
175 conditions=$1 160 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF"
176 atoms=$2 161 ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")"
162 return
177 ;; 163 ;;
178 *) 164 *)
179 die "bad number of arguments to $0" 165 die "bad number of arguments to $0"
180 ;; 166 ;;
181 esac 167 esac
182 168
183 _ruby_add_rdepend "$(_ruby_atoms_samelib "${atoms}")" "$conditions" 169 local dependency=$(_ruby_atoms_samelib "$1")
170
171 RDEPEND="${RDEPEND} $dependency"
172
173 # Add the dependency as a test-dependency since we're going to
174 # execute the code during test phase.
175 DEPEND="${DEPEND} $(_ruby_wrap_conditions test "${dependency}")"
184} 176}
185 177
186# @FUNCTION: ruby_add_bdepend 178# @FUNCTION: ruby_add_bdepend
187# @USAGE: [conditions] atom 179# @USAGE: dependencies
188# @DESCRIPTION: 180# @DESCRIPTION:
189# Adds the specified atom(s) with optional use condition(s) to both 181# Adds the specified dependencies, with use condition(s) to DEPEND,
190# DEPEND and RDEPEND, taking the current set of ruby targets into 182# taking the current set of ruby targets into account. This makes sure
191# account. This makes sure that all ruby dependencies of the package 183# that all ruby dependencies of the package are installed for the same
192# are installed for the same ruby targets. Use this function for all 184# ruby targets. Use this function for all ruby dependencies instead of
193# ruby dependencies instead of setting DEPEND and RDEPEND 185# setting DEPEND yourself. The list of atoms uses the same syntax as
194# yourself. Both atom and conditions can be a space-separated list of 186# normal dependencies.
195# atoms or conditions.
196ruby_add_bdepend() { 187ruby_add_bdepend() {
197 local atoms=
198 local conditions=
199 case $# in 188 case $# in
200 1) 189 1) ;;
201 atoms=$1
202 ;;
203 2) 190 2)
204 conditions=$1 191 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF"
205 atoms=$2 192 ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")"
193 return
206 ;; 194 ;;
207 *) 195 *)
208 die "bad number of arguments to $0" 196 die "bad number of arguments to $0"
209 ;; 197 ;;
210 esac 198 esac
211 199
212 _ruby_add_bdepend "$(_ruby_atoms_samelib "${atoms}")" "$conditions" 200 local dependency=$(_ruby_atoms_samelib "$1")
201
202 DEPEND="${DEPEND} $dependency"
213} 203}
214 204
215for _ruby_implementation in $USE_RUBY; do 205for _ruby_implementation in $USE_RUBY; do
216 IUSE="${IUSE} ruby_targets_${_ruby_implementation}" 206 IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
217 207

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20