fix valgrind

This commit is contained in:
Charlotte 🦝 Delenk 2023-06-26 07:26:56 +01:00
parent 9b6af9f819
commit b203c2ed27
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122

View file

@ -5,8 +5,6 @@
perl, perl,
gdb, gdb,
cctools, cctools,
xnu,
bootstrap_cmds,
autoreconfHook, autoreconfHook,
}: let }: let
source = builtins.fromJSON (builtins.readFile ./source.json); source = builtins.fromJSON (builtins.readFile ./source.json);
@ -27,7 +25,7 @@ in
# GDB is needed to provide a sane default for `--db-command'. # GDB is needed to provide a sane default for `--db-command'.
# Perl is needed for `callgrind_{annotate,control}'. # Perl is needed for `callgrind_{annotate,control}'.
buildInputs = [gdb perl] ++ lib.optionals (stdenv.isDarwin) [bootstrap_cmds xnu]; buildInputs = [gdb perl];
# Perl is also a native build input. # Perl is also a native build input.
nativeBuildInputs = [autoreconfHook perl]; nativeBuildInputs = [autoreconfHook perl];
@ -35,39 +33,9 @@ in
enableParallelBuilding = true; enableParallelBuilding = true;
separateDebugInfo = stdenv.isLinux; 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 # To prevent rebuild on linux when moving darwin's postPatch fixes to preConfigure
postPatch = ""; 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; doCheck = true;
postInstall = '' postInstall = ''