aboutsummaryrefslogtreecommitdiff
path: root/util/crossgcc/buildgcc
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2016-09-20 12:55:19 +0200
committerPatrick Georgi <pgeorgi@google.com>2016-09-21 17:03:09 +0200
commitaee7f46cd3177e469f008a4a48a7b253cb9b7c2a (patch)
tree0cf6609c6a2550aab304534937f3702fdfdba5a6 /util/crossgcc/buildgcc
parentbd74d561adceab2a02629b7439cdb34f18e41c02 (diff)
buildgcc: Add functions to test GCC versions
Just add some helpers that show parts (major, major.minor) of the GCC version to be built (buildcc_*) and of the host compiler (hostcc_*). They will be used in follow-up commits. Change-Id: I37c12ad1a2d08645f40a9f0f0a479c8d7cc3e127 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/16674 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'util/crossgcc/buildgcc')
-rwxr-xr-xutil/crossgcc/buildgcc20
1 files changed, 20 insertions, 0 deletions
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index f96e2cf59e..07425921af 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -205,6 +205,26 @@ check_for_library() {
rm -rf "${LIBTEST_FILE}.c" "${LIBTEST_FILE}"
}
+buildcc_major() {
+ echo "${GCC_VERSION}" | cut -d. -f1
+}
+
+buildcc_version() {
+ echo "${GCC_VERSION}" | cut -d. -f1-2
+}
+
+hostcc_major() {
+ (echo __GNUC__ | ${CC} -E - 2>/dev/null || echo 0) | tail -1
+}
+
+hostcc_minor() {
+ (echo __GNUC_MINOR__ | ${CC} -E - 2>/dev/null || echo 0) | tail -1
+}
+
+hostcc_version() {
+ printf "%d.%d" "$(hostcc_major)" "$(hostcc_minor)"
+}
+
check_sum() {
test -z "$CHECKSUM" || \
test "$(cat sum/$1.cksum 2>/dev/null | sed -e 's@.*\([0-9a-f]\{40,\}\).*@\1@')" = \