From 67f619a09395e0732ec37082125a0679a441e0d7 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 2 May 2022 18:09:18 -0400 Subject: [PATCH 1/2] meson: fix undefined behavior with cdata.set10 This function has never taken a number, only a boolean. Due to leaky python implementation details, it cast literally anything to bool regardless, including somewhat common accidental usage of numbers. This now prints an unavoidable deprecation notice stating that it may be removed at any time. Fix this to use what was always intended -- .set(), as used a few lines down for another number. Signed-off-by: Eli Schwartz --- src/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/meson.build b/src/meson.build index 1583c8c6a..32dab83d5 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,10 +7,10 @@ config_cfg.set('INTEL_DRIVER_MICRO_VERSION', intel_vaapi_driver_micro_version) config_cfg.set('INTEL_DRIVER_PRE_VERSION', intel_vaapi_driver_pre_version) config_cfg.set10('HAVE_HYBRID_CODEC', get_option('enable_hybrid_codec')) if WITH_X11 - config_cfg.set10('HAVE_VA_X11', 1) + config_cfg.set('HAVE_VA_X11', 1) endif if WITH_WAYLAND - config_cfg.set10('HAVE_VA_WAYLAND', 1) + config_cfg.set('HAVE_VA_WAYLAND', 1) endif if cc.has_function('log2f') config_cfg.set('HAVE_LOG2F', 1) From 46898dbd124cb3d0172ce3792df837f998925c35 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 2 May 2022 18:15:08 -0400 Subject: [PATCH 2/2] meson: fix warning about unexpected return code checking for run_command Recent versions of Meson warn you that the default is to not check the return code, which is a bad default and may eventually change. To suppress this warning, an explicit `check: ` value must be set. Considering the code in play here: - check if git exists - if so, always assume this is running from a git checkout - embed either '()' or '(git describe version)' it seems likely the intention is indeed to have it be `check: false`, but there's some missing error checking here to ensure it. Check the returncode. If git fails, it is surely because there is no git repository and the build is being run from a tarball. In that case, behave as though git wasn't found in the first place, and use the fallback value. Suppressing the warning means bumping the minimum version of Meson. This can be safely done since both the previous and new minimums are quite old, and libva already depends on a much newer version. Signed-off-by: Eli Schwartz --- meson.build | 2 +- src/meson.build | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index fa0b2f2ed..b60cb41c3 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'intel-vaapi-driver', 'c', version : '2.4.0.1', - meson_version : '>= 0.43.0', + meson_version : '>= 0.47.0', default_options : [ 'warning_level=1', 'buildtype=debugoptimized' ]) diff --git a/src/meson.build b/src/meson.build index 32dab83d5..1164a98f4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -20,13 +20,14 @@ config_file = configure_file( output : 'config.h', configuration : config_cfg) +intel_driver_git_version = intel_vaapi_driver_version if git.found() git_version = run_command( git, '--git-dir', join_paths(meson.source_root(), '.git'), - 'describe', '--tags') - intel_driver_git_version = git_version.stdout().strip() -else - intel_driver_git_version = intel_vaapi_driver_version + 'describe', '--tags', check: false) + if git_version.returncode() == 0 + intel_driver_git_version = git_version.stdout().strip() + endif endif version_cfg = configuration_data()