Files
nixpkgs/pkgs/os-specific/linux/kernel/perf.nix
T

64 lines
2.2 KiB
Nix
Raw Normal View History

{ lib, stdenv, kernel, elfutils, python, perl, newt, slang, asciidoc, xmlto
2015-03-11 18:14:57 +01:00
, docbook_xsl, docbook_xml_dtd_45, libxslt, flex, bison, pkgconfig, libunwind, binutils
2016-10-05 17:59:44 -07:00
, libiberty, libaudit
2016-09-13 20:42:55 +03:00
, zlib, withGtk ? false, gtk2 ? null }:
with lib;
2016-09-13 20:42:55 +03:00
assert withGtk -> gtk2 != null;
assert versionAtLeast kernel.version "3.12";
2012-01-05 21:24:51 +00:00
stdenv.mkDerivation {
name = "perf-linux-${kernel.version}";
2012-01-05 21:24:51 +00:00
2017-06-12 13:19:42 +02:00
inherit (kernel) src;
patches = kernel.patches ++ [ ./perf-binutils-path.patch ];
2012-01-05 21:24:51 +00:00
preConfigure = ''
cd tools/perf
sed -i s,/usr/include/elfutils,$elfutils/include/elfutils, Makefile
2014-02-07 22:53:55 +01:00
${optionalString (versionOlder kernel.version "3.13") "patch -p1 < ${./perf.diff}"}
2013-07-09 20:53:45 +02:00
[ -f bash_completion ] && sed -i 's,^have perf,_have perf,' bash_completion
export makeFlags="DESTDIR=$out $makeFlags"
2012-01-05 21:24:51 +00:00
'';
# perf refers both to newt and slang
2015-03-11 18:14:57 +01:00
# binutils is required for libbfd.
nativeBuildInputs = [ asciidoc xmlto docbook_xsl docbook_xml_dtd_45 libxslt
2016-10-05 17:59:44 -07:00
flex bison libiberty libaudit ];
buildInputs = [ elfutils python perl newt slang pkgconfig libunwind binutils zlib ] ++
2016-09-13 20:42:55 +03:00
stdenv.lib.optional withGtk gtk2;
2012-01-06 17:45:53 +00:00
# Note: we don't add elfutils to buildInputs, since it provides a
# bad `ld' and other stuff.
2017-06-12 13:19:42 +02:00
NIX_CFLAGS_COMPILE =
[ "-Wno-error=cpp"
"-Wno-error=bool-compare"
"-Wno-error=deprecated-declarations"
"-DOBJDUMP_PATH=\"${binutils}/bin/objdump\""
]
# gcc before 6 doesn't know these options
++ stdenv.lib.optionals (hasPrefix "gcc-6" stdenv.cc.cc.name) [
"-Wno-error=unused-const-variable" "-Wno-error=misleading-indentation"
];
2012-01-06 17:45:53 +00:00
installFlags = "install install-man ASCIIDOC8=1";
crossAttrs = {
/* I don't want cross-python or cross-perl -
I don't know if cross-python even works */
propagatedBuildInputs = [ elfutils.crossDrv newt.crossDrv ];
makeFlags = "CROSS_COMPILE=${stdenv.cross.config}-";
elfutils = elfutils.crossDrv;
inherit (kernel.crossDrv) src patches;
};
2012-01-05 21:24:51 +00:00
meta = {
homepage = https://perf.wiki.kernel.org/;
description = "Linux tools to profile with performance counters";
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
}