at 18.03-beta 64 lines 2.0 kB view raw
1{ stdenv, fetchFromGitHub, fetchpatch, makeWrapper, cmake, llvmPackages, kernel 2, flex, bison, elfutils, python, pythonPackages, luajit, netperf, iperf, libelf 3, systemtap 4}: 5 6stdenv.mkDerivation rec { 7 version = "0.5.0"; 8 name = "bcc-${version}"; 9 10 src = fetchFromGitHub { 11 owner = "iovisor"; 12 repo = "bcc"; 13 rev = "v${version}"; 14 sha256 = "0bb3244xll5sqx0lvrchg71qy2zg0yj6r5h4v5fvrg1fjhaldys9"; 15 }; 16 17 buildInputs = [ 18 llvmPackages.llvm llvmPackages.clang-unwrapped kernel 19 elfutils python pythonPackages.netaddr luajit netperf iperf 20 systemtap.stapBuild 21 ]; 22 23 patches = [ 24 # fix build with llvm > 5.0.0 && < 6.0.0 25 (fetchpatch { 26 url = "https://github.com/iovisor/bcc/commit/bd7fa55bb39b8978dafd0b299e35616061e0a368.patch"; 27 sha256 = "1sgxhsq174iihyk1x08py73q8fh78d7y3c90k5nh8vcw2pf1xbnf"; 28 }) 29 ]; 30 31 nativeBuildInputs = [ makeWrapper cmake flex bison ] 32 # libelf is incompatible with elfutils-libelf 33 ++ stdenv.lib.filter (x: x != libelf) kernel.moduleBuildDependencies; 34 35 cmakeFlags = 36 [ "-DBCC_KERNEL_MODULES_DIR=${kernel.dev}/lib/modules" 37 "-DREVISION=${version}" 38 "-DENABLE_USDT=ON" 39 "-DENABLE_CPP_API=ON" 40 ]; 41 42 postInstall = '' 43 mkdir -p $out/bin $out/share 44 rm -r $out/share/bcc/tools/old 45 mv $out/share/bcc/tools/doc $out/share 46 mv $out/share/bcc/man $out/share/ 47 48 find $out/share/bcc/tools -type f -executable -print0 | \ 49 while IFS= read -r -d ''$'\0' f; do 50 pythonLibs="$out/lib/python2.7/site-packages:${pythonPackages.netaddr}/lib/${python.libPrefix}/site-packages" 51 rm -f $out/bin/$(basename $f) 52 makeWrapper $f $out/bin/$(basename $f) \ 53 --prefix LD_LIBRARY_PATH : $out/lib \ 54 --prefix PYTHONPATH : "$pythonLibs" 55 done 56 ''; 57 58 meta = with stdenv.lib; { 59 description = "Dynamic Tracing Tools for Linux"; 60 homepage = https://iovisor.github.io/bcc/; 61 license = licenses.asl20; 62 maintainers = with maintainers; [ ragge mic92 ]; 63 }; 64}