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

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

  ViewVC Help
Powered by ViewVC 1.1.20