diff options
author | Dominique Martinet | 2024-05-10 21:30:49 +0900 |
---|---|---|
committer | Dominique Martinet | 2024-05-12 19:05:44 +0900 |
commit | 6cc30987ce014d0b0902e0a52f6b1ee51d96ed7c (patch) | |
tree | d33abdefee312c4e8cfd8ce42386fd6c87c0fe3e /pkgs/by-name/pa | |
parent | 0b1f0db71793e91b5adaa5a5ad302138d7d7804e (diff) |
pahole: migrate to by-name
Diffstat (limited to 'pkgs/by-name/pa')
-rw-r--r-- | pkgs/by-name/pa/pahole/package.nix | 46 | ||||
-rw-r--r-- | pkgs/by-name/pa/pahole/threading-reproducibility.patch | 18 |
2 files changed, 64 insertions, 0 deletions
diff --git a/pkgs/by-name/pa/pahole/package.nix b/pkgs/by-name/pa/pahole/package.nix new file mode 100644 index 000000000000..275044ee40c0 --- /dev/null +++ b/pkgs/by-name/pa/pahole/package.nix @@ -0,0 +1,46 @@ +{ lib +, stdenv +, fetchzip +, pkg-config +, libbpf +, cmake +, elfutils +, zlib +, argp-standalone +, musl-obstack +, nixosTests +}: + +stdenv.mkDerivation rec { + pname = "pahole"; + version = "1.26"; + src = fetchzip { + url = "https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-${version}.tar.gz"; + hash = "sha256-Lf9Z4vHRFplMrUf4VhJ7EDPn+S4RaS1Emm0wyEcG2HU="; + }; + + 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 ]; + }; +} diff --git a/pkgs/by-name/pa/pahole/threading-reproducibility.patch b/pkgs/by-name/pa/pahole/threading-reproducibility.patch new file mode 100644 index 000000000000..15893ce2d035 --- /dev/null +++ b/pkgs/by-name/pa/pahole/threading-reproducibility.patch @@ -0,0 +1,18 @@ +diff --git a/pahole.c b/pahole.c +index 6fc4ed6..a4e306f 100644 +--- a/pahole.c ++++ b/pahole.c +@@ -1687,8 +1687,11 @@ static error_t pahole__options_parser(int key, char *arg, + class_name = arg; break; + case 'j': + #if _ELFUTILS_PREREQ(0, 178) +- conf_load.nr_jobs = arg ? atoi(arg) : +- sysconf(_SC_NPROCESSORS_ONLN) * 1.1; ++ // Force single thread if reproducibility is desirable. ++ if (!getenv("SOURCE_DATE_EPOCH")) { ++ conf_load.nr_jobs = arg ? atoi(arg) : ++ sysconf(_SC_NPROCESSORS_ONLN) * 1.1; ++ } + #else + fputs("pahole: Multithreading requires elfutils >= 0.178. Continuing with a single thread...\n", stderr); + #endif |