[libvirt PATCH] meson: Fix yajl workaround

Andrea Bolognani posted 1 patch 2 weeks, 5 days ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220108152935.1164560-1-abologna@redhat.com
meson.build | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

[libvirt PATCH] meson: Fix yajl workaround

Posted by Andrea Bolognani 2 weeks, 5 days ago
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@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

Re: [libvirt PATCH] meson: Fix yajl workaround

Posted by Roman Bolshakov 2 weeks, 4 days ago
On Sat, Jan 08, 2022 at 04:29:35PM +0100, Andrea Bolognani wrote:
> 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.
> 

Hi Andrea,

The fix helps, thanks!

Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>

FWIW, I've tried to figure out where it went broken and it turned out to
be in c32c5ca29ae. Newer meson is not related to the issue.

So you might want to add the tag:

Fixes: c32c5ca29ae ("meson: Use get_pkgconfig_variable('cflags')")

Regards,
Roman

> Signed-off-by: Andrea Bolognani <abologna@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
> 

Re: [libvirt PATCH] meson: Fix yajl workaround

Posted by Andrea Bolognani 2 weeks, 3 days ago
On Mon, Jan 10, 2022 at 08:06:25AM +0300, Roman Bolshakov wrote:
> The fix helps, thanks!
>
> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>
>
> FWIW, I've tried to figure out where it went broken and it turned out to
> be in c32c5ca29ae. Newer meson is not related to the issue.
>
> So you might want to add the tag:
>
> Fixes: c32c5ca29ae ("meson: Use get_pkgconfig_variable('cflags')")

Great detective work! Seeing how I'm the one who broke it, it only
make sense that I would have to fix it :)

I've tweaked the commit message in light of your discovery and pushed
the fix.

I'm still utterly confused about how the CI job for macOS managed to
pass every single time even while yajl detection on the platform was
completely broken...

-- 
Andrea Bolognani / Red Hat / Virtualization