summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Gomez <[email protected]>2018-02-28 23:15:07 +0200
committerAndres Gomez <[email protected]>2018-03-01 12:16:23 +0200
commit98f7650add26423d1b3e871c41ae37972b835fe1 (patch)
tree26dae72875ed04862078a1afa18ea68b7c5afd13
parentbc73016703f8f2815e000f1c100532cf6e13cd3c (diff)
meson: fix LLVM version detection when <= 3.4
3 digits versions in LLVM only started from 3.4.1 on. Hence, even if you can perfectly build with an old LLVM (< 3.4.1) in the system while not needing LLVM at all (auto), when passing through the LLVM version detection code, meson will fail when accessing "_llvm_version[2]" due to: "Index 2 out of bounds of array of size 2." v2: Properly compare LLVM version and set patch version to 0 if < 3.4.1 (Eric). v3: Improve the commit log explanation (Eric). Cc: Dylan Baker <[email protected]> Cc: Eric Engestrom <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
-rw-r--r--meson.build9
1 files changed, 8 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 308f64cf811..e9928a37931 100644
--- a/meson.build
+++ b/meson.build
@@ -1037,7 +1037,14 @@ if with_llvm
# that for our version checks.
# svn suffixes are stripped by meson as of 0.43, and git suffixes are
# strippped as of 0.44, but we support older meson versions.
- _llvm_patch = _llvm_version[2]
+
+ # 3 digits versions in LLVM only started from 3.4.1 on
+ if dep_llvm.version().version_compare('>= 3.4.1')
+ _llvm_patch = _llvm_version[2]
+ else
+ _llvm_patch = '0'
+ endif
+
if _llvm_patch.endswith('svn')
_llvm_patch = _llvm_patch.split('s')[0]
elif _llvm_patch.contains('git')