meson: add bhyve build option

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-04-30 00:56:50 +02:00
parent 9fbdd7d0bb
commit 41a8d1ac52
4 changed files with 17 additions and 59 deletions

View File

@ -116,7 +116,6 @@ LIBVIRT_DRIVER_ARG_LIBXL
LIBVIRT_DRIVER_ARG_VBOX
LIBVIRT_DRIVER_ARG_LXC
LIBVIRT_DRIVER_ARG_VZ
LIBVIRT_DRIVER_ARG_BHYVE
LIBVIRT_DRIVER_ARG_ESX
LIBVIRT_DRIVER_ARG_HYPERV
LIBVIRT_DRIVER_ARG_TEST
@ -130,7 +129,6 @@ LIBVIRT_DRIVER_CHECK_LIBXL
LIBVIRT_DRIVER_CHECK_VBOX
LIBVIRT_DRIVER_CHECK_LXC
LIBVIRT_DRIVER_CHECK_VZ
LIBVIRT_DRIVER_CHECK_BHYVE
LIBVIRT_DRIVER_CHECK_ESX
LIBVIRT_DRIVER_CHECK_HYPERV
LIBVIRT_DRIVER_CHECK_TEST
@ -336,7 +334,6 @@ LIBVIRT_DRIVER_RESULT_LXC
LIBVIRT_DRIVER_RESULT_ESX
LIBVIRT_DRIVER_RESULT_HYPERV
LIBVIRT_DRIVER_RESULT_VZ
LIBVIRT_DRIVER_RESULT_BHYVE
LIBVIRT_DRIVER_RESULT_TEST
LIBVIRT_DRIVER_RESULT_NETWORK
LIBVIRT_DRIVER_RESULT_INTERFACE

View File

@ -1,56 +0,0 @@
dnl The bhyve driver
dnl
dnl Copyright (C) 2014 Roman Bogorodskiy
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/>.
dnl
AC_DEFUN([LIBVIRT_DRIVER_ARG_BHYVE],[
LIBVIRT_ARG_WITH_FEATURE([BHYVE], [BHyVe], [check])
])
AC_DEFUN([LIBVIRT_DRIVER_CHECK_BHYVE],[
if test "$with_bhyve" != "no"; then
AC_PATH_PROG([BHYVE], [bhyve], [], [$PATH:/usr/sbin])
AC_PATH_PROG([BHYVECTL], [bhyvectl], [], [$PATH:/usr/sbin])
AC_PATH_PROG([BHYVELOAD], [bhyveload], [], [$PATH:/usr/sbin/])
if test -z "$BHYVE" || test -z "$BHYVECTL" || \
test -z "$BHYVELOAD" || test "$with_freebsd" = "no"; then
if test "$with_bhyve" = "check"; then
with_bhyve="no"
else
AC_MSG_ERROR([The bhyve driver cannot be enabled])
fi
else
with_bhyve="yes"
fi
fi
if test "$with_bhyve" = "yes"; then
AC_DEFINE_UNQUOTED([WITH_BHYVE], 1, [whether bhyve driver is enabled])
AC_DEFINE_UNQUOTED([BHYVE], ["$BHYVE"],
[Location of the bhyve tool])
AC_DEFINE_UNQUOTED([BHYVECTL], ["$BHYVECTL"],
[Location of the bhyvectl tool])
AC_DEFINE_UNQUOTED([BHYVELOAD], ["$BHYVELOAD"],
[Location of the bhyveload tool])
fi
AM_CONDITIONAL([WITH_BHYVE], [test "$with_bhyve" = "yes"])
])
AC_DEFUN([LIBVIRT_DRIVER_RESULT_BHYVE],[
LIBVIRT_RESULT([Bhyve], [$with_bhyve])
])

View File

@ -1589,6 +1589,21 @@ if not get_option('driver_libvirtd').disabled()
endif
endif
if not get_option('driver_bhyve').disabled() and host_machine.system() == 'freebsd'
bhyve_prog = find_program('bhyve', required: get_option('driver_bhyve'))
bhyvectl_prog = find_program('bhyvectl', required: get_option('driver_bhyve'))
bhyveload_prog = find_program('bhyveload', required: get_option('driver_bhyve'))
if bhyve_prog.found() and bhyvectl_prog.found() and bhyveload_prog.found()
conf.set('WITH_BHYVE', 1)
conf.set_quoted('BHYVE', bhyve_prog.path())
conf.set_quoted('BHYVECTL', bhyvectl_prog.path())
conf.set_quoted('BHYVELOAD', bhyveload_prog.path())
endif
elif get_option('driver_bhyve').enabled()
error('The bhyve driver cannot be enabled')
endif
# define top include directory
@ -1609,6 +1624,7 @@ configure_file(output: 'meson-config.h', configuration: conf)
# print configuration summary
driver_summary = {
'Bhyve': conf.has('WITH_BHYVE'),
'Remote': conf.has('WITH_REMOTE'),
'Libvirtd': conf.has('WITH_LIBVIRTD'),
}

View File

@ -48,6 +48,7 @@ option('yajl', type: 'feature', value: 'auto', description: 'yajl support')
# build driver options
option('driver_bhyve', type: 'feature', value: 'auto', description: 'bhyve driver')
option('driver_libvirtd', type: 'feature', value: 'auto', description: 'libvirtd driver')
option('driver_remote', type: 'feature', value: 'enabled', description: 'remote driver')
option('remote_default_mode', type: 'combo', choices: ['legacy', 'direct'], value: 'legacy', description: 'remote driver default mode')