2023-04-29 16:46:19 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchzip
|
|
|
|
, pkg-config
|
|
|
|
, libbpf
|
|
|
|
, cmake
|
|
|
|
, elfutils
|
|
|
|
, zlib
|
|
|
|
, argp-standalone
|
|
|
|
, musl-obstack
|
|
|
|
, nixosTests
|
2024-07-31 10:19:44 +00:00
|
|
|
, fetchpatch
|
2023-04-29 16:46:19 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "pahole";
|
2024-07-31 10:19:44 +00:00
|
|
|
version = "1.27";
|
2023-03-15 16:39:30 +00:00
|
|
|
src = fetchzip {
|
2023-04-29 16:46:19 +00:00
|
|
|
url = "https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-${version}.tar.gz";
|
2024-07-31 10:19:44 +00:00
|
|
|
hash = "sha256-BwA17lc2yegmOzLfoIu8OmG/PVdc+4sOGzB8Jc4ZjGM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2022-02-10 20:34:41 +00:00
|
|
|
buildInputs = [ elfutils zlib libbpf ]
|
2022-10-30 15:09:59 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isMusl [
|
2022-02-10 20:34:41 +00:00
|
|
|
argp-standalone
|
|
|
|
musl-obstack
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-07-31 10:19:44 +00:00
|
|
|
patches = [
|
|
|
|
# https://github.com/acmel/dwarves/pull/51 / https://lkml.kernel.org/r/20240626032253.3406460-1-asmadeus@codewreck.org
|
|
|
|
./threading-reproducibility.patch
|
|
|
|
# https://github.com/acmel/dwarves/issues/53
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-clang-btf-generation-bug.patch";
|
|
|
|
url = "https://github.com/acmel/dwarves/commit/6a2b27c0f512619b0e7a769a18a0fb05bb3789a5.patch";
|
|
|
|
hash = "sha256-Le1BAew/a/QKkYNLgSQxEvZ9mEEglUw8URwz1kiheeE=";
|
|
|
|
})
|
2024-09-19 14:19:46 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-clang-btf-generation-bug-2.patch";
|
|
|
|
url = "https://github.com/acmel/dwarves/commit/94a01bde592c555b3eb526aeb4c2ad695c5660d8.patch";
|
|
|
|
hash = "sha256-SMIxLEBjBkprAqVNX1h7nXxAsgbwvCD/Bz7c1ekwg5w=";
|
|
|
|
})
|
2024-07-31 10:19:44 +00:00
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Put libraries in "lib" subdirectory, not top level of $out
|
2021-12-06 16:07:01 +00:00
|
|
|
cmakeFlags = [ "-D__LIB=lib" "-DLIBBPF_EMBEDDED=OFF" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) bpf;
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://git.kernel.org/pub/scm/devel/pahole/pahole.git/";
|
2023-02-02 18:25:31 +00:00
|
|
|
description = "Shows, manipulates, and pretty-prints debugging information in DWARF, CTF, and BTF formats";
|
2021-04-05 15:23:46 +00:00
|
|
|
license = licenses.gpl2Only;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
platforms = platforms.linux;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ bosu martinetd ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|