nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 146 lines 3.3 kB view raw
1{ 2 audit, 3 bash, 4 bison, 5 cmake, 6 elfutils, 7 fetchFromGitHub, 8 fetchpatch, 9 flex, 10 iperf, 11 lib, 12 libbpf, 13 llvmPackages, 14 luajit, 15 makeWrapper, 16 netperf, 17 nixosTests, 18 python3Packages, 19 readline, 20 replaceVars, 21 zip, 22}: 23 24python3Packages.buildPythonApplication rec { 25 pname = "bcc"; 26 version = "0.35.0"; 27 pyproject = false; 28 29 src = fetchFromGitHub { 30 owner = "iovisor"; 31 repo = "bcc"; 32 tag = "v${version}"; 33 hash = "sha256-eP/VEq7cPALi2oDKAZFQGQ3NExdmcBKyi6ddRZiYmbI="; 34 }; 35 36 patches = [ 37 # This is needed until we fix 38 # https://github.com/NixOS/nixpkgs/issues/40427 39 ./fix-deadlock-detector-import.patch 40 # Quick & dirty fix for bashreadline 41 # https://github.com/NixOS/nixpkgs/issues/328743 42 ./bashreadline.py-remove-dependency-on-elftools.patch 43 44 (replaceVars ./absolute-ausyscall.patch { 45 ausyscall = lib.getExe' audit "ausyscall"; 46 }) 47 48 (fetchpatch { 49 name = "clang-21.patch"; 50 url = "https://github.com/iovisor/bcc/commit/8c5c96ad3beeed2fa827017f451a952306826974.diff"; 51 hash = "sha256-VOzhdeZ3mRstLlMhxHwEgqCa6L39eRpbFJuKZqFnBws="; 52 }) 53 ]; 54 55 build-system = [ python3Packages.setuptools ]; 56 57 dependencies = [ python3Packages.netaddr ]; 58 59 nativeBuildInputs = [ 60 bison 61 cmake 62 flex 63 llvmPackages.llvm 64 makeWrapper 65 zip 66 ]; 67 68 buildInputs = [ 69 llvmPackages.llvm 70 llvmPackages.libclang 71 elfutils 72 luajit 73 netperf 74 iperf 75 flex 76 bash 77 libbpf 78 ]; 79 80 cmakeFlags = [ 81 (lib.cmakeFeature "BCC_KERNEL_MODULES_DIR" "/run/booted-system/kernel-modules/lib/modules") 82 (lib.cmakeFeature "REVISION" version) 83 (lib.cmakeBool "ENABLE_USDT" true) 84 (lib.cmakeBool "ENABLE_CPP_API" true) 85 (lib.cmakeBool "CMAKE_USE_LIBBPF_PACKAGE" true) 86 (lib.cmakeBool "ENABLE_LIBDEBUGINFOD" false) 87 ]; 88 89 postPatch = '' 90 substituteInPlace src/python/bcc/libbcc.py \ 91 --replace-fail "libbcc.so.0" "$out/lib/libbcc.so.0" 92 93 # https://github.com/iovisor/bcc/issues/3996 94 substituteInPlace src/cc/libbcc.pc.in \ 95 --replace-fail '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ 96 97 substituteInPlace tools/bashreadline.py \ 98 --replace-fail '/bin/bash' '${readline}/lib/libreadline.so' 99 ''; 100 101 postInstall = '' 102 mkdir -p $out/bin $out/share 103 rm -r $out/share/bcc/tools/old 104 mv $out/share/bcc/tools/doc $out/share 105 mv $out/share/bcc/man $out/share/ 106 107 find $out/share/bcc/tools -type f -executable -print0 | \ 108 while IFS= read -r -d ''$'\0' f; do 109 bin=$out/bin/$(basename $f) 110 if [ ! -e $bin ]; then 111 ln -s $f $bin 112 fi 113 substituteInPlace "$f" \ 114 --replace-quiet '$(dirname $0)/lib' "$out/share/bcc/tools/lib" 115 done 116 ''; 117 118 pythonImportsCheck = [ "bcc" ]; 119 120 postFixup = '' 121 wrapPythonProgramsIn "$out/share/bcc/tools" "$out ''${pythonPath[*]}" 122 ''; 123 124 outputs = [ 125 "out" 126 "man" 127 ]; 128 129 passthru.tests = { 130 bpf = nixosTests.bpf; 131 }; 132 133 meta = { 134 description = "Dynamic Tracing Tools for Linux"; 135 homepage = "https://iovisor.github.io/bcc/"; 136 license = lib.licenses.asl20; 137 maintainers = with lib.maintainers; [ 138 ragge 139 mic92 140 thoughtpolice 141 martinetd 142 ryan4yin 143 ]; 144 platforms = lib.platforms.linux; 145 }; 146}