add valgrind
Some checks failed
Hydra kubo Hydra build #53727 of nix-packages:riscv64-linux-master-pr276:kubo
Hydra emoji-volpeon-bunhd-flip Hydra build #53729 of nix-packages:riscv64-linux-master-pr276:emoji-volpeon-bunhd-flip
Hydra emoji-volpeon-raccoon Hydra build #53728 of nix-packages:riscv64-linux-master-pr276:emoji-volpeon-raccoon
Hydra mautrix-discord Hydra build #53730 of nix-packages:riscv64-linux-master-pr276:mautrix-discord
Hydra nasin-nanpa Hydra build #53733 of nix-packages:riscv64-linux-master-pr276:nasin-nanpa
Hydra mautrix-whatsapp Hydra build #53734 of nix-packages:riscv64-linux-master-pr276:mautrix-whatsapp
Hydra woodpecker-agent Hydra build #53731 of nix-packages:riscv64-linux-master-pr276:woodpecker-agent
Hydra woodpecker-cli Hydra build #53737 of nix-packages:riscv64-linux-master-pr276:woodpecker-cli
Hydra element-web Hydra build #53643 of nix-packages:riscv64-linux-master-pr276:element-web
Hydra python-instagram Hydra build #53848 of nix-packages:riscv64-linux-master-pr276:python-instagram
Hydra vf2Kernel Hydra build #53736 of nix-packages:riscv64-linux-master-pr276:vf2Kernel
Hydra woodpecker-frontend Hydra build #53744 of nix-packages:riscv64-linux-master-pr276:woodpecker-frontend
Hydra woodpecker-server Hydra build #53868 of nix-packages:riscv64-linux-master-pr276:woodpecker-server
Hydra emoji-volpeon-fox Hydra build #53741 of nix-packages:riscv64-linux-master-pr276:emoji-volpeon-fox
Hydra python-tulir-telethon Hydra build #53753 of nix-packages:riscv64-linux-master-pr276:python-tulir-telethon
Hydra pleroma-fe Hydra build #53748 of nix-packages:riscv64-linux-master-pr276:pleroma-fe
Hydra emoji-volpeon-vlpn Hydra build #53754 of nix-packages:riscv64-linux-master-pr276:emoji-volpeon-vlpn
Hydra emoji-volpeon-blobfox-flip Hydra build #53755 of nix-packages:riscv64-linux-master-pr276:emoji-volpeon-blobfox-flip
Hydra emoji-volpeon-drgn Hydra build #53758 of nix-packages:riscv64-linux-master-pr276:emoji-volpeon-drgn
Hydra admin-fe Hydra build #53757 of nix-packages:riscv64-linux-master-pr276:admin-fe
Hydra emoji-volpeon-gphn Hydra build #53759 of nix-packages:riscv64-linux-master-pr276:emoji-volpeon-gphn

This commit is contained in:
Charlotte 🦝 Delenk 2023-06-26 07:22:29 +01:00
parent 417b5bb137
commit 9ab71fe96b
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
5 changed files with 129 additions and 2 deletions

View file

@ -77,7 +77,7 @@ in
// (
if pkgs.system == "riscv64-linux"
then {
inherit (pkgsWithOverlay) vf2Kernel;
inherit (pkgsWithOverlay) vf2Kernel valgrind;
}
else {}
)

View file

@ -121,7 +121,7 @@
// (
if system == "riscv64-linux"
then {
inherit (pkgs) vf2Kernel;
inherit (pkgs) vf2Kernel valgrind;
}
else {}
)

View file

@ -42,6 +42,7 @@ system: self: super: let
doCheck = false;
doInstallCheck = false;
});
valgrind = self.callPackage ./riscv/valgrind {};
})
else (_: _: {});

115
riscv/valgrind/default.nix Normal file
View file

