[coreboot-gerrit] New patch to review for coreboot: d7052ca buildgcc: Unify tool tests, add check for g++

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Tue Feb 24 10:53:21 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8522

-gerrit

commit d7052ca9653d52a0964dc4380f9ff8b84d6eb1b3
Author: Patrick Georgi <pgeorgi at google.com>
Date:   Tue Feb 24 10:52:14 2015 +0100

    buildgcc: Unify tool tests, add check for g++
    
    Change-Id: I406f5cfc61bc87ccc2c0b9283b4fbb8cef8dfc1b
    Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
 util/crossgcc/buildgcc | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index e4ddbc2..e6a7f02 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -91,14 +91,19 @@ normalize_dirs()
 	perl -pi -e "s,/lib64,/lib," $DESTDIR$TARGETDIR/lib/*.la
 }
 
-searchgnu()
+searchtool()
 {
 	# $1 short name
-	# result: GNU version of that tool on stdout
-	#         or no output if no GNU version was found
+	# $2 search string
+	# result: file name of that tool on stdout
+	#         or no output if nothing suitable was found
+	search=GNU
+	if [ -n "$2" ]; then
+		search="$2"
+	fi
 	for i in "$1" "g$1" "gnu$1"; do
 		if test -x "`which $i 2>/dev/null`"; then
-			if test `$i --version 2>/dev/null |grep -c GNU` \
+			if test `$i --version 2>/dev/null |grep -c "$search"` \
 			    -gt 0; then
 				echo $i
 				return
@@ -108,7 +113,7 @@ searchgnu()
 	# A workaround for OSX 10.9 and some BSDs, whose nongnu
 	# patch and tar also work.
 	if [ $UNAME = "Darwin" -o $UNAME = "FreeBSD" -o $UNAME = "NetBSD" ]; then
-		if [ $1 != "make" ]; then
+		if [ "$1" = "patch" -o "$1" = "tar" ]; then
 			if test -x "`which $1 2>/dev/null`"; then
 				echo $1
 				return
@@ -119,17 +124,15 @@ searchgnu()
 	exit 1
 }
 
-TAR=`searchgnu tar` || exit $?
-PATCH=`searchgnu patch` || exit $?
-MAKE=`searchgnu make` || exit $?
-
-searchgnu m4 > /dev/null
-searchgnu bison > /dev/null
+TAR=`searchtool tar` || exit $?
+PATCH=`searchtool patch` || exit $?
+MAKE=`searchtool make` || exit $?
 
-if ! flex --version > /dev/null 2> /dev/null; then
-	printf "${RED}ERROR:${red} Missing toolchain: flex${NC}\n" >&2
-	exit 1
-fi
+searchtool m4 > /dev/null
+searchtool bison > /dev/null
+searchtool flex flex > /dev/null
+# TODO: we probably should also allow other c++ compilers
+searchtool g++ "Free Software Foundation" > /dev/null
 
 cleanup()
 {



More information about the coreboot-gerrit mailing list