[coreboot-gerrit] New patch to review for coreboot: buildgcc: Always set HOSTCFLAGS

Nico Huber (nico.h@gmx.de) gerrit at coreboot.org
Mon Feb 1 22:07:09 CET 2016


Nico Huber (nico.h at gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13550

-gerrit

commit 0b3be4e26c1e46a9f0e1f883b10fc3797e1baaa2
Author: Nico Huber <nico.h at gmx.de>
Date:   Sun Jan 31 23:05:19 2016 +0100

    buildgcc: Always set HOSTCFLAGS
    
    Always set HOSTCFLAGS to the flags GMP was built with, defaulting to
    "-Os" if it isn't built yet. Currently, if GMP is already built or not
    even in the list of packages to be built, this is silently skipped and
    other packages will be built with empty HOSTCFLAGS.
    
    Change-Id: I29b2ea75283410a6cea60dc1c92b87573aebfb34
    Signed-off-by: Nico Huber <nico.h at gmx.de>
---
 util/crossgcc/buildgcc | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 8f67949..6022df9 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -360,18 +360,28 @@ GNU General Public License for more details.
 EOF
 }
 
+have_hostcflags_from_gmp() {
+	grep -q __GMP_CFLAGS $DESTDIR$TARGETDIR/include/gmp.h >/dev/null 2>&1
+}
+
+set_hostcflags_from_gmp() {
+	# Now set CFLAGS to match GMP CFLAGS but strip out -pedantic
+	# as GCC 4.6.x fails if it's there.
+	export HOSTCFLAGS=$(grep __GMP_CFLAGS $DESTDIR$TARGETDIR/include/gmp.h |cut -d\" -f2 |\
+	    sed s,-pedantic,,)
+}
+
 build_GMP() {
-	CC="$CC" CFLAGS="-Os" ../${GMP_DIR}/configure --disable-shared --enable-fat --prefix=$TARGETDIR $OPTIONS \
+	CC="$CC" CFLAGS="$HOSTCFLAGS" \
+		../${GMP_DIR}/configure --disable-shared --enable-fat \
+		--prefix=$TARGETDIR $OPTIONS \
 		|| touch .failed
 	$MAKE $JOBS || touch .failed
 	$MAKE install DESTDIR=$DESTDIR || touch .failed
 
 	normalize_dirs
 
-	# Now set CFLAGS to match GMP CFLAGS but strip out -pedantic
-	# as GCC 4.6.x fails if it's there.
-	export HOSTCFLAGS=$(grep __GMP_CFLAGS $DESTDIR$TARGETDIR/include/gmp.h |cut -d\" -f2 |\
-	    sed s,-pedantic,,)
+	set_hostcflags_from_gmp
 }
 
 build_MPFR() {
@@ -715,6 +725,11 @@ elif [ $UNAME = "NetBSD" ]; then
 fi
 fi # GCC
 
+export HOSTCFLAGS="-Os"
+if have_hostcflags_from_gmp; then
+	set_hostcflags_from_gmp
+fi
+
 if [ "$USECCACHE" = 1 ]; then
 	CC="ccache $CC"
 fi



More information about the coreboot-gerrit mailing list