Skip to content

Commit

Permalink
meson: optionally build seccomp if it supports notify
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hunt <[email protected]>
  • Loading branch information
haircommander committed Jun 1, 2022
1 parent 546e4db commit ef619b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions hack/seccomp-notify.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash
if $(printf '#include <linux/seccomp.h>\nvoid main(){struct seccomp_notif_sizes s;}' | cc -x c - -o /dev/null 2> /dev/null && pkg-config --atleast-version 2.5.0 libseccomp); then
echo "0"
CC=${CC:-cc}
PKG_CONFIG=${PKG_CONFIG:-pkg-config}
if $(printf '#include <linux/seccomp.h>\nvoid main(){struct seccomp_notif_sizes s;}' | $CC -x c - -o /dev/null 2> /dev/null && $PKG_CONFIG --atleast-version 2.5.0 libseccomp); then
echo "0"
exit 0
fi
exit 1
9 changes: 7 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@ endif

sd_journal = dependency('libsystemd-journal', required : false)
if not sd_journal.found()
sd_journal = dependency('libsystemd', required : false)
sd_journal = dependency('libsystemd', required : false)
endif
if sd_journal.found()
add_project_arguments('-DUSE_JOURNALD=1', language : 'c')
endif

seccomp = dependency('libseccomp', required : false)
if seccomp.found() and compiler.sizeof('seccomp_notif_sizes', prefix : '#include <linux/seccomp.h>') > 0
add_project_arguments('-DUSE_SECCOMP=1', language : 'c')
endif

executable('conmon',
['src/conmon.c',
'src/config.h',
Expand Down Expand Up @@ -86,7 +91,7 @@ executable('conmon',
'src/utils.h',
'src/seccomp_notify.c',
'src/seccomp_notify.h'],
dependencies : [glib, libdl, sd_journal],
dependencies : [glib, libdl, sd_journal, seccomp],
install : true,
install_dir : join_paths(get_option('libexecdir'), 'podman'),
)

0 comments on commit ef619b8

Please sign in to comment.