97 lines
3.0 KiB
Nix
97 lines
3.0 KiB
Nix
|
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
|
||
|
, preLibcCrossHeaders
|
||
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||
|
, buildLlvmTools # tools, but from the previous stage, for cross
|
||
|
, targetLlvm
|
||
|
# This is the default binutils, but with *this* version of LLD rather
|
||
|
# than the default LLVM version's, if LLD is the choice. We use these for
|
||
|
# the `useLLVM` bootstrapping below.
|
||
|
, bootBintoolsNoLibc ?
|
||
|
if stdenv.targetPlatform.linker == "lld"
|
||
|
then null
|
||
|
else pkgs.bintoolsNoLibc
|
||
|
, bootBintools ?
|
||
|
if stdenv.targetPlatform.linker == "lld"
|
||
|
then null
|
||
|
else pkgs.bintools
|
||
|
}:
|
||
|
|
||
|
let
|
||
|
release_version = "11.1.0";
|
||
|
candidate = ""; # empty or "rcN"
|
||
|
dash-candidate = lib.optionalString (candidate != "") "-${candidate}";
|
||
|
version = "${release_version}${dash-candidate}"; # differentiating these (variables) is important for RCs
|
||
|
|
||
|
fetch = name: sha256: fetchurl {
|
||
|
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/${name}-${release_version}${candidate}.src.tar.xz";
|
||
|
inherit sha256;
|
||
|
};
|
||
|
|
||
|
clang-tools-extra_src = fetch "clang-tools-extra" "18n1w1hkv931xzq02b34wglbv6zd6sd0r5kb8piwvag7klj7qw3n";
|
||
|
|
||
|
inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta;
|
||
|
|
||
|
tools = lib.makeExtensible (tools: let
|
||
|
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
|
||
|
mkExtraBuildCommands0 = cc: ''
|
||
|
rsrc="$out/resource-root"
|
||
|
mkdir "$rsrc"
|
||
|
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
|
||
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||
|
'';
|
||
|
|
||
|
bintoolsNoLibc' =
|
||
|
if bootBintoolsNoLibc == null
|
||
|
then tools.bintoolsNoLibc
|
||
|
else bootBintoolsNoLibc;
|
||
|
bintools' =
|
||
|
if bootBintools == null
|
||
|
then tools.bintools
|
||
|
else bootBintools;
|
||
|
|
||
|
in {
|
||
|
|
||
|
libllvm = callPackage ./llvm {
|
||
|
inherit llvm_meta;
|
||
|
};
|
||
|
|
||
|
# `llvm` historically had the binaries. When choosing an output explicitly,
|
||
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||
|
llvm = tools.libllvm;
|
||
|
|
||
|
libllvm-polly = callPackage ./llvm {
|
||
|
inherit llvm_meta;
|
||
|
enablePolly = true;
|
||
|
};
|
||
|
|
||
|
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
|
||
|
|
||
|
libclang = callPackage ./clang {
|
||
|
inherit clang-tools-extra_src llvm_meta;
|
||
|
};
|
||
|
|
||
|
clang-unwrapped = tools.libclang;
|
||
|
|
||
|
clang-polly-unwrapped = callPackage ./clang {
|
||
|
inherit llvm_meta;
|
||
|
inherit clang-tools-extra_src;
|
||
|
libllvm = tools.libllvm-polly;
|
||
|
enablePolly = true;
|
||
|
};
|
||
|
|
||
|
llvm-manpages = lowPrio (tools.libllvm.override {
|
||
|
enableManpages = true;
|
||
|
python3 = pkgs.python3; # don't use python-boot
|
||
|
});
|
||
|
|
||
|
clang-manpages = lowPrio (tools.libclang.override {
|
||
|
enableManpages = true;
|
||
|
python3 = pkgs.python3; # don't use python-boot
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
|
||
|
|
||
|
in { inherit tools release_version; } // (noExtend tools)
|