2021-12-06 16:07:01 +00:00
|
|
|
{ glibc, perl }:
|
|
|
|
|
|
|
|
# Small wrapper which only exposes `mtrace(3)` from `glibc`. This can't be placed
|
|
|
|
# into `glibc` itself because it depends on Perl which would mean that the final
|
|
|
|
# `glibc` inside a stdenv bootstrap has a dependency `glibc -> perl -> bootstrap tools`,
|
|
|
|
# so this is now in its own package that isn't used for bootstrapping.
|
|
|
|
#
|
|
|
|
# `glibc` needs to be overridden here because it's still needed to `./configure` the source in order
|
|
|
|
# to have a build environment where we can call the needed make target.
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
glibc.overrideAttrs (oldAttrs: {
|
2021-12-06 16:07:01 +00:00
|
|
|
pname = "glibc-mtrace";
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
mkdir malloc
|
|
|
|
make -C ../glibc-${glibc.minorRelease}/malloc objdir=`pwd` `pwd`/malloc/mtrace;
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
mv malloc/mtrace $out/bin/
|
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
# Perl checked during configure
|
|
|
|
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ perl ];
|
|
|
|
# Perl shebang used for `mtrace`.
|
|
|
|
buildInputs = oldAttrs.buildInputs ++ [ perl ];
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
# Reset a few things declared by `pkgs.glibc`.
|
|
|
|
outputs = [ "out" ];
|
|
|
|
separateDebugInfo = false;
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
meta = oldAttrs.meta // {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Perl script used to interpret and provide human readable output of the trace log contained in the file mtracedata, whose contents were produced by mtrace(3)";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "mtrace";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
})
|