2024-07-27 06:49:29 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, pandoc
|
|
|
|
, capstone
|
|
|
|
, elfutils
|
|
|
|
, libtraceevent
|
|
|
|
, ncurses
|
|
|
|
, withLuaJIT ? false
|
|
|
|
, luajit
|
|
|
|
, withPython ? false
|
|
|
|
, python3
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "uftrace";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.16";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "namhyung";
|
|
|
|
repo = "uftrace";
|
|
|
|
rev = "v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
sha256 = "sha256-JuBwyE6JH3CpJH863LbnWELUIIEKVaAcz8h8beeABGQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
nativeBuildInputs = [ pkg-config pandoc ];
|
|
|
|
buildInputs =
|
|
|
|
[ capstone elfutils libtraceevent ncurses ]
|
|
|
|
++ lib.optional withLuaJIT luajit
|
|
|
|
++ lib.optional withPython python3;
|
|
|
|
|
|
|
|
# libmcount.so dlopens python and luajit, make sure they're in the RUNPATH
|
|
|
|
preBuild =
|
|
|
|
let
|
|
|
|
libs = lib.optional withLuaJIT "luajit" ++ lib.optional withPython "python3-embed";
|
|
|
|
in
|
|
|
|
lib.optionalString (withLuaJIT || withPython) ''
|
|
|
|
makeFlagsArray+=(LDFLAGS_lib="$(pkg-config --libs ${lib.concatStringsSep " " libs})")
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postUnpack = ''
|
2024-07-27 06:49:29 +00:00
|
|
|
patchShebangs .
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Function (graph) tracer for user-space";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "uftrace";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/namhyung/uftrace";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.gpl2;
|
|
|
|
platforms = lib.platforms.linux;
|
2024-07-27 06:49:29 +00:00
|
|
|
maintainers = [ lib.maintainers.nthorne ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|