Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions pkgs/by-name/ba/babeltrace/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
];
};
})
101 changes: 101 additions & 0 deletions pkgs/by-name/ba/babeltrace2/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
autoreconfHook,
pkg-config,
glib,
elfutils,
bison,
flex,
asciidoc,
xmlto,
docbook_xml_dtd_45,
docbook_xsl,
enablePython ? false,
python ? null,
pythonPackages ? null,
swig,
ensureNewerSourcesForZipFilesHook,
}:

stdenv.mkDerivation rec {
pname = "babeltrace2";
version = "2.0.6";

src = fetchFromGitHub {
owner = "efficios";
repo = "babeltrace";
rev = "v${version}";
hash = "sha256-L4YTqPxvWynUBnmAQnlJ2RNbEv9MhBxQOsqbWix8ZwU=";
};

patches = [
# Patches needed for Python 3.12
(fetchpatch {
# python: Use standalone 'sysconfig' module
url = "https://github.com/efficios/babeltrace/commit/452480eb6820df9973d50431a479ca547815ae08.patch";
hash = "sha256-YgUKHJzdliNUsTY29E0xxcUjqVWn4EvxyTs0B+O+jrI=";
})
(fetchpatch {
# python: replace distutils with setuptools
url = "https://github.com/efficios/babeltrace/commit/6ec97181a525a3cd64cedbcd0df905ed9e84ba03.patch";
hash = "sha256-1hlEkPcRUpf2+iEXqHXcCDOaLTg+eaVcahqZlA8m5QY=";
})
(fetchpatch {
# fix: python: monkey patch the proper sysconfig implementation
url = "https://github.com/efficios/babeltrace/commit/927263e4ea62877af7240cfdb1514ae949dbfc2e.patch";
hash = "sha256-HNRQ7uw26FUKCQ/my6//OL2xsHdOGlQUq5zIKtg9OGw=";
})
];

outputs = [
"out"
"man"
"dev"
];

nativeBuildInputs =
[
autoreconfHook
pkg-config
glib
bison
flex
asciidoc
xmlto
docbook_xml_dtd_45
docbook_xsl
]
++ lib.optionals enablePython [
swig
pythonPackages.setuptools
ensureNewerSourcesForZipFilesHook
];

buildInputs = [
glib
elfutils
] ++ lib.optional enablePython python;

configureFlags = [
(lib.enableFeature enablePython "python-bindings")
(lib.enableFeature enablePython "python-plugins")
(lib.enableFeature (stdenv.hostPlatform == stdenv.buildPlatform) "debug-info")
];

# For cross-compilation of Python bindings
makeFlags = [ "CFLAGS=-Wno-error=stringop-truncation -Wno-error=null-dereference" ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, is upstream aware that they need these loosening CFLAGS to make it work? It'd be nice to put a link if they do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any upstream commit addressing that. I'll let them know later, I'm in hurry right know. I just put there a comment that its needed when cross-compiling Python bindings.


enableParallelBuilding = true;

meta = {
description = "Babeltrace /ˈbæbəltreɪs/ is an open-source trace manipulation toolkit";
homepage = "https://babeltrace.org";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ wentasah ];
mainProgram = "babeltrace2";
platforms = lib.platforms.all;
};
}
32 changes: 0 additions & 32 deletions pkgs/development/tools/misc/babeltrace/default.nix

This file was deleted.

2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18033,8 +18033,6 @@ with pkgs;

b4 = callPackage ../development/tools/b4 { };

babeltrace = callPackage ../development/tools/misc/babeltrace { };

bam = callPackage ../development/tools/build-managers/bam { };

bandit = with python3Packages; toPythonApplication bandit;
Expand Down
11 changes: 11 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,17 @@ self: super: with self; {

babelgladeextractor = callPackage ../development/python-modules/babelgladeextractor { };

babeltrace = toPythonModule (pkgs.babeltrace.override {
pythonPackages = self;
enablePython = true;
});

babeltrace2 = toPythonModule (pkgs.babeltrace2.override {
inherit (self) python;
pythonPackages = self;
enablePython = true;
});

bambi = callPackage ../development/python-modules/bambi { };

pad4pi = callPackage ../development/python-modules/pad4pi { };
Expand Down