--- /usr/portage/eclass/eutils.eclass 2013-09-14 13:01:16.000000000 -0600 +++ eutils.eclass 2013-10-22 16:37:28.804368793 -0600 @@ -955,11 +955,12 @@ # @DESCRIPTION: # Validate desktop entries using desktop-file-utils validate_desktop_entries() { - if [[ -x /usr/bin/desktop-file-validate ]] ; then + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" && EPREFIX= + if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]] ; then einfo "Checking desktop entry validity" local directories="" for d in /usr/share/applications $@ ; do - [[ -d ${D}${d} ]] && directories="${directories} ${D}${d}" + [[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}" done if [[ -n ${directories} ]] ; then for FILE in $(find ${directories} -name "*\.desktop" \ @@ -967,7 +968,7 @@ do local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | \ sed -e "s|error: ||" -e "s|${FILE}:|--|g" ) - [[ -n $temp ]] && elog ${temp/--/${FILE/${D}/}:} + [[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:} done fi echo "" @@ -1227,6 +1228,7 @@ # solution, so instead you can call this from pkg_preinst. See also the # preserve_old_lib_notify function. preserve_old_lib() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" && ED="${D}" if [[ ${EBUILD_PHASE} != "preinst" ]] ; then eerror "preserve_old_lib() must be called from pkg_preinst() only" die "Invalid preserve_old_lib() usage" @@ -1238,11 +1240,11 @@ local lib dir for lib in "$@" ; do - [[ -e ${ROOT}/${lib} ]] || continue + [[ -e ${EROOT}/${lib} ]] || continue dir=${lib%/*} dodir ${dir} || die "dodir ${dir} failed" - cp "${ROOT}"/${lib} "${D}"/${lib} || die "cp ${lib} failed" - touch "${D}"/${lib} + cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed" + touch "${ED}"/${lib} done } @@ -1259,9 +1261,11 @@ # let portage worry about it has preserve-libs ${FEATURES} && return 0 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" + local lib notice=0 for lib in "$@" ; do - [[ -e ${ROOT}/${lib} ]] || continue + [[ -e ${EROOT}/${lib} ]] || continue if [[ ${notice} -eq 0 ]] ; then notice=1 ewarn "Old versions of installed libraries were detected on your system." @@ -1297,6 +1301,7 @@ # Remember that this function isn't terribly intelligent so order of optional # flags matter. built_with_use() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" local hidden="no" if [[ $1 == "--hidden" ]] ; then hidden="yes" @@ -1320,8 +1325,8 @@ [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package" shift - local USEFILE=${ROOT}/var/db/pkg/${PKG}/USE - local IUSEFILE=${ROOT}/var/db/pkg/${PKG}/IUSE + local USEFILE="${EROOT}"/var/db/pkg/${PKG}/USE + local IUSEFILE="${EROOT}"/var/db/pkg/${PKG}/IUSE # if the IUSE file doesn't exist, the read will error out, we need to handle # this gracefully @@ -1401,6 +1406,7 @@ # first optionally setting LD_LIBRARY_PATH to the colon-delimited # libpaths followed by optionally changing directory to chdir. make_wrapper() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5 local tmpwrapper=$(emktemp) @@ -1408,17 +1414,22 @@ echo '#!/bin/sh' [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${chdir}" if [[ -n ${libdir} ]] ; then + if [[ ${CHOST} == *-darwin* ]] ; then + var=DYLD_LIBRARY_PATH + else + var=LD_LIBRARY_PATH + fi cat <<-EOF - if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then - export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}" + if [ "\${${var}+set}" = "set" ] ; then + export ${var}="\${${var}}:${EPREFIX}${libdir}" else - export LD_LIBRARY_PATH="${libdir}" + export ${var}="${EPREFIX}${libdir}" fi EOF fi # We don't want to quote ${bin} so that people can pass complex # things as ${bin} ... "./someprog --args" - printf 'exec %s "$@"\n' "${bin}" + printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}\/}" ) > "${tmpwrapper}" chmod go+rx "${tmpwrapper}" @@ -1529,6 +1540,7 @@ debug-print-function ${FUNCNAME} "$@" local removing_all removing_modules opt + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" for opt; do case "${opt}" in --all) @@ -1638,7 +1650,7 @@ einfo "Removing unnecessary ${f#${D%/}} (${reason})" queue+=( "${f}" ) fi - done < <(find "${D}" -xtype f -name '*.la' -print0) + done < <(find "${ED}" -xtype f -name '*.la' -print0) if [[ ${queue[@]} ]]; then rm -f "${queue[@]}"