msdk: meson: Don't get dependency variable before it's valid.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 30 Sep 2021 15:43:09 +0000 (17:43 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 1 Oct 2021 23:43:41 +0000 (23:43 +0000)
It's possible to have installed MediaSDK environment
package (libmfx-dev in Debian) without libva environment package. This
setup will lead to a breakage of meson configuration.

The fix is to get the libva's driver directory variable after the
dependency is validated as found.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/998>

subprojects/gst-plugins-bad/sys/msdk/meson.build

index a771600..ac2dd81 100644 (file)
@@ -154,14 +154,15 @@ else
   libdrm_dep = dependency('libdrm', required: get_option('msdk'))
   msdk_deps = declare_dependency(dependencies: [libva_dep, libva_drm_dep, libdl_dep, libgudev_dep, libdrm_dep])
   msdk_deps_found = libva_dep.found() and libva_drm_dep.found() and libdl_dep.found() and libgudev_dep.found() and libdrm_dep.found()
-  driverdir = libva_dep.get_pkgconfig_variable('driverdir')
+endif
+
+if msdk_deps_found
+  driverdir = libva_dep.get_variable(pkgconfig: 'driverdir', internal: 'driverdir', default_value: '')
   if driverdir == ''
     driverdir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
   endif
   cdata.set_quoted('VA_DRIVERS_PATH', '@0@'.format(driverdir))
-endif
 
-if msdk_deps_found
   gstmsdktag = library('gstmsdk',
     msdk_sources,
     c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],