meson: add secdriver build options

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-06-24 11:01:08 +02:00
parent 27b31f69bd
commit d6b6ee9ad4
5 changed files with 22 additions and 106 deletions

View File

@ -142,14 +142,6 @@ dnl Need to test if pkg-config exists
PKG_PROG_PKG_CONFIG
dnl Security driver checks
LIBVIRT_SECDRIVER_ARG_SELINUX
LIBVIRT_SECDRIVER_ARG_APPARMOR
LIBVIRT_SECDRIVER_CHECK_SELINUX
LIBVIRT_SECDRIVER_CHECK_APPARMOR
LIBVIRT_ARG_WITH_FEATURE([SECRETS], [local secrets management driver], [yes])
if test "$with_libvirtd" = "no"; then
@ -312,11 +304,6 @@ LIBVIRT_STORAGE_RESULT_GLUSTER
LIBVIRT_STORAGE_RESULT_ZFS
LIBVIRT_STORAGE_RESULT_VSTORAGE
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Security Drivers])
AC_MSG_NOTICE([])
LIBVIRT_SECDRIVER_RESULT_SELINUX
LIBVIRT_SECDRIVER_RESULT_APPARMOR
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Driver Loadable Modules])
AC_MSG_NOTICE([])
LIBVIRT_RESULT_DRIVER_MODULES

View File

@ -1,50 +0,0 @@
dnl The AppArmor security driver
dnl
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/>.
dnl
AC_DEFUN([LIBVIRT_SECDRIVER_ARG_APPARMOR], [
LIBVIRT_ARG_WITH([SECDRIVER_APPARMOR], [use AppArmor security driver], [check])
])
AC_DEFUN([LIBVIRT_SECDRIVER_CHECK_APPARMOR], [
AC_REQUIRE([LIBVIRT_CHECK_APPARMOR])
if test "$with_apparmor" != "yes" ; then
if test "$with_secdriver_apparmor" = "check" ; then
with_secdriver_apparmor=no
fi
if test "$with_secdriver_apparmor" != "no" ; then
AC_MSG_ERROR([You must install the AppArmor development package in order to compile libvirt])
fi
elif test "with_secdriver_apparmor" != "no" ; then
with_secdriver_apparmor=yes
AC_DEFINE_UNQUOTED([WITH_SECDRIVER_APPARMOR], 1, [whether AppArmor security driver is available])
fi
AM_CONDITIONAL([WITH_SECDRIVER_APPARMOR], [test "$with_secdriver_apparmor" != "no"])
LIBVIRT_ARG_WITH([APPARMOR_PROFILES], [install apparmor profiles], [no])
if test "$with_apparmor" = "no"; then
with_apparmor_profiles="no"
fi
AM_CONDITIONAL([WITH_APPARMOR_PROFILES], [test "$with_apparmor_profiles" != "no"])
])
AC_DEFUN([LIBVIRT_SECDRIVER_RESULT_APPARMOR], [
LIBVIRT_RESULT([AppArmor], [$with_secdriver_apparmor],
[install profiles: $with_apparmor_profiles])
])

View File

@ -1,43 +0,0 @@
dnl The SElinux security driver
dnl
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/>.
dnl
AC_DEFUN([LIBVIRT_SECDRIVER_ARG_SELINUX], [
LIBVIRT_ARG_WITH([SECDRIVER_SELINUX], [use SELinux security driver], [check])
])
AC_DEFUN([LIBVIRT_SECDRIVER_CHECK_SELINUX], [
AC_REQUIRE([LIBVIRT_CHECK_SELINUX])
if test "$with_selinux" != "yes" ; then
if test "$with_secdriver_selinux" = "check" ; then
with_secdriver_selinux=no
fi
if test "$with_secdriver_selinux" != "no"; then
AC_MSG_ERROR([You must install the libselinux development package and enable SELinux with the --with-selinux=yes in order to compile libvirt --with-secdriver-selinux=yes])
fi
elif test "$with_secdriver_selinux" != "no"; then
with_secdriver_selinux=yes
AC_DEFINE_UNQUOTED([WITH_SECDRIVER_SELINUX], 1, [whether SELinux security driver is available])
fi
AM_CONDITIONAL([WITH_SECDRIVER_SELINUX], [test "$with_secdriver_selinux" != "no"])
])
AC_DEFUN([LIBVIRT_SECDRIVER_RESULT_SELINUX], [
LIBVIRT_RESULT([SELinux], [$with_secdriver_selinux])
])

View File

@ -1842,6 +1842,18 @@ elif get_option('driver_vz').enabled()
error('Parallels Virtualization SDK is needed to build the Virtuozzo driver.')
endif
if not get_option('secdriver_apparmor').disabled() and apparmor_dep.found()
conf.set('WITH_SECDRIVER_APPARMOR', 1)
elif get_option('secdriver_apparmor').enabled()
error('You must install the AppArmor development package in order to compile libvirt.')
endif
if not get_option('secdriver_selinux').disabled() and selinux_dep.found()
conf.set('WITH_SECDRIVER_SELINUX', 1)
elif get_option('secdriver_selinux').enabled()
error('You must install the libselinux development package in order to compile libvirt.')
endif
# define top include directory
@ -1878,6 +1890,12 @@ driver_summary = {
}
summary(driver_summary, section: 'Drivers', bool_yn: true)
secdriver_summary = {
'SELinux': conf.has('WITH_SECDRIVER_SELINUX'),
'AppArmor': conf.has('WITH_SECDRIVER_APPARMOR'),
}
summary(secdriver_summary, section: 'Security Drivers', bool_yn: true)
libs_summary = {
'acl': acl_dep.found(),
'apparmor': apparmor_dep.found(),

View File

@ -65,3 +65,7 @@ option('driver_vbox', type: 'feature', value: 'enabled', description: 'VirtualBo
option('vbox_xpcomc_dir', type: 'string', value: '', description: 'Location of directory containing VirtualBox XPCOMC library')
option('driver_vmware', type: 'feature', value: 'enabled', description: 'VMware driver')
option('driver_vz', type: 'feature', value: 'auto', description: 'Virtuozzo driver')
option('secdriver_apparmor', type: 'feature', value: 'auto', description: 'use AppArmor security driver')
option('apparmor_profiles', type: 'boolean', value: false, description: 'install apparmor profiles')
option('secdriver_selinux', type: 'feature', value: 'auto', description: 'use SELinux security driver')