1{
2 lib,
3 stdenv,
4 fetchurl,
5 perl,
6 libunwind,
7 buildPackages,
8 gitUpdater,
9 elfutils,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "strace";
14 version = "6.15";
15
16 src = fetchurl {
17 url = "https://strace.io/files/${version}/${pname}-${version}.tar.xz";
18 hash = "sha256-hVLfqwirwioPIEjJj9lUH9TXG2iCUHlSeA2rfHxRL1E=";
19 };
20
21 separateDebugInfo = true;
22
23 outputs = [
24 "out"
25 "man"
26 ];
27
28 depsBuildBuild = [ buildPackages.stdenv.cc ];
29 nativeBuildInputs = [ perl ];
30
31 enableParallelBuilding = true;
32
33 # libunwind for -k.
34 # On RISC-V platforms, LLVM's libunwind implementation is unsupported by strace.
35 # The build will silently fall back and -k will not work on RISC-V.
36 buildInputs = [
37 libunwind
38 ]
39 # -kk
40 ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform elfutils) elfutils;
41
42 configureFlags = [
43 "--enable-mpers=check"
44 ]
45 ++ lib.optional stdenv.cc.isClang "CFLAGS=-Wno-unused-function";
46
47 passthru.updateScript = gitUpdater {
48 # No nicer place to find latest release.
49 url = "https://github.com/strace/strace.git";
50 rev-prefix = "v";
51 };
52
53 meta = with lib; {
54 homepage = "https://strace.io/";
55 description = "System call tracer for Linux";
56 license = with licenses; [
57 lgpl21Plus
58 gpl2Plus
59 ]; # gpl2Plus is for the test suite
60 platforms = platforms.linux;
61 maintainers = with maintainers; [
62 globin
63 ma27
64 qyliss
65 ];
66 mainProgram = "strace";
67 };
68}