Browse Source

gcc-version.sh: fix for "invalid number" message during Android NDK builds

A CR in the gcc output would cause the following to show throughout build:

: invalid numberbox-1.32.1/scripts/gcc-version.sh: line 12: printf: 9

Signed-off-by: Chris Renshaw <osm0sis@outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Chris Renshaw 3 years ago
parent
commit
6c6470b384
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scripts/gcc-version.sh

+ 2 - 2
scripts/gcc-version.sh

@@ -7,6 +7,6 @@
 #
 
 compiler="$*"
-
-MAJ_MIN=$(echo __GNUC__ __GNUC_MINOR__ | $compiler -E -xc - | grep . | tail -n 1)
+# tr -d '\r': fix up msdos-style line endings (Cygwin et al)
+MAJ_MIN=$(echo __GNUC__ __GNUC_MINOR__ | $compiler -E -xc - | tr -d '\r' | tail -n 1)
 printf '%02d%02d\n' $MAJ_MIN