Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 52 lines 1.3 kB view raw
1{ lib, stdenv, linuxHeaders 2, libopcodes, libopcodes_2_38 3, libbfd, libbfd_2_38 4, elfutils, readline 5, zlib 6, python3, bison, flex 7}: 8 9stdenv.mkDerivation rec { 10 pname = "bpftools"; 11 12 inherit (linuxHeaders) version src; 13 14 separateDebugInfo = true; 15 16 patches = [ 17 # fix unknown type name '__vector128' on ppc64le 18 ./include-asm-types-for-ppc64le.patch 19 ]; 20 21 nativeBuildInputs = [ python3 bison flex ]; 22 buildInputs = (if (lib.versionAtLeast version "5.20") 23 then [ libopcodes libbfd ] 24 else [ libopcodes_2_38 libbfd_2_38 ]) 25 ++ [ elfutils zlib readline ]; 26 27 preConfigure = '' 28 patchShebangs scripts/bpf_doc.py 29 30 cd tools/bpf 31 substituteInPlace ./bpftool/Makefile \ 32 --replace '/usr/local' "$out" \ 33 --replace '/usr' "$out" \ 34 --replace '/sbin' '/bin' 35 ''; 36 37 buildFlags = [ "bpftool" "bpf_asm" "bpf_dbg" ]; 38 39 installPhase = '' 40 make -C bpftool install 41 install -Dm755 -t $out/bin bpf_asm 42 install -Dm755 -t $out/bin bpf_dbg 43 ''; 44 45 meta = with lib; { 46 homepage = "https://github.com/libbpf/bpftool"; 47 description = "Debugging/program analysis tools for the eBPF subsystem"; 48 license = [ licenses.gpl2Only licenses.bsd2 ]; 49 platforms = platforms.linux; 50 maintainers = with maintainers; [ thoughtpolice ]; 51 }; 52}