1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-04 22:56:34 +02:00

build: clang version may not be followed by extra words

The get_family and get_version helpers of detect-compiler assume
that the line to identify the version from the compilers have a
token "version", followed by the version number, followed by some
other string, e.g.

  $ CC=gcc get_version_line
  gcc version 10.2.1 20210110 (Debian 10.2.1-6)

But that is not necessarily true, e.g.

  $ CC=clang get_version_line
  Debian clang version 11.0.1-2

Tweak the script not to require extra string after the version.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2021-08-06 15:20:22 -04:00 committed by Junio C Hamano
parent f6bb2099bf
commit 33f13ad7c5

View File

@ -13,11 +13,11 @@ get_version_line() {
}
get_family() {
get_version_line | sed 's/^\(.*\) version [0-9][^ ]* .*/\1/'
get_version_line | sed 's/^\(.*\) version [0-9].*/\1/'
}
get_version() {
get_version_line | sed 's/^.* version \([0-9][^ ]*\) .*/\1/'
get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/'
}
print_flags() {