2022-10-06 18:32:54 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchgit, autoreconfHook, dejagnu, elfutils }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ltrace";
|
2022-10-06 18:32:54 +00:00
|
|
|
version = "0.7.91";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-10-06 18:32:54 +00:00
|
|
|
url = "https://src.fedoraproject.org/repo/pkgs/ltrace/ltrace-0.7.91.tar.bz2/9db3bdee7cf3e11c87d8cc7673d4d25b/ltrace-0.7.91.tar.bz2";
|
|
|
|
sha256 = "sha256-HqellbKh2ZDHxslXl7SSIXtpjV1sodtgVwh8hgTC3Dc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook ]; # Some patches impact ./configure.
|
|
|
|
buildInputs = [ elfutils ];
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ dejagnu ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
# Import Fedora's (very) large patch series: bug fixes, architecture support,
|
|
|
|
# etc. RH/Fedora are currently working with upstream to merge all these
|
|
|
|
# patches for the next major branch.
|
2020-04-24 23:36:52 +00:00
|
|
|
prePatch = let
|
2022-10-06 18:32:54 +00:00
|
|
|
fedora = fetchgit {
|
|
|
|
url = "https://src.fedoraproject.org/rpms/ltrace.git";
|
|
|
|
rev = "00f430ccbebdbd13bdd4d7ee6303b091cf005542";
|
|
|
|
sha256 = "sha256-FBGEgmaslu7xrJtZ2WsYwu9Cw1ZQrWRV1+Eu9qLXO4s=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
in ''
|
2022-10-06 18:32:54 +00:00
|
|
|
# Order matters, read the patch list from the RPM spec. Our own patches
|
|
|
|
# are applied on top of the Fedora baseline.
|
|
|
|
fedorapatches=""
|
|
|
|
for p in $(grep '^Patch[0-9]\+:' ${fedora}/ltrace.spec | awk '{ print $2 }'); do
|
|
|
|
fedorapatches="$fedorapatches ${fedora}/$p"
|
|
|
|
done
|
|
|
|
patches="$fedorapatches $patches"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
# Cherry-pick extra patches for recent glibc support in the test suite.
|
|
|
|
patches = [
|
|
|
|
# https://gitlab.com/cespedes/ltrace/-/merge_requests/14
|
|
|
|
./testsuite-newfstatat.patch
|
|
|
|
# https://gitlab.com/cespedes/ltrace/-/merge_requests/15
|
|
|
|
./sysdeps-x86.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
# Hardening options interfere with some of the low-level expectations in
|
|
|
|
# the test suite (e.g. printf ends up redirected to __printf_chk).
|
|
|
|
NIX_HARDENING_ENABLE="" \
|
|
|
|
# Disable test that requires ptrace-ing a non-child process, this might be
|
|
|
|
# forbidden by YAMA ptrace policy on the build host.
|
|
|
|
RUNTESTFLAGS="--host=${stdenv.hostPlatform.config} \
|
|
|
|
--target=${stdenv.targetPlatform.config} \
|
|
|
|
--ignore attach-process.exp" \
|
|
|
|
make check
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Library call tracer";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "ltrace";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.ltrace.org/";
|
2022-10-06 18:32:54 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl2Plus;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|