]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: set minimum libbpf/bpftool versions for bpf-gcc
authorJames Hilliard <james.hilliard1@gmail.com>
Sat, 1 Oct 2022 00:09:53 +0000 (00:09 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 1 Oct 2022 04:24:37 +0000 (13:24 +0900)
We need the following libbpf commits for bpf-gcc compatibility:
 - https://github.com/libbpf/libbpf/commit/3d484ca47339b23afb2ec7c508ed9a3a5cf1d287
 - https://github.com/libbpf/libbpf/commit/b31ca3fa0e62fde6aa66f855136e29e088ad9dde

These are first present in libbpf 1.0.0 and bpftool 7.0.0.

meson.build

index 4f193ce17b54cadc1e97d8554953ec6bc8e47251..e76cc1dc6beb0ef460796030acfea82aa9481808 100644 (file)
@@ -1047,18 +1047,28 @@ if not libcap.found()
 endif
 
 want_bpf_framework = get_option('bpf-framework')
+bpf_compiler = get_option('bpf-compiler')
 bpf_framework_required = want_bpf_framework == 'true'
 
-libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2')
+libbpf_version_requirement = '>= 0.2.0'
+if bpf_compiler == 'gcc'
+        libbpf_version_requirement = '>= 1.0.0'
+endif
+libbpf = dependency('libbpf', required : bpf_framework_required, version : libbpf_version_requirement)
 conf.set10('HAVE_LIBBPF', libbpf.found())
 
+bpftool_strip_version_requirement = '>= 5.13.0'
+if bpf_compiler == 'gcc'
+        bpftool_strip_version_requirement = '>= 7.0.0'
+endif
+
 if want_bpf_framework == 'false' or not libbpf.found() or skip_deps
         conf.set10('BPF_FRAMEWORK', false)
 else
-        bpf_compiler = get_option('bpf-compiler')
         clang_found = false
         clang_supports_bpf = false
         bpf_gcc_found = false
+        bpftool_strip = false
         deps_found = false
 
         if bpf_compiler == 'clang'
@@ -1094,16 +1104,16 @@ else
                 # Debian installs this in /usr/sbin/ which is not in $PATH.
                 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
                 # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13).
+                bpftool_strip_required = bpf_framework_required and bpf_compiler == 'gcc'
                 bpftool = find_program('bpftool',
                                        '/usr/sbin/bpftool',
-                                       required : false,
-                                       version : '>= 5.13.0')
+                                       required : bpftool_strip_required,
+                                       version : bpftool_strip_version_requirement)
 
                 if bpftool.found()
                         bpftool_strip = true
                         deps_found = true
-                else
-                        bpftool_strip = false
+                elif bpf_compiler == 'clang'
                         # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
                         bpftool = find_program('bpftool',
                                                '/usr/sbin/bpftool',