@@ -41,16 +41,18 @@ in stdenv.mkDerivation rec {
4141 outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
4242
4343 buildInputs = [ perl groff cmake libxml2 python libffi ]
44− ++ stdenv.lib.optionals stdenv.isDarwin
45− [ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ];
44+ ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
4645
4746 propagatedBuildInputs = [ ncurses zlib ];
4847
49− # hacky fix: New LLVM releases require a newer OS X SDK than
50− # 10.9. This is a temporary measure until nixpkgs darwin support is
51− # updated.
48+ # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
49+ # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
50+ # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
51+ # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
52+ # a flag and turn the flag off during the stdenv build.
5253 postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
53− sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
54+ substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
55+ --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
5456 ''
5557 # Patch llvm-config to return correct library path based on --link-{shared,static}.
5658 + stdenv.lib.optionalString (enableSharedLibraries) ''
@@ -85,7 +87,6 @@ in stdenv.mkDerivation rec {
8587 ++ stdenv.lib.optionals (isDarwin) [
8688 "-DLLVM_ENABLE_LIBCXX=ON"
8789 "-DCAN_TARGET_i386=false"
88− "-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool"
8990 ];
9091
9192 postBuild = ''