meson: handle LLVM 'x.x.xgit-revision' versions
authorGreg V <greg@unrelenting.technology>
Wed, 24 Jan 2018 18:02:43 +0000 (21:02 +0300)
committerDylan Baker <dylan@pnwbakers.com>
Wed, 24 Jan 2018 23:25:54 +0000 (15:25 -0800)
When LLVM is built inside of a git repo (even way below, e.g. /usr/ports/.git
exists, and LLVM is built in /usr/ports/devel/llvm50/work), its version
becomes something like 5.0.0git-f8ab206b2176.

New meson versions already handle this, but we support older versions too.

Fixes: 673dda8330769 ("meson: build "radv" vulkan driver for radeon hardware")
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
meson.build

index 56ff916c4bd8b55334a8789a5d80b8fdc6f561ea..8a814a596cc5bb00fd255bcf6515c37210e6ad5d 100644 (file)
@@ -1022,11 +1022,15 @@ else
 endif
 if with_llvm
   _llvm_version = dep_llvm.version().split('.')
-  # Development versions of LLVM have an 'svn' suffix, we don't want that for
-  # our version checks.
+  # Development versions of LLVM have an 'svn' or 'git' suffix, we don't want
+  # 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]
   if _llvm_patch.endswith('svn')
     _llvm_patch = _llvm_patch.split('s')[0]
+  elif _llvm_patch.contains('git')
+    _llvm_patch = _llvm_patch.split('g')[0]
   endif
   pre_args += [
     '-DHAVE_LLVM=0x0@0@0@1@'.format(_llvm_version[0], _llvm_version[1]),