Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2023-04-26 03:48:43 +0300
committerJunio C Hamano <gitster@pobox.com>2023-04-26 19:20:50 +0300
commit382a9464145de7c1d4f89a161184686cf8685886 (patch)
tree2be4bb5fcde102354b319e9e526f89fee74c932a /detect-compiler
parent2807bd2c10606e590886543afe4e4f208dddd489 (diff)
Handle some compiler versions containing a dash
The version reported by e.g. x86_64-w64-mingw32-gcc on Debian bullseye looks like: gcc version 10-win32 20210110 (GCC) This ends up with detect-compiler failing with: ./detect-compiler: 30: test: Illegal number: 10-win32 This change removes the two known suffixes known to exist in GCC versions in Debian: -win32 and -posix. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'detect-compiler')
-rwxr-xr-xdetect-compiler10
1 files changed, 9 insertions, 1 deletions
diff --git a/detect-compiler b/detect-compiler
index 50087f5670..a87650b71b 100755
--- a/detect-compiler
+++ b/detect-compiler
@@ -17,7 +17,15 @@ get_family() {
}
get_version() {
- get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/'
+ # A string that begins with a digit up to the next SP
+ ver=$(get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/')
+
+ # There are known -variant suffixes that do not affect the
+ # meaning of the main version number. Strip them.
+ ver=${ver%-win32}
+ ver=${ver%-posix}
+
+ echo "$ver"
}
print_flags() {