| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 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.1 2009/12/05 09:35:48 graaff Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.4 2009/12/05 11:33:10 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 | # |
| … | |
… | |
| 362 | } |
362 | } |
| 363 | |
363 | |
| 364 | _each_ruby_check_install() { |
364 | _each_ruby_check_install() { |
| 365 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') |
365 | local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') |
| 366 | local libruby_soname=$(scanelf -qS "/usr/$(get_libdir)/${libruby_basename}" | awk '{ print $1 }') |
366 | local libruby_soname=$(scanelf -qS "/usr/$(get_libdir)/${libruby_basename}" | awk '{ print $1 }') |
|
|
367 | local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') |
|
|
368 | local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') |
|
|
369 | |
|
|
370 | # Look for wrong files in sitedir |
|
|
371 | if [[ -d "${D}${sitedir}" ]]; then |
|
|
372 | local f=$(find "${D}${sitedir}" -mindepth 1 -maxdepth 1 -not -wholename "${D}${sitelibdir}") |
|
|
373 | if [[ -n ${f} ]]; then |
|
|
374 | eerror "Found files in sitedir, outsite sitelibdir:" |
|
|
375 | eerror "${f}" |
|
|
376 | die "Misplaced files in sitedir" |
|
|
377 | fi |
|
|
378 | fi |
| 367 | |
379 | |
| 368 | # The current implementation lacks libruby (i.e.: jruby) |
380 | # The current implementation lacks libruby (i.e.: jruby) |
| 369 | [[ -z ${libruby_soname} ]] && return 0 |
381 | [[ -z ${libruby_soname} ]] && return 0 |
| 370 | |
382 | |
| 371 | scanelf -qnR "${D}"/$(dirname $(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]')) \ |
383 | scanelf -qnR "${D}${sitedir}" \ |
| 372 | | fgrep -v "${libruby_soname}" \ |
384 | | fgrep -v "${libruby_soname}" \ |
| 373 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
385 | > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log |
| 374 | |
386 | |
| 375 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
387 | if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then |
| 376 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby}" |
388 | ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby}" |
| … | |
… | |
| 397 | # @FUNCTION: doruby |
409 | # @FUNCTION: doruby |
| 398 | # @USAGE: file [file...] |
410 | # @USAGE: file [file...] |
| 399 | # @DESCRIPTION: |
411 | # @DESCRIPTION: |
| 400 | # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. |
412 | # Installs the specified file(s) into the sitelibdir of the Ruby interpreter in ${RUBY}. |
| 401 | doruby() { |
413 | doruby() { |
|
|
414 | [[ -z ${RUBY} ]] && die "\$RUBY is not set" |
| 402 | ( # don't want to pollute calling env |
415 | ( # don't want to pollute calling env |
| 403 | insinto $(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]') |
416 | insinto $(${RUBY} -rrbconfig -e 'print Config::CONFIG["sitelibdir"]') |
| 404 | insopts -m 0644 |
417 | insopts -m 0644 |
| 405 | doins "$@" |
418 | doins "$@" |
| 406 | ) || die "failed to install $@" |
419 | ) || die "failed to install $@" |
| 407 | } |
420 | } |
| 408 | |
421 | |