git.iko.soy/typeable/nixpkgs
on master help sign in
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`.

commitc71fd768225b8db59ab60ee4b0e64c2b771d5fd7 authorJosef Kemetmueller <josef.kemetmueller@gmail.com> dateTue 12 Sep 2017, 00:53 (9 years ago) parenteed14ba
2 files changed+9−38
pkgs/development/tools/analysis/valgrind/default.nix+9−1 pkgs/development/tools/analysis/valgrind/valgrind-bzero.patch−37
pkgs/development/tools/analysis/valgrind/default.nix+9−1
@@ -18,7 +18,15 @@ stdenv.mkDerivation rec {
1818
1919 enableParallelBuilding = true;
2020
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+ );
2230
2331 postPatch = stdenv.lib.optionalString (stdenv.isDarwin)
2432 # Apple's GCC doesn't recognize `-arch' (as of version 4.2.1, build 5666).
pkgs/development/tools/analysis/valgrind/valgrind-bzero.patchdeleted−37
@@ -1,37 +0,0 @@
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−