valgrind-light: fix build for FreeBSD

This is very similar to what we do for Darwin directly below, but
we look up the FreeBSD version at eval time instead.

The .0 is prepended because our current FreeBSD system doubles only
include the major version.  Valgrind ignores everything after the
dot anyway (but it wants the dot to be there).
This commit is contained in:
Alyssa Ross 2023-01-19 16:10:07 +00:00
parent 6e310cb6d7
commit 65cdb52a66

View file

@ -50,7 +50,10 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
separateDebugInfo = stdenv.isLinux;
preConfigure = lib.optionalString stdenv.isDarwin (
preConfigure = lib.optionalString stdenv.isFreeBSD ''
substituteInPlace configure --replace '`uname -r`' \
${toString stdenv.hostPlatform.parsed.kernel.version}.0
'' + lib.optionalString stdenv.isDarwin (
let OSRELEASE = ''
$(awk -F '"' '/#define OSRELEASE/{ print $2 }' \
<${xnu}/Library/Frameworks/Kernel.framework/Headers/libkern/version.h)'';
@ -75,7 +78,7 @@ stdenv.mkDerivation rec {
'');
configureFlags =
lib.optional (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "x86_64-darwin") "--enable-only64bit"
lib.optional stdenv.hostPlatform.isx86_64 "--enable-only64bit"
++ lib.optional stdenv.hostPlatform.isDarwin "--with-xcodedir=${xnu}/include";
doCheck = true;