Commit 329b0da5 authored by Sergei Trofimovich's avatar Sergei Trofimovich
Browse files

bpftools: use binutils-2.38 for linux before 5.19

Without the change bpftools build fails on binutils-2.39 due to API change:

    jit_disasm.c:105:17: error: too few arguments to function 'init_disassemble_info'
      105 |                 init_disassemble_info(&info, stdout,
          |                 ^~~~~~~~~~~~~~~~~~~~~
parent a1f0d931
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
{ lib, stdenv
, libopcodes, libbfd, elfutils, readline
, libopcodes, libopcodes_2_38
, libbfd, libbfd_2_38
, elfutils, readline
, linuxPackages_latest, zlib
, python3, bison, flex
}:

stdenv.mkDerivation {
stdenv.mkDerivation rec {
  pname = "bpftools";
  inherit (linuxPackages_latest.kernel) version src;

  nativeBuildInputs = [ python3 bison flex ];
  buildInputs = [ libopcodes libbfd elfutils zlib readline ];
  buildInputs = (if (lib.versionAtLeast version "5.20")
                 then [ libopcodes libbfd ]
                 else [ libopcodes_2_38 libbfd_2_38 ])
    ++ [ elfutils zlib readline ];

  preConfigure = ''
    patchShebangs scripts/bpf_doc.py