summaryrefslogtreecommitdiff
path: root/scripts/binutils-version.sh
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-12-25 11:09:44 +0900
committerTom Rini <trini@ti.com>2014-12-29 16:31:23 -0500
commit73c25753060c58e4c339fba306ed0ded0c335748 (patch)
treeecd520fb3a5a03bd98c9b6f0ec77b93e54d8d0ba /scripts/binutils-version.sh
parent914627fe1c575112cd2aa14ab83cfa249e6810d6 (diff)
scripts: fix binutils-version.sh
The current binutils-version.sh expects the version string at the end of the first line. It turned out to not work with Linaro toolchain: It has "Linaro 2014.09" at the back. To fix this issue, let's parse the word right after the close parenthesis. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Reported-by: York Sun <yorksun@freescale.com> Acked-by: Dirk Behme <dirk.behme@gmail.com>
Diffstat (limited to 'scripts/binutils-version.sh')
-rwxr-xr-xscripts/binutils-version.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/binutils-version.sh b/scripts/binutils-version.sh
index d4d9eb4361..0bc26cf925 100755
--- a/scripts/binutils-version.sh
+++ b/scripts/binutils-version.sh
@@ -14,7 +14,9 @@ if [ ${#gas} -eq 0 ]; then
exit 1
fi
-MAJOR=$($gas --version | head -1 | awk '{print $NF}' | cut -d . -f 1)
-MINOR=$($gas --version | head -1 | awk '{print $NF}' | cut -d . -f 2)
+version_string=$($gas --version | head -1 | sed -e 's/.*) *\([0-9.]*\).*/\1/' )
+
+MAJOR=$(echo $version_string | cut -d . -f 1)
+MINOR=$(echo $version_string | cut -d . -f 2)
printf "%02d%02d\\n" $MAJOR $MINOR