anchor.diff:      patch -p1 < libbcc-path.patch
     '';
   
  -  preConfigure = ''
  -    chmod -R u+w ../libbpf/
  -    rmdir src/cc/libbpf
  -    (cd src/cc && ln -svf ../../../libbpf/ libbpf)
  -  '';
  -
     postInstall = ''
       mkdir -p $out/bin $out/share
       rm -r $out/share/bcc/tools/old
  
positive.code: { stdenv, fetchFromGitHub, makeWrapper, cmake, llvmPackages, kernel
  , flex, bison, elfutils, python, luajit, netperf, iperf, libelf
  , systemtap
  }:
  
  python.pkgs.buildPythonApplication rec {
    version = "0.11.0";
    name = "bcc-${version}";
  
    srcs = [
      (fetchFromGitHub {
        owner  = "iovisor";
        repo   = "bcc";
        rev    = "v${version}";
        sha256 = "1v2gzdd4k58f3yxmq4z97a7xh5vyd84flzzfr9k2cm29i93cwcam";
        name   = "bcc";
      })
  
      # note: keep this in sync with the version that was used at the time of the
      # tagged release!
      (fetchFromGitHub {
        owner  = "libbpf";
        repo   = "libbpf";
        rev    = "a30df5c09fb3941fc42c4570ed2545e7057bf82a";
        sha256 = "088vb9sfs1zazlqi6abb3ia1xgpmwiz5pmz6y3a6gbh0zdrgh6px";
        name   = "libbpf";
      })
    ];
    sourceRoot = "bcc";
    format = "other";
  
    buildInputs = with llvmPackages; [
      llvm clang-unwrapped kernel
      elfutils luajit netperf iperf
      systemtap.stapBuild flex
    ];
  
    patches = [
  
negative.code:       if [ ! -e $bin ]; then
          ln -s $f $bin
        fi
        substituteInPlace "$f" \
          --replace '$(dirname $0)/lib' "$out/share/bcc/tools/lib"
      done
  
      sed -i -e "s!lib=.*!lib=$out/bin!" $out/bin/{java,ruby,node,python}gc
  