Unverified Commit b9206183 authored by Nikolay Korotkiy's avatar Nikolay Korotkiy
Browse files

rr: cleanup

parent 0702502d
Loading
Loading
Loading
Loading
+51 −20
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub
, bash, cmake, pkg-config, which, makeWrapper
, libpfm, zlib, python3, procps, gdb, capnproto
{
  lib,
  stdenv,
  fetchFromGitHub,
  bash,
  capnproto,
  cmake,
  gdb,
  libpfm,
  makeWrapper,
  pkg-config,
  procps,
  python3,
  which,
  zlib,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  version = "5.8.0";
  pname = "rr";

  src = fetchFromGitHub {
    owner = "mozilla";
    repo = "rr";
    rev = version;
    rev = finalAttrs.version;
    hash = "sha256-FudAAkWIe6gv4NYFoe9E0hlgTM70lymBE5Fw/vbehps=";
  };

  patches = [ ];

  postPatch = ''
    substituteInPlace src/Command.cc --replace '_BSD_SOURCE' '_DEFAULT_SOURCE'
    sed '7i#include <math.h>' -i src/Scheduler.cc
    sed '1i#include <ctime>' -i src/test-monitor/test-monitor.cc
    patchShebangs src
  '';

@@ -31,19 +39,34 @@ stdenv.mkDerivation rec {
  # collect2: error: ld returned 1 exit status
  #
  # See also https://github.com/NixOS/nixpkgs/pull/110846
  preConfigure = ''substituteInPlace CMakeLists.txt --replace "-flto" ""'';
  preConfigure = ''
    substituteInPlace CMakeLists.txt --replace "-flto" ""
  '';

  strictDeps = true;

  nativeBuildInputs = [ cmake pkg-config which makeWrapper capnproto python3.pythonOnBuildForHost ];
  nativeBuildInputs = [
    capnproto
    cmake
    makeWrapper
    pkg-config
    python3.pythonOnBuildForHost
    which
  ];

  buildInputs = [
    libpfm zlib python3 procps gdb capnproto bash
    bash
    capnproto
    gdb
    libpfm
    procps
    python3
    zlib
  ];

  cmakeFlags = [
    (lib.cmakeBool "disable32bit" true)
    (lib.cmakeBool "BUILD_TESTS" doCheck)
    (lib.cmakeBool "BUILD_TESTS" finalAttrs.doCheck)
  ];

  # we turn on additional warnings due to hardening
@@ -59,9 +82,7 @@ stdenv.mkDerivation rec {
  # needs GDB to replay programs at runtime
  preFixup = ''
    wrapProgram "$out/bin/rr" \
      --prefix PATH ":" "${lib.makeBinPath [
        gdb
      ]}";
      --prefix PATH ":" "${lib.makeBinPath [ gdb ]}";
  '';

  meta = {
@@ -74,8 +95,18 @@ stdenv.mkDerivation rec {
      time the same execution is replayed.
    '';

    license = with lib.licenses; [ mit bsd2 ];
    maintainers = with lib.maintainers; [ pierron thoughtpolice ];
    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
    license = with lib.licenses; [
      mit
      bsd2
    ];
    maintainers = with lib.maintainers; [
      pierron
      thoughtpolice
    ];
    platforms = [
      "aarch64-linux"
      "i686-linux"
      "x86_64-linux"
    ];
  };
}
})