bpftools: strip path to the binary from prints

Otherwise meson's find_program() can get confused by the output;
now in case of systemd build:
meson.build:1059:16: ERROR: Invalid version of program, need 'bpftool' ['>= 5.6.0'] found '01'.

+17
+2
pkgs/os-specific/linux/bpftools/default.nix
··· 15 sha256 = "sha256-xDalSMcxLOb8WjRyy+rYle749ShB++fHH9jki9/isLo="; 16 }; 17 18 nativeBuildInputs = [ python3 bison flex ]; 19 buildInputs = (if (lib.versionAtLeast version "5.20") 20 then [ libopcodes libbfd ]
··· 15 sha256 = "sha256-xDalSMcxLOb8WjRyy+rYle749ShB++fHH9jki9/isLo="; 16 }; 17 18 + patches = [ ./strip-binary-name.patch ]; 19 + 20 nativeBuildInputs = [ python3 bison flex ]; 21 buildInputs = (if (lib.versionAtLeast version "5.20") 22 then [ libopcodes libbfd ]
+15
pkgs/os-specific/linux/bpftools/strip-binary-name.patch
···
··· 1 + Strip path to the binary from prints. 2 + 3 + I see no sense in including the full path in outputs like bpftool --version 4 + Especially as argv[0] may not include it, based on calling via $PATH or not. 5 + --- a/tools/bpf/bpftool/main.c 6 + +++ b/tools/bpf/bpftool/main.c 7 + @@ -443 +443,7 @@ 8 + - bin_name = argv[0]; 9 + + /* Strip the path if any. */ 10 + + const char *bin_name_slash = strrchr(argv[0], '/'); 11 + + if (bin_name_slash) { 12 + + bin_name = bin_name_slash + 1; 13 + + } else { 14 + + bin_name = argv[0]; 15 + + }