/[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.11 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.11 2010/04/26 15:07:58 a3li 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() { 119_ruby_atoms_samelib() {
120 local atom=$1 120 local samelib=$(ruby_samelib)
121
122 for token in $*; do
123 case "$token" in
124 "||" | "(" | ")" | *"?")
125 echo "${token}" ;;
126 *)
127 echo "${token}${samelib}" ;;
128 esac
129 done
130}
131
132_ruby_wrap_conditions() {
121 local conditions=$2 133 local conditions="$1"
134 local atoms="$2"
122 135
123 for condition in $conditions; do 136 for condition in $conditions; do
124 hasq $condition "$IUSE" || IUSE="${IUSE} $condition" 137 hasq $condition "$IUSE" || IUSE="${IUSE} $condition"
125 atom="${condition}? ( ${atom} )" 138 atoms="${condition}? ( ${atoms} )"
126 done 139 done
127 140
128 DEPEND="${DEPEND} ${atom}" 141 echo "$atoms"
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} 142}
144 143
145# @FUNCTION: ruby_add_rdepend 144# @FUNCTION: ruby_add_rdepend
146# @USAGE: [conditions] atom 145# @USAGE: dependencies
147# @DESCRIPTION: 146# @DESCRIPTION:
148# Adds the specified atom(s) with optional use condition(s) to 147# Adds the specified dependencies, with use condition(s) to RDEPEND,
149# RDEPEND, taking the current set of ruby targets into account. This 148# taking the current set of ruby targets into account. This makes sure
150# makes sure that all ruby dependencies of the package are installed 149# that all ruby dependencies of the package are installed for the same
151# for the same ruby targets. Use this function for all ruby 150# ruby targets. Use this function for all ruby dependencies instead of
152# dependencies instead of setting RDEPEND yourself. Both atom and 151# setting RDEPEND yourself. The list of atoms uses the same syntax as
153# 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.
154ruby_add_rdepend() { 156ruby_add_rdepend() {
155 local atoms=
156 local conditions=
157 case $# in 157 case $# in
158 1) 158 1) ;;
159 atoms=$1
160 ;;
161 2) 159 2)
162 conditions=$1 160 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_rdepend for $CATEGORY/$PF"
163 atoms=$2 161 ruby_add_rdepend "$(_ruby_wrap_conditions "$1" "$2")"
162 return
164 ;; 163 ;;
165 *) 164 *)
166 die "bad number of arguments to $0" 165 die "bad number of arguments to $0"
167 ;; 166 ;;
168 esac 167 esac
169 168
170 for atom in $atoms; do 169 local dependency=$(_ruby_atoms_samelib "$1")
171 _ruby_add_rdepend "${atom}$(ruby_samelib)" "$conditions" 170
172 done 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}")"
173} 176}
174 177
175# @FUNCTION: ruby_add_bdepend 178# @FUNCTION: ruby_add_bdepend
176# @USAGE: [conditions] atom 179# @USAGE: dependencies
177# @DESCRIPTION: 180# @DESCRIPTION:
178# Adds the specified atom(s) with optional use condition(s) to both 181# Adds the specified dependencies, with use condition(s) to DEPEND,
179# DEPEND and RDEPEND, taking the current set of ruby targets into 182# taking the current set of ruby targets into account. This makes sure
180# account. This makes sure that all ruby dependencies of the package 183# that all ruby dependencies of the package are installed for the same
181# are installed for the same ruby targets. Use this function for all 184# ruby targets. Use this function for all ruby dependencies instead of
182# ruby dependencies instead of setting DEPEND and RDEPEND 185# setting DEPEND yourself. The list of atoms uses the same syntax as
183# yourself. Both atom and conditions can be a space-separated list of 186# normal dependencies.
184# atoms or conditions.
185ruby_add_bdepend() { 187ruby_add_bdepend() {
186 local atoms=
187 local conditions=
188 case $# in 188 case $# in
189 1) 189 1) ;;
190 atoms=$1
191 ;;
192 2) 190 2)
193 conditions=$1 191 [[ "${GENTOO_DEV}" == "yes" ]] && eqawarn "You can now use the usual syntax in ruby_add_bdepend for $CATEGORY/$PF"
194 atoms=$2 192 ruby_add_bdepend "$(_ruby_wrap_conditions "$1" "$2")"
193 return
195 ;; 194 ;;
196 *) 195 *)
197 die "bad number of arguments to $0" 196 die "bad number of arguments to $0"
198 ;; 197 ;;
199 esac 198 esac
200 199
201 for atom in $atoms; do 200 local dependency=$(_ruby_atoms_samelib "$1")
202 _ruby_add_bdepend "${atom}$(ruby_samelib)" "$conditions" 201
203 done 202 DEPEND="${DEPEND} $dependency"
204} 203}
205 204
206for _ruby_implementation in $USE_RUBY; do 205for _ruby_implementation in $USE_RUBY; do
207 IUSE="${IUSE} ruby_targets_${_ruby_implementation}" 206 IUSE="${IUSE} ruby_targets_${_ruby_implementation}"
208 207
214 fi 213 fi
215done 214done
216 215
217_ruby_invoke_environment() { 216_ruby_invoke_environment() {
218 old_S=${S} 217 old_S=${S}
219 sub_S=${S#${WORKDIR}} 218 sub_S=${S#${WORKDIR}/}
219
220 # Special case, for the always-lovely GitHub fetches. With this,
221 # we allow the star glob to just expand to whatever directory it's
222 # called.
223 if [[ ${sub_S} = *"*" ]]; then
224 pushd "${WORKDIR}"/all &>/dev/null
225 sub_S=$(eval ls -d ${sub_S} 2>/dev/null)
226 popd &>/dev/null
227 fi
220 228
221 environment=$1; shift 229 environment=$1; shift
222 230
223 my_WORKDIR="${WORKDIR}"/${environment} 231 my_WORKDIR="${WORKDIR}"/${environment}
224 S="${my_WORKDIR}"/"${sub_S}" 232 S="${my_WORKDIR}"/"${sub_S}"
395 scanelf -qnR "${D}${sitedir}" \ 403 scanelf -qnR "${D}${sitedir}" \
396 | fgrep -v "${libruby_soname}" \ 404 | fgrep -v "${libruby_soname}" \
397 > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log 405 > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log
398 406
399 if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then 407 if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then
400 ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby}" 408 ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}"
401 ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) 409 ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log )
402 die "Missing links to ${libruby}" 410 die "Missing links to ${libruby_soname}"
403 fi 411 fi
404} 412}
405 413
406# @FUNCTION: ruby-ng_src_install 414# @FUNCTION: ruby-ng_src_install
407# @DESCRIPTION: 415# @DESCRIPTION:

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

  ViewVC Help
Powered by ViewVC 1.1.20