Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 74 lines 2.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchgit, 6 autoreconfHook, 7 dejagnu, 8 elfutils, 9}: 10 11stdenv.mkDerivation { 12 pname = "ltrace"; 13 version = "0.7.91"; 14 15 src = fetchurl { 16 url = "https://src.fedoraproject.org/repo/pkgs/ltrace/ltrace-0.7.91.tar.bz2/9db3bdee7cf3e11c87d8cc7673d4d25b/ltrace-0.7.91.tar.bz2"; 17 sha256 = "sha256-HqellbKh2ZDHxslXl7SSIXtpjV1sodtgVwh8hgTC3Dc="; 18 }; 19 20 nativeBuildInputs = [ autoreconfHook ]; # Some patches impact ./configure. 21 buildInputs = [ elfutils ]; 22 nativeCheckInputs = [ dejagnu ]; 23 24 # Import Fedora's (very) large patch series: bug fixes, architecture support, 25 # etc. RH/Fedora are currently working with upstream to merge all these 26 # patches for the next major branch. 27 prePatch = 28 let 29 fedora = fetchgit { 30 url = "https://src.fedoraproject.org/rpms/ltrace.git"; 31 rev = "00f430ccbebdbd13bdd4d7ee6303b091cf005542"; 32 sha256 = "sha256-FBGEgmaslu7xrJtZ2WsYwu9Cw1ZQrWRV1+Eu9qLXO4s="; 33 }; 34 in 35 '' 36 # Order matters, read the patch list from the RPM spec. Our own patches 37 # are applied on top of the Fedora baseline. 38 fedorapatches="" 39 for p in $(grep '^Patch[0-9]\+:' ${fedora}/ltrace.spec | awk '{ print $2 }'); do 40 fedorapatches="$fedorapatches ${fedora}/$p" 41 done 42 patches="$fedorapatches $patches" 43 ''; 44 45 # Cherry-pick extra patches for recent glibc support in the test suite. 46 patches = [ 47 # https://gitlab.com/cespedes/ltrace/-/merge_requests/14 48 ./testsuite-newfstatat.patch 49 # https://gitlab.com/cespedes/ltrace/-/merge_requests/15 50 ./sysdeps-x86.patch 51 ]; 52 53 doCheck = true; 54 checkPhase = '' 55 # Hardening options interfere with some of the low-level expectations in 56 # the test suite (e.g. printf ends up redirected to __printf_chk). 57 NIX_HARDENING_ENABLE="" \ 58 # Disable test that requires ptrace-ing a non-child process, this might be 59 # forbidden by YAMA ptrace policy on the build host. 60 RUNTESTFLAGS="--host=${stdenv.hostPlatform.config} \ 61 --target=${stdenv.targetPlatform.config} \ 62 --ignore attach-process.exp" \ 63 make check 64 ''; 65 66 meta = with lib; { 67 description = "Library call tracer"; 68 mainProgram = "ltrace"; 69 homepage = "https://www.ltrace.org/"; 70 platforms = platforms.linux; 71 license = licenses.gpl2Plus; 72 maintainers = [ ]; 73 }; 74}