[libvirt PATCH 05/20] meson: add option for building with json-c

Ján Tomko posted 20 patches 3 months, 1 week ago
There is a newer version of this series
[libvirt PATCH 05/20] meson: add option for building with json-c
Posted by Ján Tomko 3 months, 1 week ago
Also disable it immediately for the mingw build because it's not
available there.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 libvirt.spec.in   | 1 +
 meson.build       | 7 +++++++
 meson_options.txt | 1 +
 3 files changed, 9 insertions(+)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 29101e74fe..ad0f4f784f 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1441,6 +1441,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
   -Dfuse=disabled \
   -Dglusterfs=disabled \
   -Dhost_validate=disabled \
+  -Djson_c=disabled \
   -Dlibiscsi=disabled \
   -Dnbdkit=disabled \
   -Dnbdkit_config_default=disabled \
diff --git a/meson.build b/meson.build
index f31485c395..39d6d700d3 100644
--- a/meson.build
+++ b/meson.build
@@ -1018,6 +1018,12 @@ glusterfs_dep = dependency('glusterfs-api', version: '>=' + glusterfs_version, r
 gnutls_version = '3.6.0'
 gnutls_dep = dependency('gnutls', version: '>=' + gnutls_version)
 
+json_c_version = '0.14'
+json_c_dep = dependency('json-c', version: '>=' + json_c_version, required: get_option('json_c'))
+if json_c_dep.found()
+  conf.set('WITH_JSON_C', 1)
+endif
+
 # Check for BSD kvm (kernel memory interface)
 if host_machine.system() == 'freebsd'
   libkvm_dep = cc.find_library('kvm')
@@ -2342,6 +2348,7 @@ libs_summary = {
   'dlopen': dlopen_dep.found(),
   'fuse': fuse_dep.found(),
   'glusterfs': glusterfs_dep.found(),
+  'json-c': json_c_dep.found(),
   'libiscsi': libiscsi_dep.found(),
   'libkvm': libkvm_dep.found(),
   'libnbd': libnbd_dep.found(),
diff --git a/meson_options.txt b/meson_options.txt
index 2d440c63d8..9b1610fcfe 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,6 +28,7 @@ option('capng', type: 'feature', value: 'auto', description: 'cap-ng support')
 option('curl', type: 'feature', value: 'auto', description: 'curl support')
 option('fuse', type: 'feature', value: 'auto', description: 'fuse support')
 option('glusterfs', type: 'feature', value: 'auto', description: 'glusterfs support')
+option('json_c', type: 'feature', value: 'auto', description: 'JSON-C support')
 option('libiscsi', type: 'feature', value: 'auto', description: 'libiscsi support')
 option('libnl', type: 'feature', value: 'auto', description: 'libnl support')
 option('libpcap', type: 'feature', value: 'auto', description: 'libpcap support')
-- 
2.45.2
Re: [libvirt PATCH 05/20] meson: add option for building with json-c
Posted by Peter Krempa 3 months, 1 week ago
On Wed, Aug 14, 2024 at 23:40:20 +0200, Ján Tomko wrote:
> Also disable it immediately for the mingw build because it's not
> available there.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  libvirt.spec.in   | 1 +
>  meson.build       | 7 +++++++
>  meson_options.txt | 1 +
>  3 files changed, 9 insertions(+)
> 
> diff --git a/libvirt.spec.in b/libvirt.spec.in
> index 29101e74fe..ad0f4f784f 100644
> --- a/libvirt.spec.in
> +++ b/libvirt.spec.in
> @@ -1441,6 +1441,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
>    -Dfuse=disabled \
>    -Dglusterfs=disabled \
>    -Dhost_validate=disabled \
> +  -Djson_c=disabled \
>    -Dlibiscsi=disabled \
>    -Dnbdkit=disabled \
>    -Dnbdkit_config_default=disabled \

I'd prefer if you also disable this in the 'native' build and enable it
afterwards so that it doesn't depend on auto-detection meanwhile.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>