Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 71 lines 2.2 kB view raw
1{ lib, stdenv, kernel, elfutils, python, perl, newt, slang, asciidoc, xmlto, makeWrapper 2, docbook_xsl, docbook_xml_dtd_45, libxslt, flex, bison, pkgconfig, libunwind, binutils 3, libiberty, libaudit, libbfd, openssl, systemtap, numactl 4, zlib, withGtk ? false, gtk2 ? null 5}: 6 7with lib; 8 9assert withGtk -> gtk2 != null; 10assert versionAtLeast kernel.version "3.12"; 11 12stdenv.mkDerivation { 13 name = "perf-linux-${kernel.version}"; 14 15 inherit (kernel) src; 16 17 preConfigure = '' 18 cd tools/perf 19 20 substituteInPlace Makefile \ 21 --replace /usr/include/elfutils $elfutils/include/elfutils 22 23 for x in util/build-id.c util/dso.c; do 24 substituteInPlace $x --replace /usr/lib/debug /run/current-system/sw/lib/debug 25 done 26 27 if [ -f bash_completion ]; then 28 sed -i 's,^have perf,_have perf,' bash_completion 29 fi 30 ''; 31 32 makeFlags = ["prefix=$(out)" "WERROR=0"] ++ kernel.makeFlags; 33 34 # perf refers both to newt and slang 35 nativeBuildInputs = [ 36 asciidoc xmlto docbook_xsl docbook_xml_dtd_45 libxslt 37 flex bison libiberty libaudit makeWrapper pkgconfig python perl 38 ]; 39 buildInputs = [ 40 elfutils newt slang libunwind libbfd zlib openssl systemtap.stapBuild numactl 41 ] ++ stdenv.lib.optional withGtk gtk2; 42 43 # Note: we don't add elfutils to buildInputs, since it provides a 44 # bad `ld' and other stuff. 45 NIX_CFLAGS_COMPILE = 46 [ "-Wno-error=cpp" 47 "-Wno-error=bool-compare" 48 "-Wno-error=deprecated-declarations" 49 "-DOBJDUMP_PATH=\"${binutils}/bin/objdump\"" 50 "-DTIPDIR=\"$(out)/share/doc/perf-tip\"" 51 ] 52 # gcc before 6 doesn't know these options 53 ++ stdenv.lib.optionals (hasPrefix "gcc-6" stdenv.cc.cc.name) [ 54 "-Wno-error=unused-const-variable" "-Wno-error=misleading-indentation" 55 ]; 56 57 separateDebugInfo = true; 58 installFlags = "install install-man ASCIIDOC8=1 prefix=$(out)"; 59 60 preFixup = '' 61 wrapProgram $out/bin/perf \ 62 --prefix PATH : "${binutils}/bin" 63 ''; 64 65 meta = { 66 homepage = https://perf.wiki.kernel.org/; 67 description = "Linux tools to profile with performance counters"; 68 maintainers = with stdenv.lib.maintainers; [viric]; 69 platforms = with stdenv.lib.platforms; linux; 70 }; 71}