]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
meson: Only build seccomp and selinux when needed
authorStéphane Graber <stgraber@ubuntu.com>
Tue, 7 Jun 2022 20:21:42 +0000 (16:21 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 7 Jun 2022 21:18:12 +0000 (17:18 -0400)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/cmd/meson.build
src/lxc/meson.build
src/lxc/tools/meson.build
src/tests/meson.build

index 644669fd2136694d4b8e3ab3bd11c0d16205a9f0..bb5f8acca6238fa23b2a2a74904b157c42d92f67 100644 (file)
@@ -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',
index 29d640ff94c2ff5959e72cf9f5940e362e85184d..5863dad34d13243fb5f35be6fc402fec8de49d4a 100644 (file)
@@ -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',
index ab78153c3093723baaea14ffcf11b0bc131a061d..5dd3b10ae17274895e27b90735afeaf1a62971ac 100644 (file)
@@ -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
 
index abb8b1e6d4ffdcb780a382ace297b6b03b90c687..cbec2bbe5650805d46be477208658443f6a97831 100644 (file)
@@ -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,