diff options
author | Julia Kartseva <hex@fb.com> | 2020-11-13 17:08:15 -0800 |
---|---|---|
committer | Julia Kartseva <hex@fb.com> | 2021-04-26 16:20:58 -0700 |
commit | 7d861e12637892f1fcf7bbd69e4aec5a096f4bcb (patch) | |
tree | db9ca703607e12be7bfbd6a9feb57167da1829ba /meson.build | |
parent | cf4f9a57f20f1b21d59574e1f0cb6504506f1728 (diff) | |
download | systemd-7d861e12637892f1fcf7bbd69e4aec5a096f4bcb.tar.gz |
meson, bpf: add HAVE_LIBBPF, BPF_FRAMEWORK options
* Add `bpf-framework` feature gate with 'auto', 'true' and 'false' choices
* Add libbpf [0] dependency
* Search for clang llvm-strip and bpftool binaries in compile time to
generate bpf skeleton.
For libbpf [0], make 0.2.0 [1] the minimum required version.
If libbpf is satisfied, set HAVE_LIBBPF config option to 1.
If `bpf-framework` feature gate is set to 'auto', means that whether
bpf feature is enabled or now is defined by the presence of all of
libbpf, clang, llvm and bpftool in build
environment.
With 'auto' all dependencies are optional.
If the gate is set to `true`, make all of the libbpf, clang and llvm
dependencies mandatory.
If it's set to `false`, set `BPF_FRAMEWORK` to false and make libbpf
dependency optional.
libbpf dependency is dynamic followed by the common pattern in systemd.
meson, bpf: add build rule for socket_bind program
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 81db2d27ab..93d3c26a22 100644 --- a/meson.build +++ b/meson.build @@ -937,6 +937,25 @@ if not libcap.found() libcap = cc.find_library('cap') endif +want_bpf_framework = get_option('bpf-framework') +bpf_framework_required = want_bpf_framework == 'true' + +libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2') +conf.set10('HAVE_LIBBPF', libbpf.found()) + +if want_bpf_framework == 'false' + conf.set10('BPF_FRAMEWORK', 0) +else + clang = find_program('clang', required : bpf_framework_required) + llvm_strip = find_program('llvm-strip', required : bpf_framework_required) + bpftool = find_program('bpftool', required : bpf_framework_required) + bpf_arches = ['x86_64'] + deps_found = libbpf.found() and clang.found() and llvm_strip.found() and bpftool.found() + # Can build BPF program from source code in restricted C + conf.set10('BPF_FRAMEWORK', + bpf_arches.contains(host_machine.cpu_family()) and deps_found) +endif + libmount = dependency('mount', version : fuzzer_build ? '>= 0' : '>= 2.30') @@ -1604,6 +1623,7 @@ conf.set10('ENABLE_EFI', have) ############################################################ +build_bpf_skel_py = find_program('tools/build-bpf-skel.py') generate_gperfs = find_program('tools/generate-gperfs.py') make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') make_directive_index_py = find_program('tools/make-directive-index.py') @@ -1696,6 +1716,7 @@ install_libsystemd_static = static_library( libxz, libzstd, liblz4, + libbpf, libcap, libblkid, libmount, @@ -3766,6 +3787,7 @@ foreach tuple : [ ['elfutils'], ['gcrypt'], ['gnutls'], + ['libbpf'], ['libcryptsetup'], ['libcurl'], ['libfdisk'], @@ -3792,6 +3814,7 @@ foreach tuple : [ # components ['backlight'], ['binfmt'], + ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1], ['coredump'], ['environment.d'], ['efi'], |