Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babeltrace updates and Python modules #285681

Closed
wants to merge 7 commits into from
Closed
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
18 changes: 18 additions & 0 deletions pkgs/development/python-modules/babeltrace/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ toPythonModule
, python
, babeltrace
, swig2
}:

toPythonModule (babeltrace.overrideAttrs ({ nativeBuildInputs ? [ ], configureFlags ? [ ], ... }: {
nativeBuildInputs = nativeBuildInputs ++ [ swig2 ];

configureFlags = configureFlags ++ [ "--enable-python-bindings" ];

# Nix treats nativeBuildInputs specially for cross-compilation, but in this
# case, cross-compilation is accounted for explicitly. Using the variables
# ensures that the platform setup isn't messed with further. It also allows
# regular Python to be added in the future if it is ever needed.
PYTHON = "${python.pythonOnBuildForHost}/bin/python";
PYTHON_CONFIG = "${python.pythonOnBuildForHost}/bin/python-config";
}))
21 changes: 21 additions & 0 deletions pkgs/development/python-modules/babeltrace2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ toPythonModule
, python
, babeltrace2
, swig
}:

toPythonModule (babeltrace2.overrideAttrs ({ nativeBuildInputs ? [ ], configureFlags ? [ ], ... }: {
nativeBuildInputs = nativeBuildInputs ++ [ swig ];

configureFlags = configureFlags ++ [
"--enable-python-bindings"
"--enable-python-plugins"
];

# Nix treats nativeBuildInputs specially for cross-compilation, but in this
# case, cross-compilation is accounted for explicitly. Using the variables
# ensures that the platform setup isn't messed with further. It also allows
# regular Python to be added in the future if it is ever needed.
PYTHON = "${python.pythonOnBuildForHost}/bin/python";
PYTHON_CONFIG = "${python.pythonOnBuildForHost}/bin/python-config";
}))
43 changes: 43 additions & 0 deletions pkgs/development/tools/misc/babeltrace/common.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{ lib
, stdenv
, fetchzip
, autoreconfHook
, pkg-config
, glib
, elfutils

, version
, hash
}:

args: stdenv.mkDerivation (finalAttrs: args // {
inherit version;

src = fetchzip {
url = "https://www.efficios.com/files/babeltrace/${finalAttrs.pname}-${finalAttrs.version}.tar.bz2";
inherit hash;
};

# In 1.x, the pre-generated ./configure script uses an old autoconf version
# which breaks cross-compilation (replaces references to malloc with
# rpl_malloc).
# In 2.x, there is no pre-generated ./configure script.
# Re-generate with nixpkgs's autoconf. This requires glib to be present in
# nativeBuildInputs for its m4 macros to be present.
nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ autoreconfHook pkg-config glib ];

buildInputs = args.buildInputs or [ ] ++ [ glib elfutils ];

# --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.
configureFlags = args.configureFlags or [ ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-debug-info";

meta = with lib; {
description = "Command-line tool and library to read and convert LTTng tracefiles";
homepage = "https://www.efficios.com/babeltrace";
license = licenses.mit;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
})
34 changes: 4 additions & 30 deletions pkgs/development/tools/misc/babeltrace/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, glib, libuuid, popt, elfutils }:

stdenv.mkDerivation rec {
pname = "babeltrace";
version = "1.5.8";

src = fetchurl {
url = "https://www.efficios.com/files/babeltrace/${pname}-${version}.tar.bz2";
sha256 = "1hkg3phnamxfrhwzmiiirbhdgckzfkqwhajl0lmr1wfps7j47wcz";
};

# 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.
nativeBuildInputs = [ autoreconfHook glib pkg-config ];
buildInputs = [ glib libuuid popt elfutils ];

# --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.
configureFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-debug-info";

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

{
v1 = callPackage ./v1.nix { };
v2 = callPackage ./v2.nix { };
}
15 changes: 15 additions & 0 deletions pkgs/development/tools/misc/babeltrace/v1.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ callPackage
, libuuid
, popt
}:

callPackage ./common.nix
{
version = "1.5.11";
hash = "sha256-kreCyByYgWhEhRXulVithOweVhadat3ZmsbbbcUYKN8=";
}
{
pname = "babeltrace";

buildInputs = [ libuuid popt ];
}
15 changes: 15 additions & 0 deletions pkgs/development/tools/misc/babeltrace/v2.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ callPackage
}:

callPackage ./common.nix
{
version = "2.0.5";
hash = "sha256-8jY+zOI1Xqht9ybVDPelJgKrGTheIuzGaiaGV3dGJ+4=";
}
{
pname = "babeltrace2";

preBuild = ''
makeFlagsArray+=(CFLAGS="-Wno-error=stringop-truncation -Wno-error=null-dereference")
'';
}
6 changes: 5 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18447,7 +18447,11 @@ with pkgs;

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

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

babeltrace = babeltracePackages.v1;

babeltrace2 = babeltracePackages.v2;

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

Expand Down
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,10 @@ self: super: with self; {

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

babeltrace = callPackage ../development/python-modules/babeltrace { inherit (pkgs) babeltrace; };

babeltrace2 = callPackage ../development/python-modules/babeltrace2 { inherit (pkgs) babeltrace2; };

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

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