| 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.26 2010/08/22 07:28:24 graaff Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.28 2010/09/10 13:03:39 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 | # |
| … | |
… | |
| 129 | done |
129 | done |
| 130 | echo ")" |
130 | echo ")" |
| 131 | eshopts_pop |
131 | eshopts_pop |
| 132 | } |
132 | } |
| 133 | |
133 | |
|
|
134 | # @FUNCTION: ruby_implementation_command |
|
|
135 | # @RETURN: the path to the given ruby implementation |
|
|
136 | # @DESCRIPTION: |
|
|
137 | # Not all implementations have the same command basename as the |
|
|
138 | # target; namely Ruby Enterprise 1.8 uses ree18 and rubyee18 |
|
|
139 | # respectively. This function translate between the two |
|
|
140 | ruby_implementation_command() { |
|
|
141 | local _ruby_name=$1 |
|
|
142 | |
|
|
143 | # Add all USE_RUBY values where the flag name diverts from the binary here |
|
|
144 | case $1 in |
|
|
145 | ree18) |
|
|
146 | _ruby_name=rubyee18 |
|
|
147 | ;; |
|
|
148 | esac |
|
|
149 | |
|
|
150 | echo $(type -p ${_ruby_name} 2>/dev/null) |
|
|
151 | } |
|
|
152 | |
| 134 | _ruby_atoms_samelib() { |
153 | _ruby_atoms_samelib() { |
| 135 | local atoms=$(_ruby_atoms_samelib_generic "$*") |
154 | local atoms=$(_ruby_atoms_samelib_generic "$*") |
| 136 | |
155 | |
| 137 | for _ruby_implementation in $USE_RUBY; do |
156 | for _ruby_implementation in $USE_RUBY; do |
| 138 | echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}" |
157 | echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}" |
| … | |
… | |
| 229 | sub_S=${S#${WORKDIR}/} |
248 | sub_S=${S#${WORKDIR}/} |
| 230 | |
249 | |
| 231 | # Special case, for the always-lovely GitHub fetches. With this, |
250 | # Special case, for the always-lovely GitHub fetches. With this, |
| 232 | # we allow the star glob to just expand to whatever directory it's |
251 | # we allow the star glob to just expand to whatever directory it's |
| 233 | # called. |
252 | # called. |
| 234 | if [[ ${sub_S} = *"*" ]]; then |
253 | if [[ ${sub_S} = *"*"* ]]; then |
| 235 | pushd "${WORKDIR}"/all &>/dev/null |
254 | pushd "${WORKDIR}"/all &>/dev/null |
| 236 | sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
255 | sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
| 237 | popd &>/dev/null |
256 | popd &>/dev/null |
| 238 | fi |
257 | fi |
| 239 | |
258 | |
| … | |
… | |
| 261 | local invoked=no |
280 | local invoked=no |
| 262 | for _ruby_implementation in ${USE_RUBY}; do |
281 | for _ruby_implementation in ${USE_RUBY}; do |
| 263 | # only proceed if it's requested |
282 | # only proceed if it's requested |
| 264 | use ruby_targets_${_ruby_implementation} || continue |
283 | use ruby_targets_${_ruby_implementation} || continue |
| 265 | |
284 | |
| 266 | local _ruby_name=$_ruby_implementation |
285 | RUBY=$(ruby_implementation_command ${_ruby_implementation}) |
| 267 | |
|
|
| 268 | # Add all USE_RUBY values where the flag name diverts from the binary here |
|
|
| 269 | case $_ruby_implementation in |
|
|
| 270 | ree18) |
|
|
| 271 | _ruby_name=rubyee18 |
|
|
| 272 | ;; |
|
|
| 273 | esac |
|
|
| 274 | |
|
|
| 275 | RUBY=$(type -p $_ruby_name 2>/dev/null) |
|
|
| 276 | invoked=yes |
286 | invoked=yes |
| 277 | |
287 | |
| 278 | if [[ -n "$1" ]]; then |
288 | if [[ -n "$1" ]]; then |
| 279 | _ruby_invoke_environment $_ruby_implementation "$@" |
289 | _ruby_invoke_environment ${_ruby_implementation} "$@" |
| 280 | fi |
290 | fi |
| 281 | |
291 | |
| 282 | unset RUBY |
292 | unset RUBY |
| 283 | done |
293 | done |
| 284 | |
294 | |