2018-07-21 01:44:44 +01:00
|
|
|
{ newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCCWith
|
2018-05-23 17:39:07 +01:00
|
|
|
, buildLlvmTools # tools, but from the previous stage, for cross
|
|
|
|
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
2018-05-23 00:25:34 +01:00
|
|
|
}:
|
|
|
|
|
2016-03-09 00:05:46 +00:00
|
|
|
let
|
2016-08-30 19:56:01 +01:00
|
|
|
version = "3.8.1";
|
2016-03-09 00:05:46 +00:00
|
|
|
|
|
|
|
fetch = fetch_v version;
|
|
|
|
fetch_v = ver: name: sha256: fetchurl {
|
2018-09-19 14:02:21 +01:00
|
|
|
url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
|
2016-03-09 00:05:46 +00:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2016-08-30 19:56:01 +01:00
|
|
|
compiler-rt_src = fetch "compiler-rt" "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d";
|
|
|
|
clang-tools-extra_src = fetch "clang-tools-extra" "15n39r4ssphpaq4a0wzyjm7ilwxb0bch6nrapy8c5s8d49h5qjk6";
|
2016-03-09 00:05:46 +00:00
|
|
|
|
2018-06-14 15:22:33 +01:00
|
|
|
tools = stdenv.lib.makeExtensible (tools: let
|
2018-05-23 17:39:07 +01:00
|
|
|
callPackage = newScope (tools // { inherit stdenv isl version fetch; });
|
|
|
|
in {
|
2016-03-09 00:05:46 +00:00
|
|
|
llvm = callPackage ./llvm.nix {
|
2018-05-23 17:39:07 +01:00
|
|
|
inherit compiler-rt_src;
|
2016-03-09 00:05:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
clang-unwrapped = callPackage ./clang {
|
2018-05-23 17:39:07 +01:00
|
|
|
inherit clang-tools-extra_src;
|
2016-03-09 00:05:46 +00:00
|
|
|
};
|
|
|
|
|
2018-05-23 17:39:07 +01:00
|
|
|
libclang = tools.clang-unwrapped.lib;
|
2017-12-31 10:07:57 +00:00
|
|
|
|
2018-05-23 17:39:07 +01:00
|
|
|
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
2017-09-11 19:44:32 +01:00
|
|
|
|
2018-05-23 00:21:35 +01:00
|
|
|
libstdcxxClang = wrapCCWith {
|
2018-05-23 17:39:07 +01:00
|
|
|
cc = tools.clang-unwrapped;
|
2017-09-11 19:44:32 +01:00
|
|
|
extraPackages = [ libstdcxxHook ];
|
|
|
|
};
|
2016-03-09 00:05:46 +00:00
|
|
|
|
2018-05-23 00:21:35 +01:00
|
|
|
libcxxClang = wrapCCWith {
|
2018-05-23 17:39:07 +01:00
|
|
|
cc = tools.clang-unwrapped;
|
|
|
|
extraPackages = [ targetLlvmLibraries.libcxx targetLlvmLibraries.libcxxabi ];
|
2016-10-25 15:29:40 +01:00
|
|
|
};
|
|
|
|
|
2018-05-23 17:39:07 +01:00
|
|
|
lldb = callPackage ./lldb.nix {};
|
2018-06-14 15:22:33 +01:00
|
|
|
});
|
2018-05-23 17:39:07 +01:00
|
|
|
|
2018-06-14 15:22:33 +01:00
|
|
|
libraries = stdenv.lib.makeExtensible (libraries: let
|
2018-05-23 17:39:07 +01:00
|
|
|
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv isl version fetch; });
|
|
|
|
in {
|
2017-09-11 19:44:32 +01:00
|
|
|
|
2018-05-23 17:39:07 +01:00
|
|
|
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
2016-10-25 15:29:40 +01:00
|
|
|
|
2018-05-23 17:39:07 +01:00
|
|
|
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
2016-03-09 00:05:46 +00:00
|
|
|
|
|
|
|
libcxx = callPackage ./libc++ {};
|
|
|
|
|
|
|
|
libcxxabi = callPackage ./libc++abi.nix {};
|
2018-06-14 15:22:33 +01:00
|
|
|
});
|
2018-05-23 17:39:07 +01:00
|
|
|
|
|
|
|
in { inherit tools libraries; } // libraries // tools
|