about summary refs log tree commit diff
path: root/pkgs/by-name/ba/babeltrace/package.nix
blob: 2d995df59c91d6d8d0f4146d78f0527e52658efa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
  lib,
  stdenv,
  fetchurl,
  gitUpdater,
  autoreconfHook,
  pkg-config,
  glib,
  libuuid,
  popt,
  elfutils,
  enablePython ? false,
  pythonPackages ? null,
  swig2,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "babeltrace";
  version = "1.5.11";

  src = fetchurl {
    url = "https://www.efficios.com/files/babeltrace/${finalAttrs.pname}-${finalAttrs.version}.tar.bz2";
    sha256 = "Z7Q6qu9clR+nrxpVfPcgGhH+iYdrfCK6CgPLwxbbWpw=";
  };

  nativeBuildInputs =
    [
      # The pre-generated ./configure script uses an old autoconf version which
      # breaks cross-compilation (replaces references to malloc with rpl_malloc).
      # Re-generate with nixpkgs's autoconf. This requires glib to be present in
      # nativeBuildInputs for its m4 macros to be present.
      autoreconfHook
      glib
      pkg-config
    ]
    ++ lib.optionals enablePython [
      swig2
      pythonPackages.setuptools
    ];
  buildInputs = [
    glib
    libuuid
    popt
    elfutils
  ];

  configureFlags =
    [
      # --enable-debug-info (default) requires the configure script to run host
      # executables to determine the elfutils library version, which cannot be done
      # while cross compiling.
      (lib.enableFeature (stdenv.hostPlatform == stdenv.buildPlatform) "debug-info")
    ]
    ++ lib.optionals enablePython [
      # Using (lib.enableFeature enablePython "python-bindings") makes the
      # configure script look for python dependencies even when
      # enablePython==false. Adding the configure flag conditionally seems to
      # solve this.
      "--enable-python-bindings"
    ];
  #

  passthru.updateScript = gitUpdater {
    url = "https://git.efficios.com/babeltrace.git";
    rev-prefix = "v";
    # Versions 2.x are packaged independently as babeltrace2
    ignoredVersions = "^[^1]";
  };

  meta = {
    description = "Command-line tool and library to read and convert LTTng tracefiles";
    homepage = "https://www.efficios.com/babeltrace";
    license = lib.licenses.mit;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [
      bjornfor
      wentasah
    ];
  };
})