From de617ce96b9576e461e1d15a96cdd3f1b2477456 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 8 Dec 2021 12:16:28 +0100 Subject: [PATCH] admin: Build only when RPC is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The admin module is very closely tied to RPC. If we are building without RPC support there's not much use for the admin module, in fact it fails to build. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- examples/c/admin/meson.build | 36 ++++++------- src/admin/meson.build | 36 ++++++------- src/meson.build | 98 ++++++++++++++++++------------------ tools/meson.build | 44 ++++++++-------- 4 files changed, 111 insertions(+), 103 deletions(-) diff --git a/examples/c/admin/meson.build b/examples/c/admin/meson.build index 094408a63c..aa7811ebe5 100644 --- a/examples/c/admin/meson.build +++ b/examples/c/admin/meson.build @@ -8,20 +8,22 @@ example_admin_files = [ 'threadpool_params', ] -foreach name : example_admin_files - source_file = '@0@.c'.format(name) - executable( - name, - [ - source_file, - ], - include_directories: [ - libvirt_inc, - ], - link_with: [ - libvirt_lib, - libvirt_admin_lib, - ], - ) - install_data(source_file, install_dir: example_dir / 'c' / 'admin') -endforeach +if conf.has('WITH_REMOTE') + foreach name : example_admin_files + source_file = '@0@.c'.format(name) + executable( + name, + [ + source_file, + ], + include_directories: [ + libvirt_inc, + ], + link_with: [ + libvirt_lib, + libvirt_admin_lib, + ], + ) + install_data(source_file, install_dir: example_dir / 'c' / 'admin') + endforeach +endif diff --git a/src/admin/meson.build b/src/admin/meson.build index f787c6665b..130997fb87 100644 --- a/src/admin/meson.build +++ b/src/admin/meson.build @@ -91,24 +91,26 @@ libvirt_admin_syms_flags = '@0@@1@'.format( libvirt_admin_syms_file.full_path(), ) -admin_driver_lib = static_library( - 'virt_admin_driver', - [ - admin_driver_sources, - admin_driver_generated, - ], - dependencies: [ - rpc_dep, - sasl_dep, - src_dep, - xdr_dep, - ], -) +if conf.has('WITH_REMOTE') + admin_driver_lib = static_library( + 'virt_admin_driver', + [ + admin_driver_sources, + admin_driver_generated, + ], + dependencies: [ + rpc_dep, + sasl_dep, + src_dep, + xdr_dep, + ], + ) -check_protocols += { - 'name': 'admin_protocol', - 'lib': admin_driver_lib, -} + check_protocols += { + 'name': 'admin_protocol', + 'lib': admin_driver_lib, + } +endif virt_conf_files += files('libvirt-admin.conf') diff --git a/src/meson.build b/src/meson.build index 2bd88e6699..2408344ef7 100644 --- a/src/meson.build +++ b/src/meson.build @@ -517,48 +517,48 @@ libvirt_lxc_lib = shared_library( # libvirt-admin.so - -libvirt_admin_lib = shared_library( - 'virt-admin', - [ - admin_sources, - admin_client_generated, - admin_driver_generated, - datatypes_sources, - dtrace_gen_objects, - ], - dependencies: [ - capng_dep, - devmapper_dep, - gnutls_dep, - libssh2_dep, - libssh_dep, - sasl_dep, - src_dep, - rpc_dep, - xdr_dep, - yajl_dep, - ], - include_directories: [ - admin_inc_dir, - remote_inc_dir, - ], - link_args: [ - libvirt_admin_syms_flags, - libvirt_nodelete, - ], - link_with: [ - libvirt_lib, - ], - link_depends: [ - libvirt_admin_syms_file, - ], - install: true, - install_rpath: libvirt_rpath, - version: libvirt_lib_version, - soversion: libvirt_so_version, -) - +if conf.has('WITH_REMOTE') + libvirt_admin_lib = shared_library( + 'virt-admin', + [ + admin_sources, + admin_client_generated, + admin_driver_generated, + datatypes_sources, + dtrace_gen_objects, + ], + dependencies: [ + capng_dep, + devmapper_dep, + gnutls_dep, + libssh2_dep, + libssh_dep, + sasl_dep, + src_dep, + rpc_dep, + xdr_dep, + yajl_dep, + ], + include_directories: [ + admin_inc_dir, + remote_inc_dir, + ], + link_args: [ + libvirt_admin_syms_flags, + libvirt_nodelete, + ], + link_with: [ + libvirt_lib, + ], + link_depends: [ + libvirt_admin_syms_file, + ], + install: true, + install_rpath: libvirt_rpath, + version: libvirt_lib_version, + soversion: libvirt_so_version, + ) +endif # build libvirt shared modules @@ -919,12 +919,14 @@ if host_machine.system() == 'linux' env: runutf8, ) - test( - 'check-admin-symfile', - python3_prog, - args: [ check_symfile_prog.path(), libvirt_admin_syms, libvirt_admin_lib ], - env: runutf8, - ) + if conf.has('WITH_REMOTE') + test( + 'check-admin-symfile', + python3_prog, + args: [ check_symfile_prog.path(), libvirt_admin_syms, libvirt_admin_lib ], + env: runutf8, + ) + endif endif test( diff --git a/tools/meson.build b/tools/meson.build index 3fba313e5f..22fa3604ba 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -206,27 +206,29 @@ executable( install_rpath: libvirt_rpath, ) -executable( - 'virt-admin', - [ - 'virt-admin.c', - 'virt-admin-completer.c', - ], - dependencies: [ - tools_dep, - readline_dep, - ], - link_args: [ - coverage_flags, - ], - link_with: [ - libvirt_admin_lib, - libvirt_shell_lib, - ], - install: true, - install_dir: bindir, - install_rpath: libvirt_rpath, -) +if conf.has('WITH_REMOTE') + executable( + 'virt-admin', + [ + 'virt-admin.c', + 'virt-admin-completer.c', + ], + dependencies: [ + tools_dep, + readline_dep, + ], + link_args: [ + coverage_flags, + ], + link_with: [ + libvirt_admin_lib, + libvirt_shell_lib, + ], + install: true, + install_dir: bindir, + install_rpath: libvirt_rpath, + ) +endif tools_conf = configuration_data() tools_conf.set('PACKAGE', meson.project_name())