]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
build: add additional command line switches
authorChristian Brauner <brauner@kernel.org>
Wed, 8 Jun 2022 18:03:05 +0000 (20:03 +0200)
committerChristian Brauner (Microsoft) <christian.brauner@ubuntu.com>
Wed, 8 Jun 2022 18:03:05 +0000 (20:03 +0200)
In order to compile for fuzzers where we will need and want to turn a
bunch of things off add command line switches that allow us to do so.

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
meson.build
meson_options.txt

index 7027b41b0d1e837317018a3dcc24cf32db2304c6..20668218fa30762fc9064a18dfbdc5404f22e0f3 100644 (file)
@@ -141,6 +141,11 @@ want_pam_cgroup = get_option('pam-cgroup')
 want_mans = get_option('man')
 want_tests = get_option('tests')
 want_tools = get_option('tools')
+want_commands = get_option('commands')
+want_capabilities = get_option('capabilities')
+want_apparmor = get_option('apparmor')
+want_openssl = get_option('openssl')
+want_selinux = get_option('selinux')
 
 srcconf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern)
 if coverity
@@ -188,6 +193,7 @@ possible_cc_flags = [
     '-Wreturn-local-addr',
     '-fsanitize=cfi',
     '-Wstringop-overflow',
+    '-Wno-missing-field-initializers',
 ]
 
 possible_link_flags = [
@@ -303,34 +309,51 @@ if libseccomp.found()
 endif
 
 ## SELinux.
-libselinux = dependency('libselinux', required: false)
-srcconf.set10('HAVE_SELINUX', libselinux.found())
-pkgconfig_libs += libselinux
+if want_selinux
+    libselinux = dependency('libselinux', required: false)
+    srcconf.set10('HAVE_SELINUX', libselinux.found())
+    pkgconfig_libs += libselinux
+else
+    srcconf.set10('HAVE_SELINUX', false)
+endif
 
 ## AppArmor.
-libapparmor = dependency('libapparmor', required: false)
-srcconf.set10('HAVE_APPARMOR', libapparmor.found())
+if want_apparmor
+    libapparmor = dependency('libapparmor', required: false)
+    srcconf.set10('HAVE_APPARMOR', libapparmor.found())
+else
+    srcconf.set10('HAVE_APPARMOR', false)
+endif
 
 ## OpenSSL.
-libopenssl = dependency('openssl', required: false)
-srcconf.set10('HAVE_OPENSSL', libopenssl.found())
-pkgconfig_libs += libopenssl
+if want_openssl
+    libopenssl = dependency('openssl', required: false)
+    srcconf.set10('HAVE_OPENSSL', libopenssl.found())
+    pkgconfig_libs += libopenssl
+else
+    srcconf.set10('HAVE_OPENSSL', false)
+endif
 
 ## Libcap..
-libcap = dependency('libcap', required: false)
-if not libcap.found()
-    # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
-    libcap = cc.find_library('cap', required: false)
-endif
-srcconf.set10('HAVE_LIBCAP', libcap.found())
-pkgconfig_libs += libcap
+if want_capabilities
+    libcap = dependency('libcap', required: false)
+    if not libcap.found()
+        # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
+        libcap = cc.find_library('cap', required: false)
+    endif
+    srcconf.set10('HAVE_LIBCAP', libcap.found())
+    pkgconfig_libs += libcap
 
-libcap_static = dependency('libcap', required: false, static: true)
-if not libcap_static.found()
-    # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
-    libcap_static = cc.find_library('cap', required: false, static: true)
+    libcap_static = dependency('libcap', required: false, static: true)
+    if not libcap_static.found()
+        # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
+        libcap_static = cc.find_library('cap', required: false, static: true)
+    endif
+    srcconf.set10('HAVE_STATIC_LIBCAP', libcap_static.found())
+else
+    srcconf.set10('HAVE_LIBCAP', false)
+    srcconf.set10('HAVE_STATIC_LIBCAP', false)
 endif
-srcconf.set10('HAVE_STATIC_LIBCAP', libcap_static.found())
 
 ## PAM.
 pam = cc.find_library('pam', has_headers: 'security/pam_modules.h', required: want_pam_cgroup)
@@ -675,8 +698,12 @@ subdir('doc/ko')
 subdir('doc/examples')
 subdir('doc/rootfs')
 subdir('hooks')
-subdir('src/lxc/cmd')
-subdir('src/lxc/tools')
+if want_commands
+    subdir('src/lxc/cmd')
+endif
+if want_tools
+    subdir('src/lxc/tools')
+endif
 subdir('src/lxc/tools/include')
 subdir('src/tests')
 subdir('templates')
index ac07d246b9b9744fc36ee1da3882b6c078e54f76..19c788be61dfbe81cbdc1f87fb20cf60cbe8315c 100644 (file)
@@ -26,6 +26,21 @@ option('pam-cgroup', type: 'boolean', value: 'false',
 option('tools', type: 'boolean', value: 'true',
        description: 'build and install tools')
 
+option('commands', type: 'boolean', value: 'true',
+       description: 'build and install commands')
+
+option('capabilities', type: 'boolean', value: 'true',
+       description: 'use capabilities')
+
+option('apparmor', type: 'boolean', value: 'true',
+       description: 'use apparmor')
+
+option('openssl', type: 'boolean', value: 'true',
+       description: 'use openssl')
+
+option('selinux', type: 'boolean', value: 'true',
+       description: 'use selinux')
+
 option('tests', type: 'boolean', value: 'false',
        description: 'build and install tests')