| 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.27 2010/08/30 22:08:24 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.37 2011/07/22 09:10:22 graaff 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 | # |
| … | |
… | |
| 46 | |
46 | |
| 47 | # @ECLASS-VARIABLE: RUBY_OPTIONAL |
47 | # @ECLASS-VARIABLE: RUBY_OPTIONAL |
| 48 | # @DESCRIPTION: |
48 | # @DESCRIPTION: |
| 49 | # Set the value to "yes" to make the dependency on a Ruby interpreter optional. |
49 | # Set the value to "yes" to make the dependency on a Ruby interpreter optional. |
| 50 | |
50 | |
|
|
51 | # @ECLASS-VARIABLE: RUBY_S |
|
|
52 | # @DEFAULT_UNSET |
|
|
53 | # @DESCRIPTION: |
|
|
54 | # If defined this variable determines the source directory name after |
|
|
55 | # unpacking. This defaults to the name of the package. Note that this |
|
|
56 | # variable supports a wildcard mechanism to help with github tarballs |
|
|
57 | # that contain the commit hash as part of the directory name. |
|
|
58 | |
|
|
59 | # @ECLASS-VARIABLE: RUBY_QA_ALLOWED_LIBS |
|
|
60 | # @DEFAULT_UNSET |
|
|
61 | # @DESCRIPTION: |
|
|
62 | # If defined this variable contains a whitelist of shared objects that |
|
|
63 | # are allowed to exist even if they don't link to libruby. This avoids |
|
|
64 | # the QA check that makes this mandatory. This is most likely not what |
|
|
65 | # you are looking for if you get the related "Missing links" QA warning, |
|
|
66 | # since the proper fix is almost always to make sure the shared object |
|
|
67 | # is linked against libruby. There are cases were this is not the case |
|
|
68 | # and the shared object is generic code to be used in some other way |
|
|
69 | # (e.g. selenium's firefox driver extension). When set this argument is |
|
|
70 | # passed to "grep -E" to remove reporting of these shared objects. |
|
|
71 | |
| 51 | inherit eutils toolchain-funcs |
72 | inherit eutils toolchain-funcs |
| 52 | |
73 | |
| 53 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup |
74 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_setup |
| 54 | |
75 | |
| 55 | case ${EAPI} in |
76 | case ${EAPI} in |
| 56 | 0|1) |
77 | 0|1) |
| 57 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
78 | die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; |
| 58 | 2|3) ;; |
79 | 2|3) ;; |
|
|
80 | 4) |
|
|
81 | # S is no longer automatically assigned when it doesn't exist. |
|
|
82 | S="${WORKDIR}" |
|
|
83 | ;; |
| 59 | *) |
84 | *) |
| 60 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
85 | die "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
| 61 | esac |
86 | esac |
| 62 | |
87 | |
| 63 | # @FUNCTION: ruby_implementation_depend |
88 | # @FUNCTION: ruby_implementation_depend |
| … | |
… | |
| 199 | RDEPEND="${RDEPEND} $dependency" |
224 | RDEPEND="${RDEPEND} $dependency" |
| 200 | |
225 | |
| 201 | # Add the dependency as a test-dependency since we're going to |
226 | # Add the dependency as a test-dependency since we're going to |
| 202 | # execute the code during test phase. |
227 | # execute the code during test phase. |
| 203 | DEPEND="${DEPEND} test? ( ${dependency} )" |
228 | DEPEND="${DEPEND} test? ( ${dependency} )" |
| 204 | hasq test "$IUSE" || IUSE="${IUSE} test" |
229 | has test "$IUSE" || IUSE="${IUSE} test" |
| 205 | } |
230 | } |
| 206 | |
231 | |
| 207 | # @FUNCTION: ruby_add_bdepend |
232 | # @FUNCTION: ruby_add_bdepend |
| 208 | # @USAGE: dependencies |
233 | # @USAGE: dependencies |
| 209 | # @DESCRIPTION: |
234 | # @DESCRIPTION: |
| … | |
… | |
| 230 | |
255 | |
| 231 | DEPEND="${DEPEND} $dependency" |
256 | DEPEND="${DEPEND} $dependency" |
| 232 | RDEPEND="${RDEPEND}" |
257 | RDEPEND="${RDEPEND}" |
| 233 | } |
258 | } |
| 234 | |
259 | |
|
|
260 | # @FUNCTION: ruby_get_use_implementations |
|
|
261 | # @DESCRIPTION: |
|
|
262 | # Gets an array of ruby use targets enabled by the user |
|
|
263 | ruby_get_use_implementations() { |
|
|
264 | local i implementation |
|
|
265 | for implementation in ${USE_RUBY}; do |
|
|
266 | use ruby_targets_${implementation} && i+=" ${implementation}" |
|
|
267 | done |
|
|
268 | echo $i |
|
|
269 | } |
|
|
270 | |
|
|
271 | # @FUNCTION: ruby_get_use_targets |
|
|
272 | # @DESCRIPTION: |
|
|
273 | # Gets an array of ruby use targets that the ebuild sets |
|
|
274 | ruby_get_use_targets() { |
|
|
275 | local t implementation |
|
|
276 | for implementation in ${USE_RUBY}; do |
|
|
277 | t+=" ruby_targets_${implementation}" |
|
|
278 | done |
|
|
279 | echo $t |
|
|
280 | } |
|
|
281 | |
|
|
282 | if [[ ${EAPI:-0} -ge 4 && ${RUBY_OPTIONAL} != "yes" ]]; then |
|
|
283 | REQUIRED_USE=" || ( $(ruby_get_use_targets) )" |
|
|
284 | fi |
|
|
285 | |
| 235 | for _ruby_implementation in $USE_RUBY; do |
286 | for _ruby_implementation in $USE_RUBY; do |
| 236 | IUSE="${IUSE} ruby_targets_${_ruby_implementation}" |
287 | IUSE="${IUSE} ruby_targets_${_ruby_implementation}" |
| 237 | |
288 | |
| 238 | # If you specify RUBY_OPTIONAL you also need to take care of |
289 | # If you specify RUBY_OPTIONAL you also need to take care of |
| 239 | # ruby useflag and dependency. |
290 | # ruby useflag and dependency. |
| … | |
… | |
| 243 | fi |
294 | fi |
| 244 | done |
295 | done |
| 245 | |
296 | |
| 246 | _ruby_invoke_environment() { |
297 | _ruby_invoke_environment() { |
| 247 | old_S=${S} |
298 | old_S=${S} |
|
|
299 | case ${EAPI} in |
|
|
300 | 4) |
|
|
301 | if [ -z ${RUBY_S} ]; then |
|
|
302 | sub_S=${P} |
|
|
303 | else |
|
|
304 | sub_S=${RUBY_S} |
|
|
305 | fi |
|
|
306 | ;; |
|
|
307 | *) |
| 248 | sub_S=${S#${WORKDIR}/} |
308 | sub_S=${S#${WORKDIR}/} |
|
|
309 | ;; |
|
|
310 | esac |
| 249 | |
311 | |
| 250 | # Special case, for the always-lovely GitHub fetches. With this, |
312 | # Special case, for the always-lovely GitHub fetches. With this, |
| 251 | # we allow the star glob to just expand to whatever directory it's |
313 | # we allow the star glob to just expand to whatever directory it's |
| 252 | # called. |
314 | # called. |
| 253 | if [[ ${sub_S} = *"*" ]]; then |
315 | if [[ ${sub_S} = *"*"* ]]; then |
|
|
316 | case ${EAPI} in |
|
|
317 | 2|3) |
|
|
318 | #The old method of setting S depends on undefined package |
|
|
319 | # manager behaviour, so encourage upgrading to EAPI=4. |
|
|
320 | eqawarn "Using * expansion of S is deprecated. Use EAPI and RUBY_S instead." |
|
|
321 | ;; |
|
|
322 | esac |
| 254 | pushd "${WORKDIR}"/all &>/dev/null |
323 | pushd "${WORKDIR}"/all &>/dev/null |
| 255 | sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
324 | sub_S=$(eval ls -d ${sub_S} 2>/dev/null) |
| 256 | popd &>/dev/null |
325 | popd &>/dev/null |
| 257 | fi |
326 | fi |
| 258 | |
327 | |
| … | |
… | |
| 431 | # extensions via ruby-fakegem; make sure to check only in sitelibdir, since |
500 | # extensions via ruby-fakegem; make sure to check only in sitelibdir, since |
| 432 | # that's what changes between two implementations (otherwise you'd get false |
501 | # that's what changes between two implementations (otherwise you'd get false |
| 433 | # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8) |
502 | # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8) |
| 434 | ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \ |
503 | ${scancmd} -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \ |
| 435 | | fgrep -v "${libruby_soname}" \ |
504 | | fgrep -v "${libruby_soname}" \ |
|
|
505 | | grep -E -v "${RUBY_QA_ALLOWED_LIBS}" \ |
| 436 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
506 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
| 437 | |
507 | |
| 438 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
508 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
| 439 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}" |
509 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}" |
| 440 | ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) |
510 | ewarn $(< "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ) |