I'm working on ruby stuff today, I guess. inline diff: Index: ruby-ng.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v retrieving revision 1.23 diff -u -r1.23 ruby-ng.eclass --- ruby-ng.eclass 30 Jul 2010 15:05:08 -0000 1.23 +++ ruby-ng.eclass 30 Jul 2010 16:12:14 -0000 @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.23 2010/07/30 15:0 5:08 flameeyes Exp $ +# $Header: $ # # @ECLASS: ruby-ng.eclass # @MAINTAINER: @@ -53,7 +53,7 @@ case ${EAPI} in 0|1) die "Unsupported EAPI=${EAPI} (too old) for ruby-ng.eclass" ;; - 2) ;; + 2|3) ;; *) die "Unknown EAPI=${EAPI} for ruby-ng.eclass" esac @@ -392,7 +392,14 @@ _each_ruby_check_install() { local libruby_basename=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["LIBRUBY_SO"]') - local libruby_soname=$(scanelf -F "%S#F" -qS "/usr/$(get_libdir)/${libruby_basename}") + if [[ ${CHOST} == *-darwin ]] ; then + # we have a Mach-O object here + local libruby_soname=$(scanmacho -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") + # install_names are absolute + libruby_soname=${libruby_soname##*/} + else + local libruby_soname=$(scanelf -F "%S#F" -qS "${EPREFIX}/usr/$(get_libdir)/${libruby_basename}") + fi local sitedir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitedir"]') local sitelibdir=$(${RUBY} -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]') @@ -413,9 +420,15 @@ # extensions via ruby-fakegem; make sure to check only in sitelibdir, since # that's what changes between two implementations (otherwise you'd get false # positives now that Ruby 1.9.2 installs with the same sitedir as 1.8) - scanelf -qnR "${D}${sitelibdir}" "${D}${sitelibdir/site_ruby/gems}" \ - | fgrep -v "${libruby_soname}" \ - > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log + if [[ ${CHOST} == *-darwin* ]] ; then + scanmacho -qnR "${D}${sitedir}" "${D}${sitelibdir/site_ruby/gems}" \ + | fgrep -v "${libruby_soname}" \ + > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log + else + scanelf -qnR "${D}${sitedir}" "${D}${sitelibdir/site_ruby/gems}" \ + | fgrep -v "${libruby_soname}" \ + > "${T}"/ruby-ng-${_ruby_implementation}-mislink.log + fi if [[ -s "${T}"/ruby-ng-${_ruby_implementation}-mislink.log ]]; then ewarn "Extensions installed for ${_ruby_implementation} with missing links to ${libruby_soname}" @@ -453,7 +466,8 @@ doruby() { [[ -z ${RUBY} ]] && die "\$RUBY is not set" ( # don't want to pollute calling env - insinto $(ruby_rbconfig_value 'sitelibdir') + sitelibdir=$(ruby_rbconfig_value 'sitelibdir') + insinto ${sitelibdir#${EPREFIX}} insopts -m 0644 doins "$@" ) || die "failed to install $@" That is the basic concept. I don't like that it forces every consumer to be EAPI=3 because $EPREFIX is used. So, we can define EPREFIX to "" if EAPI2 is used. Thoughts?
Hrm can you please provide it as a .diff file next time? it's quite unreadable because of word wrapping this way. Anyway, I don't like the two ifs on CHOST, can't we wrap that up in a single scancmd=scanelf [[ ${CHOST} == *-darwin ]] && scancmd=scanmacho $scancmd -F... and then use $(basename) (rather than relying /) unconditionally? I don't think performance is much of a point here, but readability certainly is.
Created attachment 240729 [details, diff] ruby-ng-prefix.diff r2 You are right, I was thinking of that as soon as I submitted it. Here is a smaller diff with $scancmd usage.
Applied, thanks!