]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: copy prefix mapping CFLAGS when building BPF objects
authorLuca Boccassi <bluca@debian.org>
Sat, 27 Apr 2024 16:55:27 +0000 (17:55 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 29 Apr 2024 17:00:34 +0000 (19:00 +0200)
Otherwise the filenames will contain variable paths and break reproducibility

meson.build

index af282af19cceeb5969aba26fc6e93c5a664bff40..547039064a165fb36d0876a92955e13e18be456c 100644 (file)
@@ -1717,6 +1717,24 @@ if conf.get('BPF_FRAMEWORK') == 1
                 '-c',
         ]
 
+        # If c_args contains these flags copy them along with the values, in order to avoid breaking
+        # reproducible builds and other functionality
+        propagate_cflags = [
+                '-ffile-prefix-map=',
+                '-fdebug-prefix-map=',
+                '-fmacro-prefix-map=',
+        ]
+
+        foreach opt : c_args
+                foreach flag : propagate_cflags
+                        if opt.startswith(flag)
+                                bpf_clang_flags += [opt]
+                                bpf_gcc_flags += [opt]
+                                break
+                        endif
+                endforeach
+        endforeach
+
         # Generate defines that are appropriate to tell the compiler what architecture
         # we're compiling for. By default we just map meson's cpu_family to __<cpu_family>__.
         # This dictionary contains the exceptions where this doesn't work.