[libvirt PATCH] meson: Fix yajl workaround

Andrea Bolognani abologna at redhat.com
Sat Jan 8 15:29:35 UTC 2022


Recent versions of Meson report

  WARNING: pkgconfig variable 'cflags' not defined for dependency yajl.

which makes sense, because "cflags" is not one of the variables
reported by

  $ pkg-config --print-variables yajl

and

  $ pkg-config --variable=cflags yajl

doesn't work either.

Use "includedir", which is a proper pkg-config variable,
instead.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 meson.build | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index ec7dcffac4..214a3f05eb 100644
--- a/meson.build
+++ b/meson.build
@@ -1356,17 +1356,18 @@ if yajl_dep.found()
   #
   # [1] https://github.com/Homebrew/homebrew-core/pull/74516
   if host_machine.system() != 'linux'
-    cflags = yajl_dep.get_pkgconfig_variable('cflags')
-    if cflags.contains('include/yajl')
+    includedir = yajl_dep.get_pkgconfig_variable('includedir')
+    if includedir.contains('include/yajl')
       rc = run_command(
         'python3', '-c',
         'print("@0@".replace("@1@", "@2@"))'.format(
-          cflags, 'include/yajl', 'include',
+          includedir, 'include/yajl', 'include',
         ),
         check: true,
       )
+      includedir = rc.stdout().strip()
       yajl_dep = declare_dependency(
-        compile_args: rc.stdout().strip().split(),
+        compile_args: [ '-I' + includedir ],
         dependencies: [ yajl_dep ],
       )
     endif
-- 
2.31.1




More information about the libvir-list mailing list