perf: extract from linuxPackages; deduplicate
There's no reason for us to be packaging old versions of perf. You don't need to match it with a kernel version. Let's build it from the latest kernel sources, so it'll get kept up to date.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
kddockwidgets,
|
||||
kdePackages,
|
||||
libelf,
|
||||
linuxPackages,
|
||||
perf,
|
||||
qt6,
|
||||
rustc-demangle,
|
||||
zstd,
|
||||
@@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
|
||||
qtWrapperArgs = [
|
||||
"--suffix PATH : ${
|
||||
lib.makeBinPath [
|
||||
linuxPackages.perf
|
||||
perf
|
||||
binutils
|
||||
]
|
||||
}"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
kernel,
|
||||
linux_latest,
|
||||
elfutils,
|
||||
python3,
|
||||
newt,
|
||||
@@ -21,9 +21,7 @@
|
||||
libiberty,
|
||||
audit,
|
||||
libbfd,
|
||||
libbfd_2_38,
|
||||
libopcodes,
|
||||
libopcodes_2_38,
|
||||
libpfm,
|
||||
libtraceevent,
|
||||
openssl,
|
||||
@@ -57,43 +55,28 @@ in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "perf-linux";
|
||||
inherit (kernel) version src;
|
||||
inherit (linux_latest) version src;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||
|
||||
patches =
|
||||
lib.optionals (lib.versionAtLeast kernel.version "5.10" && lib.versionOlder kernel.version "6.13")
|
||||
[
|
||||
# fix wrong path to dmesg
|
||||
./fix-dmesg-path.diff
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Linux scripts
|
||||
patchShebangs scripts
|
||||
patchShebangs tools/perf/check-headers.sh
|
||||
''
|
||||
+ lib.optionalString (lib.versionAtLeast kernel.version "6.3") ''
|
||||
# perf-specific scripts
|
||||
patchShebangs tools/perf/pmu-events
|
||||
''
|
||||
+ ''
|
||||
cd tools/perf
|
||||
|
||||
for x in util/build-id.c util/dso.c; do
|
||||
substituteInPlace $x --replace /usr/lib/debug /run/current-system/sw/lib/debug
|
||||
done
|
||||
|
||||
''
|
||||
+ lib.optionalString (lib.versionAtLeast kernel.version "5.8") ''
|
||||
substituteInPlace scripts/python/flamegraph.py \
|
||||
--replace "/usr/share/d3-flame-graph/d3-flamegraph-base.html" \
|
||||
"${d3-flame-graph-templates}/share/d3-flame-graph/d3-flamegraph-base.html"
|
||||
|
||||
''
|
||||
+ lib.optionalString (lib.versionAtLeast kernel.version "6.0") ''
|
||||
patchShebangs pmu-events/jevents.py
|
||||
'';
|
||||
|
||||
@@ -137,33 +120,15 @@ stdenv.mkDerivation {
|
||||
numactl
|
||||
python3
|
||||
babeltrace
|
||||
libbfd
|
||||
libopcodes
|
||||
libpfm
|
||||
python3.pkgs.setuptools
|
||||
]
|
||||
++ (
|
||||
if (lib.versionAtLeast kernel.version "5.19") then
|
||||
[
|
||||
libbfd
|
||||
libopcodes
|
||||
]
|
||||
else
|
||||
[
|
||||
libbfd_2_38
|
||||
libopcodes_2_38
|
||||
]
|
||||
)
|
||||
++ lib.optional (lib.meta.availableOn stdenv.hostPlatform systemtap-unwrapped) systemtap-unwrapped
|
||||
++ lib.optional withGtk gtk2
|
||||
++ lib.optional withZstd zstd
|
||||
++ lib.optional withLibcap libcap
|
||||
++ lib.optional (lib.versionAtLeast kernel.version "5.8") libpfm
|
||||
++ lib.optional (lib.versionAtLeast kernel.version "6.0") python3.pkgs.setuptools
|
||||
# Python 3.12 no longer includes distutils, not needed for 6.0 and newer.
|
||||
++
|
||||
lib.optional
|
||||
(!(lib.versionAtLeast kernel.version "6.0") && lib.versionAtLeast python3.version "3.12")
|
||||
[
|
||||
python3.pkgs.distutils
|
||||
python3.pkgs.packaging
|
||||
];
|
||||
++ lib.optional withLibcap libcap;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-Wno-error=cpp"
|
||||
@@ -206,6 +171,5 @@ stdenv.mkDerivation {
|
||||
mainProgram = "perf";
|
||||
maintainers = with maintainers; [ tobim ];
|
||||
platforms = platforms.linux;
|
||||
broken = kernel.kernelOlder "5";
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/tools/perf/util/evsel.c 2023-10-20 15:50:53.011023294 +0200
|
||||
+++ b/tools/perf/util/evsel.c 2023-10-20 15:51:03.205997633 +0200
|
||||
@@ -3076,7 +3076,7 @@
|
||||
|
||||
return scnprintf(msg, size,
|
||||
"The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n"
|
||||
- "/bin/dmesg | grep -i perf may provide additional information.\n",
|
||||
+ "\"dmesg | grep -i perf\" may provide additional information.\n",
|
||||
err, str_error_r(err, sbuf, sizeof(sbuf)), evsel__name(evsel));
|
||||
}
|
||||
|
||||
@@ -5683,10 +5683,6 @@ with pkgs;
|
||||
);
|
||||
buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };
|
||||
|
||||
cargo-flamegraph = callPackage ../by-name/ca/cargo-flamegraph/package.nix {
|
||||
inherit (linuxPackages) perf;
|
||||
};
|
||||
|
||||
defaultCrateOverrides = callPackage ../build-support/rust/default-crate-overrides.nix { };
|
||||
|
||||
inherit (callPackages ../development/tools/rust/cargo-pgrx { })
|
||||
@@ -7126,7 +7122,6 @@ with pkgs;
|
||||
pycritty = with python3Packages; toPythonApplication pycritty;
|
||||
|
||||
qtcreator = qt6Packages.callPackage ../development/tools/qtcreator {
|
||||
inherit (linuxPackages) perf;
|
||||
llvmPackages = llvmPackages_21;
|
||||
stdenv = llvmPackages_21.stdenv;
|
||||
};
|
||||
|
||||
@@ -584,8 +584,6 @@ in
|
||||
|
||||
netatop = callPackage ../os-specific/linux/netatop { };
|
||||
|
||||
perf = callPackage ../os-specific/linux/kernel/perf { };
|
||||
|
||||
prl-tools = callPackage ../os-specific/linux/prl-tools { };
|
||||
|
||||
isgx = callPackage ../os-specific/linux/isgx { };
|
||||
@@ -714,6 +712,7 @@ in
|
||||
xmm7360-pci = throw "Support for the XMM7360 WWAN card was added to the iosm kmod in mainline kernel version 5.18";
|
||||
amdgpu-pro = throw "amdgpu-pro was removed due to lack of maintenance"; # Added 2024-06-16
|
||||
kvdo = throw "kvdo was removed, because it was added to mainline in kernel version 6.9"; # Added 2024-07-08
|
||||
perf = lib.warnOnInstantiate "linuxPackages.perf is now perf" pkgs.perf; # Added 2025-08-28
|
||||
system76-power = lib.warnOnInstantiate "kernelPackages.system76-power is now pkgs.system76-power" pkgs.system76-power; # Added 2024-10-16
|
||||
system76-scheduler = lib.warnOnInstantiate "kernelPackages.system76-scheduler is now pkgs.system76-scheduler" pkgs.system76-scheduler; # Added 2024-10-16
|
||||
tuxedo-keyboard = self.tuxedo-drivers; # Added 2024-09-28
|
||||
|
||||
Reference in New Issue
Block a user