Merge pull request #328973 from sikmir/rr

rr: fix cross-compilation
This commit is contained in:
Artturin 2024-07-22 06:38:02 +03:00 committed by GitHub
commit 662fc2ad94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,26 +1,34 @@
{ lib, stdenv, fetchFromGitHub
, cmake, pkg-config, which, makeWrapper
, libpfm, zlib, python3Packages, 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 .
patchShebangs src
'';
# With LTO enabled, linking fails with the following message:
@ -31,14 +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" ""
'';
nativeBuildInputs = [ cmake pkg-config which makeWrapper ];
buildInputs = [
libpfm zlib python3Packages.python python3Packages.pexpect procps gdb capnproto
strictDeps = true;
nativeBuildInputs = [
capnproto
cmake
makeWrapper
pkg-config
python3.pythonOnBuildForHost
which
];
buildInputs = [
bash
capnproto
gdb
libpfm
procps
python3
zlib
];
cmakeFlags = [
"-Ddisable32bit=ON"
(lib.cmakeBool "disable32bit" true)
(lib.cmakeBool "BUILD_TESTS" finalAttrs.doCheck)
];
# we turn on additional warnings due to hardening
@ -54,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 = {
@ -69,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"
];
};
}
})