bcc: modernize (#427281)

authored by Aleksana and committed by GitHub 35bc1c42 7f42228e

+31 -50
-11
pkgs/by-name/bc/bcc/libbcc-path.patch
··· 1 - --- source.org/src/python/bcc/libbcc.py 2018-05-13 08:35:06.850522883 +0100 2 - +++ source/src/python/bcc/libbcc.py 2018-05-13 08:36:24.602733151 +0100 3 - @@ -14,7 +14,7 @@ 4 - 5 - import ctypes as ct 6 - 7 - -lib = ct.CDLL("libbcc.so.0", use_errno=True) 8 - +lib = ct.CDLL("@out@/lib/libbcc.so.0", use_errno=True) 9 - 10 - # keep in sync with bpf_common.h 11 - lib.bpf_module_create_b.restype = ct.c_void_p
···
+31 -39
pkgs/by-name/bc/bcc/package.nix
··· 16 nixosTests, 17 python3Packages, 18 readline, 19 - stdenv, 20 zip, 21 }: 22 23 python3Packages.buildPythonApplication rec { 24 pname = "bcc"; 25 version = "0.35.0"; 26 - 27 - disabled = !stdenv.hostPlatform.isLinux; 28 29 src = fetchFromGitHub { 30 owner = "iovisor"; ··· 32 tag = "v${version}"; 33 hash = "sha256-eP/VEq7cPALi2oDKAZFQGQ3NExdmcBKyi6ddRZiYmbI="; 34 }; 35 - format = "other"; 36 - 37 - buildInputs = with llvmPackages; [ 38 - llvm 39 - llvm.dev 40 - libclang 41 - elfutils 42 - luajit 43 - netperf 44 - iperf 45 - flex 46 - bash 47 - libbpf 48 - ]; 49 50 patches = [ 51 # This is needed until we fix ··· 54 # Quick & dirty fix for bashreadline 55 # https://github.com/NixOS/nixpkgs/issues/328743 56 ./bashreadline.py-remove-dependency-on-elftools.patch 57 ]; 58 59 - propagatedBuildInputs = [ python3Packages.netaddr ]; 60 nativeBuildInputs = [ 61 bison 62 cmake 63 flex 64 - llvmPackages.llvm.dev 65 makeWrapper 66 - python3Packages.setuptools 67 zip 68 ]; 69 70 - cmakeFlags = [ 71 - "-DBCC_KERNEL_MODULES_DIR=/run/booted-system/kernel-modules/lib/modules" 72 - "-DREVISION=${version}" 73 - "-DENABLE_USDT=ON" 74 - "-DENABLE_CPP_API=ON" 75 - "-DCMAKE_USE_LIBBPF_PACKAGE=ON" 76 - "-DENABLE_LIBDEBUGINFOD=OFF" 77 ]; 78 79 - # to replace this executable path: 80 - # https://github.com/iovisor/bcc/blob/master/src/python/bcc/syscall.py#L384 81 - ausyscall = "${audit}/bin/ausyscall"; 82 83 postPatch = '' 84 - substituteAll ${./libbcc-path.patch} ./libbcc-path.patch 85 - patch -p1 < libbcc-path.patch 86 - 87 - substituteAll ${./absolute-ausyscall.patch} ./absolute-ausyscall.patch 88 - patch -p1 < absolute-ausyscall.patch 89 90 # https://github.com/iovisor/bcc/issues/3996 91 substituteInPlace src/cc/libbcc.pc.in \ ··· 95 --replace-fail '/bin/bash' '${readline}/lib/libreadline.so' 96 ''; 97 98 - preInstall = '' 99 - # required for setuptool during install 100 - export PYTHONPATH=$out/${python3Packages.python.sitePackages}:$PYTHONPATH 101 - ''; 102 postInstall = '' 103 mkdir -p $out/bin $out/share 104 rm -r $out/share/bcc/tools/old
··· 16 nixosTests, 17 python3Packages, 18 readline, 19 + replaceVars, 20 zip, 21 }: 22 23 python3Packages.buildPythonApplication rec { 24 pname = "bcc"; 25 version = "0.35.0"; 26 + pyproject = false; 27 28 src = fetchFromGitHub { 29 owner = "iovisor"; ··· 31 tag = "v${version}"; 32 hash = "sha256-eP/VEq7cPALi2oDKAZFQGQ3NExdmcBKyi6ddRZiYmbI="; 33 }; 34 35 patches = [ 36 # This is needed until we fix ··· 39 # Quick & dirty fix for bashreadline 40 # https://github.com/NixOS/nixpkgs/issues/328743 41 ./bashreadline.py-remove-dependency-on-elftools.patch 42 + 43 + (replaceVars ./absolute-ausyscall.patch { 44 + ausyscall = lib.getExe' audit "ausyscall"; 45 + }) 46 ]; 47 48 + build-system = [ python3Packages.setuptools ]; 49 + 50 + dependencies = [ python3Packages.netaddr ]; 51 + 52 nativeBuildInputs = [ 53 bison 54 cmake 55 flex 56 + llvmPackages.llvm 57 makeWrapper 58 zip 59 ]; 60 61 + buildInputs = [ 62 + llvmPackages.llvm 63 + llvmPackages.libclang 64 + elfutils 65 + luajit 66 + netperf 67 + iperf 68 + flex 69 + bash 70 + libbpf 71 ]; 72 73 + cmakeFlags = [ 74 + (lib.cmakeFeature "BCC_KERNEL_MODULES_DIR" "/run/booted-system/kernel-modules/lib/modules") 75 + (lib.cmakeFeature "REVISION" version) 76 + (lib.cmakeBool "ENABLE_USDT" true) 77 + (lib.cmakeBool "ENABLE_CPP_API" true) 78 + (lib.cmakeBool "CMAKE_USE_LIBBPF_PACKAGE" true) 79 + (lib.cmakeBool "ENABLE_LIBDEBUGINFOD" false) 80 + ]; 81 82 postPatch = '' 83 + substituteInPlace src/python/bcc/libbcc.py \ 84 + --replace-fail "libbcc.so.0" "$out/lib/libbcc.so.0" 85 86 # https://github.com/iovisor/bcc/issues/3996 87 substituteInPlace src/cc/libbcc.pc.in \ ··· 91 --replace-fail '/bin/bash' '${readline}/lib/libreadline.so' 92 ''; 93 94 postInstall = '' 95 mkdir -p $out/bin $out/share 96 rm -r $out/share/bcc/tools/old