nixpkgs/pkgs/development/tools/misc/pahole/default.nix
Pierre Bourdon e1daacf987
pahole: patch to force single-threaded mode if reproducibility is desired
pahole's processes DWARF -> BTF in a pseudo-random order if multi
threading is enabled (default in the Linux kernel). This can be fixed in dependent
derivation by making sure users don't ever pass "-j" or "-j N", but it
seems easier and safer to just detect whether reprodubility is desired
(by proxy: if SOURCE_DATE_EPOCH is set) and ignore the multi-threading
flag.
2023-05-14 06:36:04 +02:00

46 lines
1.1 KiB
Nix

{ lib
, stdenv
, fetchzip
, pkg-config
, libbpf
, cmake
, elfutils
, zlib
, argp-standalone
, musl-obstack
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "pahole";
version = "1.25";
src = fetchzip {
url = "https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-${version}.tar.gz";
hash = "sha256-s0YVT2UnMSO8jS/4XCt06wNPV4czHH6bmZRy/snO3jg=";
};
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ elfutils zlib libbpf ]
++ lib.optionals stdenv.hostPlatform.isMusl [
argp-standalone
musl-obstack
];
patches = [ ./threading-reproducibility.patch ];
# Put libraries in "lib" subdirectory, not top level of $out
cmakeFlags = [ "-D__LIB=lib" "-DLIBBPF_EMBEDDED=OFF" ];
passthru.tests = {
inherit (nixosTests) bpf;
};
meta = with lib; {
homepage = "https://git.kernel.org/pub/scm/devel/pahole/pahole.git/";
description = "Shows, manipulates, and pretty-prints debugging information in DWARF, CTF, and BTF formats";
license = licenses.gpl2Only;
platforms = platforms.linux;
maintainers = with maintainers; [ bosu martinetd ];
};
}