bcc: modernize (#427281)
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
--- source.org/src/python/bcc/libbcc.py 2018-05-13 08:35:06.850522883 +0100
|
||||
+++ source/src/python/bcc/libbcc.py 2018-05-13 08:36:24.602733151 +0100
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import ctypes as ct
|
||||
|
||||
-lib = ct.CDLL("libbcc.so.0", use_errno=True)
|
||||
+lib = ct.CDLL("@out@/lib/libbcc.so.0", use_errno=True)
|
||||
|
||||
# keep in sync with bpf_common.h
|
||||
lib.bpf_module_create_b.restype = ct.c_void_p
|
||||
@@ -16,15 +16,14 @@
|
||||
nixosTests,
|
||||
python3Packages,
|
||||
readline,
|
||||
stdenv,
|
||||
replaceVars,
|
||||
zip,
|
||||
}:
|
||||
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "bcc";
|
||||
version = "0.35.0";
|
||||
|
||||
disabled = !stdenv.hostPlatform.isLinux;
|
||||
pyproject = false;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "iovisor";
|
||||
@@ -32,12 +31,36 @@ python3Packages.buildPythonApplication rec {
|
||||
tag = "v${version}";
|
||||
hash = "sha256-eP/VEq7cPALi2oDKAZFQGQ3NExdmcBKyi6ddRZiYmbI=";
|
||||
};
|
||||
format = "other";
|
||||
|
||||
buildInputs = with llvmPackages; [
|
||||
llvm
|
||||
llvm.dev
|
||||
libclang
|
||||
patches = [
|
||||
# This is needed until we fix
|
||||
# https://github.com/NixOS/nixpkgs/issues/40427
|
||||
./fix-deadlock-detector-import.patch
|
||||
# Quick & dirty fix for bashreadline
|
||||
# https://github.com/NixOS/nixpkgs/issues/328743
|
||||
./bashreadline.py-remove-dependency-on-elftools.patch
|
||||
|
||||
(replaceVars ./absolute-ausyscall.patch {
|
||||
ausyscall = lib.getExe' audit "ausyscall";
|
||||
})
|
||||
];
|
||||
|
||||
build-system = [ python3Packages.setuptools ];
|
||||
|
||||
dependencies = [ python3Packages.netaddr ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bison
|
||||
cmake
|
||||
flex
|
||||
llvmPackages.llvm
|
||||
makeWrapper
|
||||
zip
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
llvmPackages.llvm
|
||||
llvmPackages.libclang
|
||||
elfutils
|
||||
luajit
|
||||
netperf
|
||||
@@ -47,45 +70,18 @@ python3Packages.buildPythonApplication rec {
|
||||
libbpf
|
||||
];
|
||||
|
||||
patches = [
|
||||
# This is needed until we fix
|
||||
# https://github.com/NixOS/nixpkgs/issues/40427
|
||||
./fix-deadlock-detector-import.patch
|
||||
# Quick & dirty fix for bashreadline
|
||||
# https://github.com/NixOS/nixpkgs/issues/328743
|
||||
./bashreadline.py-remove-dependency-on-elftools.patch
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [ python3Packages.netaddr ];
|
||||
nativeBuildInputs = [
|
||||
bison
|
||||
cmake
|
||||
flex
|
||||
llvmPackages.llvm.dev
|
||||
makeWrapper
|
||||
python3Packages.setuptools
|
||||
zip
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DBCC_KERNEL_MODULES_DIR=/run/booted-system/kernel-modules/lib/modules"
|
||||
"-DREVISION=${version}"
|
||||
"-DENABLE_USDT=ON"
|
||||
"-DENABLE_CPP_API=ON"
|
||||
"-DCMAKE_USE_LIBBPF_PACKAGE=ON"
|
||||
"-DENABLE_LIBDEBUGINFOD=OFF"
|
||||
(lib.cmakeFeature "BCC_KERNEL_MODULES_DIR" "/run/booted-system/kernel-modules/lib/modules")
|
||||
(lib.cmakeFeature "REVISION" version)
|
||||
(lib.cmakeBool "ENABLE_USDT" true)
|
||||
(lib.cmakeBool "ENABLE_CPP_API" true)
|
||||
(lib.cmakeBool "CMAKE_USE_LIBBPF_PACKAGE" true)
|
||||
(lib.cmakeBool "ENABLE_LIBDEBUGINFOD" false)
|
||||
];
|
||||
|
||||
# to replace this executable path:
|
||||
# https://github.com/iovisor/bcc/blob/master/src/python/bcc/syscall.py#L384
|
||||
ausyscall = "${audit}/bin/ausyscall";
|
||||
|
||||
postPatch = ''
|
||||
substituteAll ${./libbcc-path.patch} ./libbcc-path.patch
|
||||
patch -p1 < libbcc-path.patch
|
||||
|
||||
substituteAll ${./absolute-ausyscall.patch} ./absolute-ausyscall.patch
|
||||
patch -p1 < absolute-ausyscall.patch
|
||||
substituteInPlace src/python/bcc/libbcc.py \
|
||||
--replace-fail "libbcc.so.0" "$out/lib/libbcc.so.0"
|
||||
|
||||
# https://github.com/iovisor/bcc/issues/3996
|
||||
substituteInPlace src/cc/libbcc.pc.in \
|
||||
@@ -95,10 +91,6 @@ python3Packages.buildPythonApplication rec {
|
||||
--replace-fail '/bin/bash' '${readline}/lib/libreadline.so'
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
# required for setuptool during install
|
||||
export PYTHONPATH=$out/${python3Packages.python.sitePackages}:$PYTHONPATH
|
||||
'';
|
||||
postInstall = ''
|
||||
mkdir -p $out/bin $out/share
|
||||
rm -r $out/share/bcc/tools/old
|
||||
|
||||
Reference in New Issue
Block a user