build: add seccomp build option

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2022-06-09 18:10:27 +02:00 committed by Christian Brauner (Microsoft)
parent 826391b2a2
commit 0b9adfdad4
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
3 changed files with 46 additions and 35 deletions

View File

@ -146,6 +146,7 @@ want_capabilities = get_option('capabilities')
want_apparmor = get_option('apparmor') want_apparmor = get_option('apparmor')
want_openssl = get_option('openssl') want_openssl = get_option('openssl')
want_selinux = get_option('selinux') want_selinux = get_option('selinux')
want_seccomp = get_option('seccomp')
srcconf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern) srcconf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern)
if coverity if coverity
@ -291,6 +292,7 @@ endif
threads = dependency('threads') threads = dependency('threads')
## Seccomp. ## Seccomp.
if want_seccomp
libseccomp = dependency('libseccomp', required: false) libseccomp = dependency('libseccomp', required: false)
srcconf.set10('HAVE_SECCOMP', libseccomp.found()) srcconf.set10('HAVE_SECCOMP', libseccomp.found())
pkgconfig_libs += libseccomp pkgconfig_libs += libseccomp
@ -327,6 +329,9 @@ if libseccomp.found()
endif endif
endforeach endforeach
endif endif
else
srcconf.set10('HAVE_SECCOMP', false)
endif
## SELinux. ## SELinux.
if want_selinux if want_selinux
@ -667,9 +672,12 @@ subdir('src/lxc/pam')
# Library. # Library.
liblxc_dependencies = [ liblxc_dependencies = [
threads, threads,
libseccomp,
] ]
if want_seccomp
liblxc_dependencies += libseccomp
endif
if want_capabilities if want_capabilities
liblxc_dependencies += [libcap] liblxc_dependencies += [libcap]
endif endif

View File

@ -32,6 +32,9 @@ option('commands', type: 'boolean', value: 'true',
option('capabilities', type: 'boolean', value: 'true', option('capabilities', type: 'boolean', value: 'true',
description: 'use capabilities') description: 'use capabilities')
option('seccomp', type: 'boolean', value: 'true',
description: 'use seccomp')
option('apparmor', type: 'boolean', value: 'true', option('apparmor', type: 'boolean', value: 'true',
description: 'use apparmor') description: 'use apparmor')

View File

@ -139,7 +139,7 @@ liblxc_sources = files(
'uuid.c', 'uuid.c',
'uuid.h') 'uuid.h')
if libseccomp.found() if want_seccomp and libseccomp.found()
liblxc_sources += files('seccomp.c') liblxc_sources += files('seccomp.c')
endif endif