mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-16 18:03:22 +00:00
bpftrace: move from linux kernel packages to normal package
bpftrace doesn't actually need to be a kernel package anymore. It used to require path to kernel sources, but we build our kernels with IKHEADER and BTF so the currently running configuration can always be found automatically without any patch
This commit is contained in:
parent
efe6967e93
commit
eb774dd039
|
@ -1,6 +1,6 @@
|
|||
{ lib, stdenv, fetchFromGitHub
|
||||
, cmake, pkg-config, flex, bison
|
||||
, llvmPackages, kernel, elfutils
|
||||
, llvmPackages, elfutils
|
||||
, libelf, libbfd, libbpf, libopcodes, bcc
|
||||
}:
|
||||
|
||||
|
@ -17,22 +17,11 @@ stdenv.mkDerivation rec {
|
|||
|
||||
buildInputs = with llvmPackages;
|
||||
[ llvm libclang
|
||||
kernel elfutils libelf bcc
|
||||
elfutils libelf bcc
|
||||
libbpf libbfd libopcodes
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake pkg-config flex bison llvmPackages.llvm.dev ]
|
||||
# libelf is incompatible with elfutils-libelf
|
||||
++ lib.filter (x: x != libelf) kernel.moduleBuildDependencies;
|
||||
|
||||
# patch the source, *then* substitute on @NIX_KERNEL_SRC@ in the result. we could
|
||||
# also in theory make this an environment variable around bpftrace, but this works
|
||||
# nicely without wrappers.
|
||||
patchPhase = ''
|
||||
patch -p1 < ${./fix-kernel-include-dir.patch}
|
||||
substituteInPlace ./src/utils.cpp \
|
||||
--subst-var-by NIX_KERNEL_SRC '${kernel.dev}/lib/modules/${kernel.modDirVersion}'
|
||||
'';
|
||||
nativeBuildInputs = [ cmake pkg-config flex bison llvmPackages.llvm.dev ];
|
||||
|
||||
# tests aren't built, due to gtest shenanigans. see:
|
||||
#
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
commit b6172952c0150d84912fa6f09bab782dd0549f1e
|
||||
Author: Austin Seipp <aseipp@pobox.com>
|
||||
Date: Fri May 3 00:47:12 2019 -0500
|
||||
|
||||
src: special case nix build directories for clang
|
||||
|
||||
Signed-off-by: Austin Seipp <aseipp@pobox.com>
|
||||
|
||||
diff --git a/src/clang_parser.cpp b/src/clang_parser.cpp
|
||||
index b1db8ff..0cfb01f 100644
|
||||
--- a/src/utils.cpp
|
||||
+++ b/src/utils.cpp
|
||||
@@ -140,6 +140,9 @@ static bool is_dir(const std::string& path)
|
||||
// Both ksrc and kobj are guaranteed to be != "", if at least some trace of kernel sources was found.
|
||||
std::tuple<std::string, std::string> get_kernel_dirs(const struct utsname& utsname)
|
||||
{
|
||||
+ // NB (aseipp): special case the kernel directory for nix
|
||||
+ return { "@NIX_KERNEL_SRC@/source", "@NIX_KERNEL_SRC@/build" };
|
||||
+
|
||||
#ifdef KERNEL_HEADERS_DIR
|
||||
return {KERNEL_HEADERS_DIR, KERNEL_HEADERS_DIR};
|
||||
#endif
|
|
@ -14153,6 +14153,8 @@ with pkgs;
|
|||
python = pkgs.python3;
|
||||
};
|
||||
|
||||
bpftrace = callPackage ../os-specific/linux/bpftrace { };
|
||||
|
||||
bpm-tools = callPackage ../tools/audio/bpm-tools { };
|
||||
|
||||
byacc = callPackage ../development/tools/parsing/byacc { };
|
||||
|
|
|
@ -250,7 +250,7 @@ in {
|
|||
inherit (kernel) kernelOlder kernelAtLeast;
|
||||
# Obsolete aliases (these packages do not depend on the kernel).
|
||||
inherit (pkgs) odp-dpdk pktgen; # added 2018-05
|
||||
inherit (pkgs) bcc; # added 2021-12
|
||||
inherit (pkgs) bcc bpftrace; # added 2021-12
|
||||
|
||||
acpi_call = callPackage ../os-specific/linux/acpi-call {};
|
||||
|
||||
|
@ -264,8 +264,6 @@ in {
|
|||
|
||||
batman_adv = callPackage ../os-specific/linux/batman-adv {};
|
||||
|
||||
bpftrace = callPackage ../os-specific/linux/bpftrace { };
|
||||
|
||||
bbswitch = callPackage ../os-specific/linux/bbswitch {};
|
||||
|
||||
chipsec = callPackage ../tools/security/chipsec {
|
||||
|
|
Loading…
Reference in a new issue