[Mesa-dev] [PATCH 1/2] meson: fix LLVM version detection when <= 3.4
Eric Engestrom
eric.engestrom at imgtec.com
Wed Feb 28 17:02:50 UTC 2018
On Wednesday, 2018-02-28 17:52:05 +0200, Andres Gomez wrote:
> 3 digits versions in LLVM only started from 3.4.1 on. Hence, if you
> have installed 3.4 or below, meson will fail even when we may not make
> use of LLVM.
>
> Cc: Dylan Baker <dylan at pnwbakers.com>
> Cc: Eric Engestrom <eric.engestrom at imgtec.com>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
> meson.build | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 308f64cf811..b8c0b04893c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1037,7 +1037,18 @@ 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() <= '3.3'
The correct 'meson way' to compare version strings is
if dep_llvm.version().version_compare('<= 3.3')
> + _llvm_patch = _llvm_version[1]
> + elif dep_llvm.version() >= '3.5'
> + _llvm_patch = _llvm_version[2]
> + elif dep_llvm.version().startswith('3.4.1') or dep_llvm.version().startswith('3.4.2')
> + _llvm_patch = _llvm_version[2]
> + else
> + _llvm_patch = _llvm_version[1]
> + endif
This whole logic seems overly complicated, and I don't think duplicating
the minor version as the patch version is the right thing either.
How about this instead?
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')
> --
> 2.15.1
>
More information about the mesa-dev
mailing list