Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: toolchain@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] toolchain-funcs: Respect host vars for tc-getBUILD* when not cross
Date: Fri, 08 Sep 2017 08:33:27
Message-Id: 20170908083311.5790-1-mgorny@gentoo.org
Make tc-getBUILD* functions respect host variables (CC & co.) when
not cross-compiling. This removes the necessity of overriding BUILD_*
along with the regular variables on the systems that are not concerned
about cross-compilation, and does not change the behavior for those
which are.

Closes: https://bugs.gentoo.org/630282
---
 eclass/toolchain-funcs.eclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index aeb6f7c70299..75fa638efff3 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -40,7 +40,13 @@ _tc-getPROG() {
 	export ${var}="${prog[*]}"
 	echo "${!var}"
 }
-tc-getBUILD_PROG() { _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"; }
+tc-getBUILD_PROG() {
+	local vars="BUILD_$1 $1_FOR_BUILD HOST$1"
+	# respect host vars if not cross-compiling
+	# https://bugs.gentoo.org/630282
+	tc-is-cross-compiler || vars+=" $1"
+	_tc-getPROG CBUILD "${vars}" "${@:2}"
+}
 tc-getPROG() { _tc-getPROG CHOST "$@"; }
 
 # @FUNCTION: tc-getAR
-- 
2.14.1

Replies