diff --git a/pkgs/by-name/ba/babeltrace/package.nix b/pkgs/by-name/ba/babeltrace/package.nix new file mode 100644 index 0000000000000..2d995df59c91d --- /dev/null +++ b/pkgs/by-name/ba/babeltrace/package.nix @@ -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 + ]; + }; +}) diff --git a/pkgs/by-name/ba/babeltrace2/package.nix b/pkgs/by-name/ba/babeltrace2/package.nix new file mode 100644 index 0000000000000..ec9f15e679f8d --- /dev/null +++ b/pkgs/by-name/ba/babeltrace2/package.nix @@ -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" ]; + + 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; + }; +} diff --git a/pkgs/development/tools/misc/babeltrace/default.nix b/pkgs/development/tools/misc/babeltrace/default.nix deleted file mode 100644 index 014d926eea3d7..0000000000000 --- a/pkgs/development/tools/misc/babeltrace/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ 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 ]; - }; - -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f06962f5fad69..99a4a74e5e270 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 928edd66a5f2f..25c356e37674a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -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 { };