summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/meson/meson/0001-Check-for-clang-before-guessing-gcc-or-lcc.patch
blob: 58fa1194398e0e10ba5320e78411bc87e8e58cd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 8739e1c3bef653415ad4b9b9c318ccfa76c43da6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Mar 2022 15:00:24 -0700
Subject: [PATCH] Check for clang before guessing gcc or lcc

clang --version can yield a string like below when its installed into
such a directory

clang version 14.0.0 (https://github.com/llvm/llvm-project 3f43d803382d57e3fc010ca19833077d1023e9c9)
Target: aarch64-yoe-linux
Thread model: posix
InstalledDir: /mnt/b/yoe/master/build/tmp/work/cortexa72-yoe-linux/gnome-text-editor/42.0-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux

as you can see InstallDir has 'xt-' subtring and this trips the check to
guess gcc

if 'Free Software Foundation' in out or 'xt-' in out:

Therefore, check if compiler is clang then there is no point of running
this check anyway.

Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/10218]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 mesonbuild/compilers/detect.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 53948b01a..ba335cf39 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -427,13 +427,14 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
         version = search_version(out)
 
         guess_gcc_or_lcc: T.Optional[str] = None
-        if 'Free Software Foundation' in out or 'xt-' in out:
-            guess_gcc_or_lcc = 'gcc'
-        if 'e2k' in out and 'lcc' in out:
-            guess_gcc_or_lcc = 'lcc'
-        if 'Microchip Technology' in out:
-            # this output has "Free Software Foundation" in its version
-            guess_gcc_or_lcc = None
+        if not 'clang' in compiler_name:
+            if 'Free Software Foundation' in out or 'xt-' in out:
+                guess_gcc_or_lcc = 'gcc'
+            if 'e2k' in out and 'lcc' in out:
+                guess_gcc_or_lcc = 'lcc'
+            if 'Microchip Technology' in out:
+                # this output has "Free Software Foundation" in its version
+                guess_gcc_or_lcc = None
 
         if guess_gcc_or_lcc:
             defines = _get_gnu_compiler_defines(compiler)
-- 
2.35.1