valgrind: Fix darwin build

The bzero-patch was merged upstream in
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16103, so it does no
longer apply.

Additionally - to make the build succeed on darwin systems more recent
than our nixpkgs.darwin.xnu kernel version - we need to teach the build
the version of the xnu headers we provide, instead of letting the build
figure out the actual system version using `uname -r`.

+9 -38
+9 -1
pkgs/development/tools/analysis/valgrind/default.nix
··· 18 18 19 19 enableParallelBuilding = true; 20 20 21 - patches = stdenv.lib.optionals (stdenv.isDarwin) [ ./valgrind-bzero.patch ]; 21 + preConfigure = stdenv.lib.optionalString stdenv.isDarwin ( 22 + let OSRELEASE = '' 23 + $(awk -F '"' '/#define OSRELEASE/{ print $2 }' \ 24 + <${xnu}/Library/Frameworks/Kernel.framework/Headers/libkern/version.h)''; 25 + in '' 26 + echo "Don't derive our xnu version using uname -r." 27 + substituteInPlace configure --replace "uname -r" "echo ${OSRELEASE}" 28 + '' 29 + ); 22 30 23 31 postPatch = stdenv.lib.optionalString (stdenv.isDarwin) 24 32 # Apple's GCC doesn't recognize `-arch' (as of version 4.2.1, build 5666).
-37
pkgs/development/tools/analysis/valgrind/valgrind-bzero.patch
··· 1 - Index: coregrind/m_main.c 2 - =================================================================== 3 - --- a/coregrind/m_main.c (revision 16102) 4 - +++ b/coregrind/m_main.c (revision 16103) 5 - @@ -3489,6 +3489,10 @@ 6 - // skip check 7 - return VG_(memset)(s,c,n); 8 - } 9 - +void __bzero(void* s, UWord n); 10 - +void __bzero(void* s, UWord n) { 11 - + (void)VG_(memset)(s,0,n); 12 - +} 13 - void bzero(void *s, SizeT n); 14 - void bzero(void *s, SizeT n) { 15 - VG_(memset)(s,0,n); 16 - @@ -4058,20 +4062,7 @@ 17 - 18 - #endif 19 - 20 - -#if defined(VGO_darwin) && DARWIN_VERS == DARWIN_10_10 21 - 22 - -/* This might also be needed for > DARWIN_10_10, but I have no way 23 - - to test for that. Hence '==' rather than '>=' in the version 24 - - test above. */ 25 - -void __bzero ( void* s, UWord n ); 26 - -void __bzero ( void* s, UWord n ) 27 - -{ 28 - - (void) VG_(memset)( s, 0, n ); 29 - -} 30 - - 31 - -#endif 32 - - 33 - - 34 - /*--------------------------------------------------------------------*/ 35 - /*--- end ---*/ 36 - /*--------------------------------------------------------------------*/ 37 -