@ -0,0 +1,115 @@
{
lib,
stdenv,
fetchFromGitHub,
perl,
gdb,
cctools,
xnu,
bootstrap_cmds,
autoreconfHook,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
in
stdenv.mkDerivation rec {
pname = "valgrind-riscv64";
version = source.date;
src = fetchFromGitHub {
owner = "petrpavlu";
repo = "valgrind-riscv64";
inherit (source) rev sha256;
};
outputs = ["out" "dev"];
hardeningDisable = ["stackprotector"];
# GDB is needed to provide a sane default for `--db-command'.
# Perl is needed for `callgrind_{annotate,control}'.
buildInputs = [gdb perl] ++ lib.optionals (stdenv.isDarwin) [bootstrap_cmds xnu];
# Perl is also a native build input.
nativeBuildInputs = [autoreconfHook perl];
enableParallelBuilding = true;
separateDebugInfo = stdenv.isLinux;
preConfigure = lib.optionalString stdenv.isDarwin (
let
OSRELEASE = ''
$(awk -F '"' '/#define OSRELEASE/{ print $2 }' \
<${xnu}/Library/Frameworks/Kernel.framework/Headers/libkern/version.h)'';
in ''
echo "Don't derive our xnu version using uname -r."
substituteInPlace configure --replace "uname -r" "echo ${OSRELEASE}"
# Apple's GCC doesn't recognize `-arch' (as of version 4.2.1, build 5666).
echo "getting rid of the \`-arch' GCC option..."
find -name Makefile\* -exec \
sed -i {} -e's/DARWIN\(.*\)-arch [^ ]\+/DARWIN\1/g' \;
sed -i coregrind/link_tool_exe_darwin.in \
-e 's/^my \$archstr = .*/my $archstr = "x86_64";/g'
substituteInPlace coregrind/m_debuginfo/readmacho.c \
--replace /usr/bin/dsymutil ${stdenv.cc.bintools.bintools}/bin/dsymutil
echo "substitute hardcoded /usr/bin/ld with ${cctools}/bin/ld"
substituteInPlace coregrind/link_tool_exe_darwin.in \
--replace /usr/bin/ld ${cctools}/bin/ld
''
);
# To prevent rebuild on linux when moving darwin's postPatch fixes to preConfigure
postPatch = "";
configureFlags =
lib.optional (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin") "--enable-only64bit"
++ lib.optional stdenv.hostPlatform.isDarwin "--with-xcodedir=${xnu}/include";
doCheck = true;
postInstall = ''
for i in $out/libexec/valgrind/*.supp; do
substituteInPlace $i \
--replace 'obj:/lib' 'obj:*/lib' \
--replace 'obj:/usr/X11R6/lib' 'obj:*/lib' \
--replace 'obj:/usr/lib' 'obj:*/lib'
done
'';
passthru.updateScript = [
../../scripts/update-git.sh
"https://github.com/petrpavlu/valgrind-riscv64"
"riscv/valgrind/source.json"
];
meta = {
homepage = "http://www.valgrind.org/";
description = "Debugging and profiling tool suite";
longDescription = ''
Valgrind is an award-winning instrumentation framework for
building dynamic analysis tools. There are Valgrind tools that
can automatically detect many memory management and threading
bugs, and profile your programs in detail. You can also use
Valgrind to build new tools.
'';
license = lib.licenses.gpl2Plus;
maintainers = [lib.maintainers.nickcao];
platforms = lib.platforms.unix;
badPlatforms = [
"armv5tel-linux"
"armv6l-linux"
"armv6m-linux"
"sparc-linux"
"sparc64-linux"
"riscv32-linux"
"alpha-linux"
];
broken = stdenv.isDarwin || stdenv.hostPlatform.isStatic; # https://hydra.nixos.org/build/128521440/nixlog/2
};
}

View file

@ -0,0 +1,11 @@
{
"url": "https://github.com/petrpavlu/valgrind-riscv64",
"rev": "71272b252977fe52f03ea4fa8306b457b098cca5",
"date": "2023-04-10T20:43:50+02:00",
"path": "/nix/store/g00qg2qhm10c0a6v5v7al89pc57b4bjy-valgrind-riscv64",
"sha256": "0znk98hypdh7j84h237131aqsczz91mrwpwkvy1xgaxkhiskhgy4",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}