commit:     9aae1e787fb4ce16eb7a0a0a338b801aa4c482b8
Author:     Tomasz Figa <tfiga <AT> chromium <DOT> org>
AuthorDate: Tue May 16 19:09:58 2017 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue May 16 19:10:33 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9aae1e78

multilib.eclass: fix cross-compiling multilib ebuilds

Current code assumes that CBUILD is always the same as CHOST, however it
is desirable to allow cross compiling into multilib sysroots, where
obviously the assumed condition does not hold anymore. To fix this,
let's override CBUILD only if original CHOST and CBUILD are equal, i.e.
we are not cross-compiling.

 eclass/multilib.eclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
index 956f3aeed88..350b6f949d1 100644
--- a/eclass/multilib.eclass
+++ b/eclass/multilib.eclass
@@ -450,6 +450,11 @@ multilib_toolchain_setup() {
                done
                export _DEFAULT_ABI_SAVED="true"
 
+               # Set CBUILD only if not cross-compiling.
+               if [[ ${CBUILD} == "${CHOST}" ]]; then
+                       export CBUILD=$(get_abi_CHOST $1)
+               fi
+
                # Set the CHOST native first so that we pick up the native
                # toolchain and not a cross-compiler by accident #202811.
                export CHOST=$(get_abi_CHOST ${DEFAULT_ABI})
@@ -459,7 +464,6 @@ multilib_toolchain_setup() {
                export FC="$(tc-getFC) $(get_abi_CFLAGS)"
                export LD="$(tc-getLD) $(get_abi_LDFLAGS)"
                export CHOST=$(get_abi_CHOST $1)
-               export CBUILD=$(get_abi_CHOST $1)
                export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig
                export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig
        fi

Reply via email to