1eacf21bd4
Respect the fix points and aliases by overriding originals.
60 lines
1.8 KiB
Nix
60 lines
1.8 KiB
Nix
{ newScope, stdenv, libstdcxxHook, cmake, libxml2, python2, isl, fetchurl
|
|
, overrideCC, wrapCCWith, darwin
|
|
, buildLlvmTools # tools, but from the previous stage, for cross
|
|
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
|
}:
|
|
|
|
let
|
|
version = "3.7.1";
|
|
|
|
fetch = fetch_v version;
|
|
fetch_v = ver: name: sha256: fetchurl {
|
|
url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
|
|
inherit sha256;
|
|
};
|
|
|
|
compiler-rt_src = fetch "compiler-rt" "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx";
|
|
clang-tools-extra_src = fetch "clang-tools-extra" "0sxw2l3q5msbrwxv1ck72arggdw6n5ysi929gi69ikniranfv4aa";
|
|
|
|
tools = stdenv.lib.makeExtensible (tools: let
|
|
callPackage = newScope (tools // { inherit stdenv isl version fetch; });
|
|
in {
|
|
llvm = callPackage ./llvm.nix {
|
|
inherit compiler-rt_src;
|
|
inherit (targetLlvmLibraries) libcxxabi;
|
|
};
|
|
|
|
clang-unwrapped = callPackage ./clang {
|
|
inherit clang-tools-extra_src;
|
|
};
|
|
|
|
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
|
|
|
libstdcxxClang = wrapCCWith {
|
|
cc = tools.clang-unwrapped;
|
|
extraPackages = [ libstdcxxHook ];
|
|
};
|
|
|
|
libcxxClang = wrapCCWith {
|
|
cc = tools.clang-unwrapped;
|
|
extraPackages = [ targetLlvmLibraries.libcxx targetLlvmLibraries.libcxxabi ];
|
|
};
|
|
|
|
lldb = callPackage ./lldb.nix {};
|
|
});
|
|
|
|
libraries = stdenv.lib.makeExtensible (libraries: let
|
|
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv isl version fetch; });
|
|
in {
|
|
|
|
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
|
|
|
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
|
|
|
libcxx = callPackage ./libc++ {};
|
|
|
|
libcxxabi = callPackage ./libc++abi.nix {};
|
|
});
|
|
|
|
in { inherit tools libraries; } // libraries // tools
|