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-08-26 06:31:39 +01:00
|
|
|
let
|
2016-12-28 18:56:55 +00:00
|
|
|
version = "3.9.1";
|
2016-08-26 06:31:39 +01:00
|
|
|
|
|
|
|
fetch = fetch_v version;
|
|
|
|
fetch_v = ver: name: sha256: fetchurl {
|
2016-09-11 09:11:44 +01:00
|
|
|
url = "http://llvm.org/releases/${version}/${name}-${ver}.src.tar.xz";
|
2016-08-26 06:31:39 +01:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2016-12-28 18:56:55 +00:00
|
|
|
compiler-rt_src = fetch "compiler-rt" "16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk";
|
|
|
|
clang-tools-extra_src = fetch "clang-tools-extra" "0d9nh7j7brbh9avigcn69dlaihsl9p3cf9s45mw6fxzzvrdvd999";
|
2016-08-26 06:31:39 +01: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-08-26 06:31:39 +01:00
|
|
|
llvm = callPackage ./llvm.nix {
|
2018-05-23 17:39:07 +01:00
|
|
|
inherit compiler-rt_src;
|
2016-08-26 06:31:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
clang-unwrapped = callPackage ./clang {
|
2018-05-23 17:39:07 +01:00
|
|
|
inherit clang-tools-extra_src;
|
2016-08-26 06:31:39 +01: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-08-26 06:31:39 +01: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-08-26 06:31:39 +01: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
|