Patrick Georgi submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
util/xcompile: Look for the host compiler in XGCCPATH, too (and first)

If there's a host compiler in XGCCPATH, it's likely the same
relatively-current version we use for coreboot, and it's a well-known
quantity, so let's prefer that over alternatives by default.

In addition, look for the C++ host compiler as well.

Change-Id: If50341df169a476899b5a5ffd4c4fb6d21c3f4ac
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43144
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M util/xcompile/xcompile
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile
index 6629546..c237423 100755
--- a/util/xcompile/xcompile
+++ b/util/xcompile/xcompile
@@ -56,7 +56,9 @@
IASL=iasl
fi

-if program_exists gcc; then
+if program_exists "${XGCCPATH}/gcc"; then
+ HOSTCC="${XGCCPATH}/gcc"
+elif program_exists gcc; then
HOSTCC=gcc
elif program_exists cc; then
HOSTCC=cc
@@ -64,6 +66,20 @@
die "no host compiler found"
fi

+# Look for a C++ compiler (for kconfig's qconf), but don't fail if there is
+# none, just set the compiler to false(1) which will break early enough if
+# used while being less confusing than errors about "g not found" when
+# "$HOSTCXX -g" evaluates to "-g" and make drops the leading dash.
+if program_exists "${XGCCPATH}/g++"; then
+ HOSTCXX="${XGCCPATH}/g++"
+elif program_exists g++; then
+ HOSTCXX=g++
+elif program_exists c++; then
+ HOSTCXX=c++
+else
+ HOSTCXX=false
+fi
+
# try to find the core count using various methods
CORES="$(getconf _NPROCESSORS_ONLN 2>/dev/null)"
if [ -z "$CORES" ]; then
@@ -87,6 +103,7 @@
XGCCPATH:=${XGCCPATH}
IASL:=${IASL}
HOSTCC?=${HOSTCC}
+HOSTCXX?=${HOSTCXX}
CPUS?=${CORES}

EOF

To view, visit change 43144. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If50341df169a476899b5a5ffd4c4fb6d21c3f4ac
Gerrit-Change-Number: 43144
Gerrit-PatchSet: 7
Gerrit-Owner: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged