about summary refs log tree commit diff
path: root/pkgs/by-name/pa
diff options
context:
space:
mode:
authorMarcus Ramberg2024-05-14 07:02:06 +0200
committerGitHub2024-05-14 07:02:06 +0200
commitc5e1cf1c936259e31c91d68624c196e40d173046 (patch)
tree5bdb2dce734ef55f2b7dceedeb44c646b72983a5 /pkgs/by-name/pa
parent605cf9d8b00e662ea1e897b8d7cc7aa4003e0b5e (diff)
parentdbe53bea959588cf51e92b0ca3df59ae904437a7 (diff)
Merge pull request #310571 from martinetd/by-name
{rmfakecloud, libbpf, pahole, bcc, bpftrace}: migrate to by-name
Diffstat (limited to 'pkgs/by-name/pa')
-rw-r--r--pkgs/by-name/pa/pahole/package.nix46
-rw-r--r--pkgs/by-name/pa/pahole/threading-reproducibility.patch18
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