anchor.diff:          --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";
  
positive.code:         --replace 'obj:/usr/lib' 'obj:*/lib'
      done
    '';
  
    meta = {
      homepage = "http://www.valgrind.org/";
  
negative.code: { lib, stdenv, fetchurl, fetchpatch
  , autoreconfHook, perl
  , gdb, cctools, xnu, bootstrap_cmds
  , writeScript
  }:
  
  stdenv.mkDerivation rec {
    pname = "valgrind";
    version = "3.19.0";
  
    src = fetchurl {
      url = "https://sourceware.org/pub/${pname}/${pname}-${version}.tar.bz2";
      sha256 = "sha256-3V40SG8aSD/3vnMAzBa01rJGkJh4d8MnjXl1NNZzjwI=";
    };
  
    outputs = [ "out" "dev" "man" "doc" ];
  
  