Switch over to using meson for building the virt-host-validate
tool
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
configure.ac | 3 --
m4/virt-host-validate.m4 | 43 -----------------------------
meson.build | 4 +++
meson_options.txt | 2 ++
src/meson.build | 11 ++++++++
tools/Makefile.am | 52 -----------------------------------
tools/meson.build | 59 ++++++++++++++++++++++++++++++++++++++++
7 files changed, 76 insertions(+), 98 deletions(-)
delete mode 100644 m4/virt-host-validate.m4
diff --git a/configure.ac b/configure.ac
index f5c6fabc6d..412ac4b94b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -512,7 +512,6 @@ LIBVIRT_ARG_CHRDEV_LOCK_FILES
LIBVIRT_ARG_DEFAULT_EDITOR
LIBVIRT_ARG_LOADER_NVRAM
LIBVIRT_ARG_LOGIN_SHELL
-LIBVIRT_ARG_HOST_VALIDATE
LIBVIRT_ARG_TLS_PRIORITY
LIBVIRT_ARG_SYSCTL_CONFIG
@@ -525,7 +524,6 @@ LIBVIRT_CHECK_CHRDEV_LOCK_FILES
LIBVIRT_CHECK_DEFAULT_EDITOR
LIBVIRT_CHECK_LOADER_NVRAM
LIBVIRT_CHECK_LOGIN_SHELL
-LIBVIRT_CHECK_HOST_VALIDATE
LIBVIRT_CHECK_TLS_PRIORITY
LIBVIRT_CHECK_SYSCTL_CONFIG
LIBVIRT_CHECK_NSS
@@ -1063,7 +1061,6 @@ LIBVIRT_RESULT_CHRDEV_LOCK_FILES
LIBVIRT_RESULT_DEFAULT_EDITOR
LIBVIRT_RESULT_LOADER_NVRAM
LIBVIRT_RESULT_LOGIN_SHELL
-LIBVIRT_RESULT_HOST_VALIDATE
LIBVIRT_RESULT_TLS_PRIORITY
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Developer Tools])
diff --git a/m4/virt-host-validate.m4 b/m4/virt-host-validate.m4
deleted file mode 100644
index e43cec5366..0000000000
--- a/m4/virt-host-validate.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-dnl Copyright (C) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
-dnl Copyright (C) 2016 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library. If not, see
-dnl <
http://www.gnu.org/licenses/>.
-
-AC_DEFUN([LIBVIRT_ARG_HOST_VALIDATE], [
- LIBVIRT_ARG_WITH([HOST_VALIDATE], [build virt-host-validate], [check])
-])
-
-AC_DEFUN([LIBVIRT_CHECK_HOST_VALIDATE], [
- if test "x$with_host_validate" != "xno"; then
- if test "x$with_win" = "xyes"; then
- if test "x$with_host_validate" = "xyes"; then
- AC_MSG_ERROR([virt-host-validate is not supported on Windows])
- else
- with_host_validate=no;
- fi
- else
- with_host_validate=yes;
- fi
- fi
-
- if test "x$with_host_validate" = "xyes" ; then
- AC_DEFINE_UNQUOTED([WITH_HOST_VALIDATE], 1, [whether virt-host-validate is built])
- fi
- AM_CONDITIONAL([WITH_HOST_VALIDATE], [test "x$with_host_validate" =
"xyes"])
-])
-
-AC_DEFUN([LIBVIRT_RESULT_HOST_VALIDATE], [
- LIBVIRT_RESULT([virt-host-validate], [$with_host_validate])
-])
diff --git a/meson.build b/meson.build
index 53ee9e331f..4e759d147b 100644
--- a/meson.build
+++ b/meson.build
@@ -24,6 +24,7 @@ gnulib_inc_dir = include_directories('gnulib/lib')
top_inc_dir = include_directories('.')
cc = meson.get_compiler('c')
+pod2man = find_program('pod2man')
gnulib = cc.find_library('libgnu', dirs: [meson.build_root() / 'gnulib' /
'lib' / '.libs'])
gnulib_dep = declare_dependency(
@@ -34,7 +35,10 @@ gnulib_dep = declare_dependency(
meson.add_dist_script('build-aux' / 'dist.py', meson.source_root(),
meson.build_root())
yajl_min_version = '>= 2.0.3'
+libxml_min_version = '>= 2.9.1'
+
yajl_dep = dependency('yajl', version: yajl_min_version)
+libxml_dep = dependency('libxml-2.0', version: libxml_min_version)
subdir('src')
subdir('examples')
diff --git a/meson_options.txt b/meson_options.txt
index 4667fa6580..92062f5d63 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -21,3 +21,5 @@ option('with-driver-nodedev', type: 'boolean', value:
true, description: 'Enable
option('with-driver-nwfilter', type: 'boolean', value: true, description:
'Enable nwfilter driver')
option('with-driver-secret', type: 'boolean', value: true, description:
'Enable secret driver')
option('with-driver-storage', type: 'boolean', value: true, description:
'Enable storage driver')
+
+option('with-tools-host-validate', type: 'boolean', value: true,
description: 'Enable virt-host-validate tool')
diff --git a/src/meson.build b/src/meson.build
index 71b42baf22..7393a86796 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,15 @@
+src_inc_dir = include_directories('.')
+util_inc_dir = include_directories('util')
+common_inc_dir = [
+ gnulib_inc_dir,
+ public_inc_dir,
+ top_inc_dir,
+ src_inc_dir,
+ util_inc_dir,
+]
+
+
libvirt = cc.find_library('libvirt', dirs: [meson.build_root() / 'src' /
'.libs'])
libvirt_admin = cc.find_library('libvirt-admin', dirs: [meson.build_root() /
'src' / '.libs'])
libvirt_qemu = cc.find_library('libvirt-qemu', dirs: [meson.build_root() /
'src' / '.libs'])
diff --git a/tools/Makefile.am b/tools/Makefile.am
index a294224a99..749eaa12ff 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -53,7 +53,6 @@ ICON_FILES = \
PODFILES = \
virt-admin.pod \
- virt-host-validate.pod \
virt-login-shell.pod \
virt-pki-validate.pod \
virt-sanlock-cleanup.pod \
@@ -63,7 +62,6 @@ PODFILES = \
MANINFILES = \
virt-admin.1.in \
- virt-host-validate.1.in \
virt-login-shell.1.in \
virt-pki-validate.1.in \
virt-sanlock-cleanup.8.in \
@@ -116,11 +114,6 @@ libexec_PROGRAMS = virt-login-shell-helper
man1_MANS += virt-login-shell.1
endif WITH_LOGIN_SHELL
-if WITH_HOST_VALIDATE
-bin_PROGRAMS += virt-host-validate
-man1_MANS += virt-host-validate.1
-endif WITH_HOST_VALIDATE
-
virt-xml-validate: virt-xml-validate.in Makefile
$(AM_V_GEN)sed -e 's|[@]schemadir@|$(pkgdatadir)/schemas|g' \
-e 's|[@]VERSION@|$(VERSION)|g' \
@@ -156,51 +149,6 @@ libvirt_shell_la_SOURCES = \
vsh.c vsh.h \
vsh-table.c vsh-table.h
-virt_host_validate_SOURCES = \
- virt-host-validate.c \
- virt-host-validate-common.c virt-host-validate-common.h
-
-VIRT_HOST_VALIDATE_QEMU = \
- virt-host-validate-qemu.c \
- virt-host-validate-qemu.h
-VIRT_HOST_VALIDATE_LXC = \
- virt-host-validate-lxc.c \
- virt-host-validate-lxc.h
-VIRT_HOST_VALIDATE_BHYVE = \
- virt-host-validate-bhyve.c \
- virt-host-validate-bhyve.h
-if WITH_QEMU
-virt_host_validate_SOURCES += $(VIRT_HOST_VALIDATE_QEMU)
-else ! WITH_QEMU
-EXTRA_DIST += $(VIRT_HOST_VALIDATE_QEMU)
-endif ! WITH_QEMU
-
-if WITH_LXC
-virt_host_validate_SOURCES += $(VIRT_HOST_VALIDATE_LXC)
-else ! WITH_LXC
-EXTRA_DIST += $(VIRT_HOST_VALIDATE_LXC)
-endif ! WITH_LXC
-
-if WITH_BHYVE
-virt_host_validate_SOURCES += $(VIRT_HOST_VALIDATE_BHYVE)
-else ! WITH_BHYVE
-EXTRA_DIST += $(VIRT_HOST_VALIDATE_BHYVE)
-endif ! WITH_BHYVE
-
-virt_host_validate_LDFLAGS = \
- $(AM_LDFLAGS) \
- $(PIE_LDFLAGS) \
- $(COVERAGE_LDFLAGS) \
- $(NULL)
-
-virt_host_validate_LDADD = \
- ../src/libvirt.la \
- ../gnulib/lib/libgnu.la \
- $(NULL)
-
-virt_host_validate_CFLAGS = \
- $(AM_CFLAGS) \
- $(NULL)
# virt-login-shell will be setuid, and must not link to anything
# except glibc. It wil scrub the environment and then invoke the
diff --git a/tools/meson.build b/tools/meson.build
index dd2da4adc7..fdc3549411 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,2 +1,61 @@
subdir('nss')
+
+with_tools_host_validate = get_option('with-tools-host-validate')
+if not (with_driver_qemu or with_driver_lxc or with_driver_bhyve)
+ with_tools_host_validate = false
+endif
+
+if with_tools_host_validate
+ virt_host_validate_src = [
+ 'virt-host-validate.c',
+ 'virt-host-validate-common.c',
+ 'virt-host-validate-common.h',
+ ]
+
+ if with_driver_qemu
+ virt_host_validate_src += [
+ 'virt-host-validate-qemu.c',
+ 'virt-host-validate-qemu.h',
+ ]
+ endif
+
+ if with_driver_lxc
+ virt_host_validate_src += [
+ 'virt-host-validate-lxc.c',
+ 'virt-host-validate-lxc.h',
+ ]
+ endif
+
+ if with_driver_bhyve
+ virt_host_validate_src += [
+ 'virt-host-validate-bhyve.c',
+ 'virt-host-validate-bhyve.h',
+ ]
+ endif
+
+ virt_host_validate_inc = common_inc_dir
+ virt_host_validate_libs = [libvirt_dep, libxml_dep, gnulib_dep]
+ virt_host_validate = executable(
+ 'virt-host-validate',
+ install: true,
+ sources: virt_host_validate_src,
+ include_directories: virt_host_validate_inc,
+ dependencies: virt_host_validate_libs
+ )
+
+ virt_host_validate_man = custom_target(
+ 'virt_host_validate_man',
+ output : 'virt-host-validate.1',
+ input : 'virt-host-validate.pod',
+ command : [
+ pod2man,
+ '--section=1',
+ '--center=Virtualization Support',
+ '--release=libvirt @0(a)'.format(meson.project_version()),
+ '@INPUT@', '@OUTPUT@'
+ ],
+ install : true,
+ install_dir : join_paths(get_option('mandir'), 'man1')
+ )
+endif
--
2.21.0