admin: Build only when RPC is available

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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2021-12-08 12:16:28 +01:00
parent b7ccae7f1f
commit de617ce96b
4 changed files with 111 additions and 103 deletions

View File

@ -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

View File

@ -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')

View File

@ -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(

View File

@ -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())