allow overlays to specify eclass overrides without breaking libtools lookup of local...
authorMike Frysinger <vapier@gentoo.org>
Fri, 18 Nov 2011 17:32:14 +0000 (17:32 +0000)
committerMike Frysinger <vapier@gentoo.org>
Fri, 18 Nov 2011 17:32:14 +0000 (17:32 +0000)
eclass/libtool.eclass

index b36e7e388387d07e386d98cb172faf6ea25f331b..097612eacc9e5fcb78c0bdedeb1437cd77852c9b 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.95 2011/11/14 17:08:49 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.96 2011/11/18 17:32:14 vapier Exp $
 
 # @ECLASS: libtool.eclass
 # @MAINTAINER:
 # generated libtool files.  We do not run the libtoolize program because that
 # requires a regeneration of the main autotool files in order to work properly.
 
+# If an overlay has eclass overrides, but doesn't actually override the
+# libtool.eclass, we'll have ECLASSDIR pointing to the active overlay's
+# eclass/ dir, but libtool.eclass is still in the main Gentoo tree.  So
+# add a check to locate the ELT-patches/ regardless of what's going on.
+ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*}
+elt_patch_dir() {
+       local d="${ECLASSDIR}/ELT-patches"
+       if [[ ! -d ${d} ]] ; then
+               d="${ECLASSDIR_LOCAL}/ELT-patches"
+       fi
+       echo "${d}"
+}
+
 DESCRIPTION="Based on the ${ECLASS} eclass"
 
 inherit multilib toolchain-funcs
 
-ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches"
-
 #
 # See if we can apply $2 on $1, and if so, do it
 #
@@ -70,7 +81,7 @@ ELT_walk_patches() {
        local ret=1
        local file=$1
        local patch_set=$2
-       local patch_dir="${ELT_PATCH_DIR}/${patch_set}"
+       local patch_dir="$(elt_patch_dir)/${patch_set}"
        local rem_int_dep=$3
 
        [[ -z ${patch_set} ]] && return 1
@@ -84,7 +95,7 @@ ELT_walk_patches() {
                sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
        fi
 
-       pushd "${ELT_PATCH_DIR}" >/dev/null || die
+       pushd "$(elt_patch_dir)" >/dev/null || die
 
        # Go through the patches in reverse order (newer version to older)
        for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do