2023-08-04 22:07:22 +00:00
|
|
|
{ audit
|
|
|
|
, bash
|
|
|
|
, bison
|
|
|
|
, cmake
|
|
|
|
, elfutils
|
|
|
|
, fetchFromGitHub
|
|
|
|
, flex
|
|
|
|
, iperf
|
|
|
|
, lib
|
|
|
|
, libbpf
|
|
|
|
, llvmPackages
|
|
|
|
, luajit
|
|
|
|
, makeWrapper
|
|
|
|
, netperf
|
|
|
|
, nixosTests
|
|
|
|
, python3
|
|
|
|
, stdenv
|
|
|
|
, zip
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "bcc";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "0.30.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
disabled = !stdenv.isLinux;
|
|
|
|
|
2021-04-22 02:08:21 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "iovisor";
|
|
|
|
repo = "bcc";
|
|
|
|
rev = "v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-ngGLGfLv2prnjhgaRPf8ea3oyy4129zGodR0Yz1QtCw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
format = "other";
|
|
|
|
|
|
|
|
buildInputs = with llvmPackages; [
|
2021-12-06 16:07:01 +00:00
|
|
|
llvm llvm.dev libclang
|
2020-04-24 23:36:52 +00:00
|
|
|
elfutils luajit netperf iperf
|
2021-12-06 16:07:01 +00:00
|
|
|
flex bash libbpf
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# This is needed until we fix
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/40427
|
|
|
|
./fix-deadlock-detector-import.patch
|
|
|
|
];
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
propagatedBuildInputs = [ python3.pkgs.netaddr ];
|
|
|
|
nativeBuildInputs = [
|
|
|
|
bison
|
|
|
|
cmake
|
|
|
|
flex
|
|
|
|
llvmPackages.llvm.dev
|
|
|
|
makeWrapper
|
|
|
|
python3.pkgs.setuptools
|
|
|
|
zip
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-12-06 16:07:01 +00:00
|
|
|
"-DBCC_KERNEL_MODULES_DIR=/run/booted-system/kernel-modules/lib/modules"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DREVISION=${version}"
|
|
|
|
"-DENABLE_USDT=ON"
|
|
|
|
"-DENABLE_CPP_API=ON"
|
2021-04-22 02:08:21 +00:00
|
|
|
"-DCMAKE_USE_LIBBPF_PACKAGE=ON"
|
2023-04-29 16:46:19 +00:00
|
|
|
"-DENABLE_LIBDEBUGINFOD=OFF"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
# to replace this executable path:
|
|
|
|
# https://github.com/iovisor/bcc/blob/master/src/python/bcc/syscall.py#L384
|
|
|
|
ausyscall = "${audit}/bin/ausyscall";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteAll ${./libbcc-path.patch} ./libbcc-path.patch
|
|
|
|
patch -p1 < libbcc-path.patch
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
substituteAll ${./absolute-ausyscall.patch} ./absolute-ausyscall.patch
|
|
|
|
patch -p1 < absolute-ausyscall.patch
|
2022-09-30 11:47:45 +00:00
|
|
|
|
|
|
|
# https://github.com/iovisor/bcc/issues/3996
|
|
|
|
substituteInPlace src/cc/libbcc.pc.in \
|
|
|
|
--replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
preInstall = ''
|
|
|
|
# required for setuptool during install
|
|
|
|
export PYTHONPATH=$out/${python3.sitePackages}:$PYTHONPATH
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/bin $out/share
|
|
|
|
rm -r $out/share/bcc/tools/old
|
|
|
|
mv $out/share/bcc/tools/doc $out/share
|
|
|
|
mv $out/share/bcc/man $out/share/
|
|
|
|
|
|
|
|
find $out/share/bcc/tools -type f -executable -print0 | \
|
|
|
|
while IFS= read -r -d ''$'\0' f; do
|
|
|
|
bin=$out/bin/$(basename $f)
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapPythonProgramsIn "$out/share/bcc/tools" "$out $pythonPath"
|
|
|
|
'';
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
passthru.tests = {
|
|
|
|
bpf = nixosTests.bpf;
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Dynamic Tracing Tools for Linux";
|
|
|
|
homepage = "https://iovisor.github.io/bcc/";
|
|
|
|
license = licenses.asl20;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ ragge mic92 thoughtpolice martinetd ];
|
2024-06-05 15:53:02 +00:00
|
|
|
platforms = platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|