From: Stéphane Graber Date: Tue, 7 Jun 2022 20:21:42 +0000 (-0400) Subject: meson: Only build seccomp and selinux when needed X-Git-Tag: lxc-5.0.0~9^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a489adb897c49e31a8f5bc72ed3141fbe4221f6;p=thirdparty%2Flxc.git meson: Only build seccomp and selinux when needed Signed-off-by: Stéphane Graber --- diff --git a/src/lxc/cmd/meson.build b/src/lxc/cmd/meson.build index 644669fd2..bb5f8acca 100644 --- a/src/lxc/cmd/meson.build +++ b/src/lxc/cmd/meson.build @@ -34,7 +34,6 @@ cmd_common_sources = files( '../lsm/lsm.c', '../lsm/lsm.h', '../lsm/nop.c', - '../lsm/selinux.c', '../lxcseccomp.h', '../lxclock.c', '../lxclock.h', @@ -58,7 +57,6 @@ cmd_common_sources = files( '../process_utils.h', '../ringbuf.c', '../ringbuf.h', - '../seccomp.c', '../start.c', '../start.h', '../state.c', @@ -98,6 +96,14 @@ cmd_common_sources = files( '../log.h', '../log.c') + include_sources +if libseccomp.found() + cmd_common_sources += files('../seccomp.c') +endif + +if libselinux.found() + cmd_common_sources += files('../lsm/selinux.c') +endif + cmd_lxc_init_sources = files( 'lxc_init.c', '../af_unix.c', diff --git a/src/lxc/meson.build b/src/lxc/meson.build index 29d640ff9..5863dad34 100644 --- a/src/lxc/meson.build +++ b/src/lxc/meson.build @@ -36,7 +36,6 @@ liblxc_sources = files( 'lsm/lsm.c', 'lsm/lsm.h', 'lsm/nop.c', - 'lsm/selinux.c', 'storage/btrfs.c', 'storage/btrfs.h', 'storage/dir.c', @@ -123,7 +122,6 @@ liblxc_sources = files( 'ringbuf.h', 'rtnl.c', 'rtnl.h', - 'seccomp.c', 'start.c', 'start.h', 'state.c', @@ -141,6 +139,14 @@ liblxc_sources = files( 'uuid.c', 'uuid.h') +if libseccomp.found() + liblxc_sources += files('seccomp.c') +endif + +if libselinux.found() + liblxc_sources += files('lsm/selinux.c') +endif + if sanitize == 'none' liblxc_static = static_library( 'lxc_static', diff --git a/src/lxc/tools/meson.build b/src/lxc/tools/meson.build index ab78153c3..5dd3b10ae 100644 --- a/src/lxc/tools/meson.build +++ b/src/lxc/tools/meson.build @@ -36,7 +36,6 @@ tools_common_sources = files( '../lsm/lsm.c', '../lsm/lsm.h', '../lsm/nop.c', - '../lsm/selinux.c', '../lxcseccomp.h', '../lxclock.c', '../lxclock.h', @@ -60,7 +59,6 @@ tools_common_sources = files( '../process_utils.h', '../ringbuf.c', '../ringbuf.h', - '../seccomp.c', '../start.c', '../start.h', '../state.c', @@ -100,6 +98,14 @@ tools_common_sources = files( '../log.h', '../log.c') + include_sources + netns_ifaddrs_sources +if libseccomp.found() + tools_common_sources += files('../seccomp.c') +endif + +if libselinux.found() + tools_common_sources += files('../lsm/selinux.c') +endif + tools_lxc_attach_sources = files( 'lxc_attach.c') + tools_common_sources diff --git a/src/tests/meson.build b/src/tests/meson.build index abb8b1e6d..cbec2bbe5 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -34,7 +34,6 @@ tests_common_sources = files( '../lxc/lsm/lsm.c', '../lxc/lsm/lsm.h', '../lxc/lsm/nop.c', - '../lxc/lsm/selinux.c', '../lxc/lxcseccomp.h', '../lxc/lxclock.c', '../lxc/lxclock.h', @@ -58,7 +57,6 @@ tests_common_sources = files( '../lxc/process_utils.h', '../lxc/ringbuf.c', '../lxc/ringbuf.h', - '../lxc/seccomp.c', '../lxc/start.c', '../lxc/start.h', '../lxc/state.c', @@ -98,6 +96,14 @@ tests_common_sources = files( '../lxc/log.h', '../lxc/log.c') + include_sources + netns_ifaddrs_sources +if libseccomp.found() + tests_common_sources += files('../lxc/seccomp.c') +endif + +if libselinux.found() + tests_common_sources += files('../lxc/lsm/selinux.c') +endif + test_programs += executable( 'lxc-test-arch-parse', files('arch_parse.c') + tests_common_sources,