2018-06-14 15:22:33 +01:00
|
|
|
{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
|
2018-04-29 23:06:35 +01:00
|
|
|
with stdenv.lib;
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "compiler-rt-${version}";
|
|
|
|
inherit version;
|
2018-06-28 21:58:05 +01:00
|
|
|
src = fetch "compiler-rt" "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl";
|
2018-04-29 23:06:35 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake python llvm ];
|
2018-06-14 15:22:33 +01:00
|
|
|
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
2018-04-29 23:06:35 +01:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
|
|
|
];
|
|
|
|
|
2018-06-14 15:22:33 +01:00
|
|
|
outputs = [ "out" "dev" ];
|
2018-04-29 23:06:35 +01:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
|
|
|
] ++ optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch;
|
|
|
|
|
|
|
|
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
|
|
|
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
|
|
|
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
|
|
|
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
|
|
|
|
# a flag and turn the flag off during the stdenv build.
|
|
|
|
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace cmake/config-ix.cmake \
|
|
|
|
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
|
|
|
'';
|
|
|
|
|
2018-06-14 15:22:33 +01:00
|
|
|
# Hack around weird upsream RPATH bug
|
|
|
|
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
ln -s "$out/lib"/*/* "$out/lib"
|
|
|
|
'';
|
|
|
|
|
2018-04-29 23:06:35 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
}
|