Merge pull request #307211 from pwaller/llvm-simplify-arg-passthrough

llvmPackages_{12,13,14,15,16,17,18,git}: Simplify argument passthrough
This commit is contained in:
Artturin 2024-06-16 14:29:45 +03:00 committed by GitHub
commit 23b617791c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 117 additions and 179 deletions

View File

@ -17,29 +17,32 @@
then null
else pkgs.bintools
, darwin
}:
}@args:
let
release_version = "12.0.1";
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;
metadata = rec {
release_version = "12.0.1";
version = "${release_version}${dash-candidate}"; # differentiating these (variables) is important for RCs
inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta;
fetch = name: sha256: fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${metadata.version}/${name}-${metadata.release_version}${candidate}.src.tar.xz";
inherit sha256;
};
clang-tools-extra_src = fetch "clang-tools-extra" "1r9a4fdz9ci58b5z2inwvm4z4cdp6scrivnaw05dggkxz7yrwrb5";
};
clang-tools-extra_src = fetch "clang-tools-extra" "1r9a4fdz9ci58b5z2inwvm4z4cdp6scrivnaw05dggkxz7yrwrb5";
inherit (metadata) fetch;
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; });
callPackage = newScope (tools // args // metadata);
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${cc.lib}/lib/clang/${metadata.release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
@ -104,7 +107,6 @@ let
pollyPatches = [
./llvm/gnu-install-dirs-polly.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -122,7 +124,6 @@ let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -175,7 +176,6 @@ let
patches = [
./lld/gnu-install-dirs.patch
];
inherit llvm_meta;
inherit (libraries) libunwind;
};
@ -196,7 +196,6 @@ let
resourceDirPatch
./lldb/gnu-install-dirs.patch
];
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -287,7 +286,7 @@ let
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -306,7 +305,6 @@ let
../common/compiler-rt/armv6-sync-ops-no-thumb.patch
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -328,7 +326,6 @@ let
../common/compiler-rt/armv6-sync-ops-no-thumb.patch
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -347,7 +344,7 @@ let
src = fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
rev = "refs/tags/llvmorg-${version}";
rev = "refs/tags/llvmorg-${metadata.version}";
sparseCheckout = [
"libcxx"
"libcxxabi"
@ -372,7 +369,6 @@ let
];
})
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -381,7 +377,6 @@ let
patches = [
./libunwind/gnu-install-dirs.patch
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -394,9 +389,8 @@ let
hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A=";
})
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -41,7 +41,7 @@
# specified.
, monorepoSrc ? null
}:
}@args:
assert
lib.assertMsg
@ -53,19 +53,23 @@ assert
let
monorepoSrc' = monorepoSrc;
in let
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
src = monorepoSrc;
metadata = rec {
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
src = monorepoSrc;
};
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version src buildLlvmTools; });
callPackage = newScope (tools // args // metadata
# Previously monorepoSrc was erroneously not being passed through.
// { monorepoSrc = null; } # Preserve a bug during #307211, TODO: remove; causes llvm 13 rebuild.
);
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${cc.lib}/lib/clang/${metadata.release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
@ -125,7 +129,6 @@ in let
pollyPatches = [
./llvm/gnu-install-dirs-polly.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -148,7 +151,6 @@ in let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -199,7 +201,6 @@ in let
patches = [
./lld/gnu-install-dirs.patch
];
inherit llvm_meta;
};
lldb = callPackage ../common/lldb.nix {
@ -232,7 +233,6 @@ in let
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./lldb/cpu_subtype_arm64e_replacement.patch;
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -323,7 +323,10 @@ in let
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version src; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata
# Previously monorepoSrc was erroneously not being passed through.
// { monorepoSrc = null; } # Preserve a bug during #307211, TODO: remove; causes llvm 13 rebuild.
);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -344,7 +347,6 @@ in let
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -368,7 +370,6 @@ in let
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -399,16 +400,15 @@ in let
];
})
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
monorepoSrc = src;
# TODO: remove this, causes LLVM 13 packages rebuild.
inherit (metadata) monorepoSrc; # Preserve bug during #307211 refactor.
};
libunwind = callPackage ../common/libunwind {
patches = [
./libunwind/gnu-install-dirs.patch
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -420,9 +420,8 @@ in let
hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A=";
})
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -39,7 +39,7 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
}:
}@args:
assert
lib.assertMsg
@ -51,17 +51,20 @@ assert
let
monorepoSrc' = monorepoSrc;
in let
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
metadata = rec {
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
};
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 release_version version monorepoSrc buildLlvmTools; });
callPackage = newScope (tools // args // metadata);
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${cc.lib}/lib/clang/${metadata.release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
@ -100,7 +103,6 @@ in let
pollyPatches = [
./llvm/gnu-install-dirs-polly.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -118,7 +120,6 @@ in let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -170,7 +171,6 @@ in let
./lld/gnu-install-dirs.patch
./lld/fix-root-src-dir.patch
];
inherit llvm_meta;
};
lldb = callPackage ../common/lldb.nix {
@ -203,7 +203,6 @@ in let
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./lldb/cpu_subtype_arm64e_replacement.patch;
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -296,7 +295,7 @@ in let
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 release_version version monorepoSrc; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -318,7 +317,6 @@ in let
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -343,7 +341,6 @@ in let
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -374,7 +371,6 @@ in let
];
})
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -382,7 +378,6 @@ in let
patches = [
./libunwind/gnu-install-dirs.patch
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -391,9 +386,8 @@ in let
./openmp/gnu-install-dirs.patch
./openmp/run-lit-directly.patch
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -39,7 +39,7 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
}:
}@args:
assert
lib.assertMsg
@ -51,10 +51,13 @@ assert
let
monorepoSrc' = monorepoSrc;
in let
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
metadata = rec {
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
};
lldbPlugins = lib.makeExtensible (lldbPlugins: let
callPackage = newScope (lldbPlugins // { inherit stdenv; inherit (tools) lldb; });
@ -63,11 +66,11 @@ in let
});
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });
callPackage = newScope (tools // args // metadata);
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${cc.lib}/lib/clang/${metadata.release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
@ -144,7 +147,6 @@ in let
# Just like the `llvm-lit-cfg` patch, but for `polly`.
./llvm/polly-lit-cfg-add-libs-to-dylib-path.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -162,7 +164,6 @@ in let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -212,7 +213,6 @@ in let
patches = [
./lld/gnu-install-dirs.patch
];
inherit llvm_meta;
};
lldb = callPackage ../common/lldb.nix {
@ -245,7 +245,6 @@ in let
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./lldb/cpu_subtype_arm64e_replacement.patch;
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -348,7 +347,7 @@ in let
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -365,7 +364,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -385,7 +383,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -427,7 +424,6 @@ in let
];
})
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -435,7 +431,6 @@ in let
patches = [
./libunwind/gnu-install-dirs.patch
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -445,9 +440,8 @@ in let
./openmp/gnu-install-dirs.patch
./openmp/run-lit-directly.patch
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version lldbPlugins; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries lldbPlugins; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -39,7 +39,7 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
}:
}@args:
assert
lib.assertMsg
@ -51,10 +51,13 @@ assert
let
monorepoSrc' = monorepoSrc;
in let
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
metadata = rec {
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
};
lldbPlugins = lib.makeExtensible (lldbPlugins: let
callPackage = newScope (lldbPlugins // { inherit stdenv; inherit (tools) lldb; });
@ -63,8 +66,8 @@ in let
});
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });
major = lib.versions.major release_version;
callPackage = newScope (tools // args // metadata);
major = lib.versions.major metadata.release_version;
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
@ -138,7 +141,6 @@ in let
# Just like the `llvm-lit-cfg` patch, but for `polly`.
./llvm/polly-lit-cfg-add-libs-to-dylib-path.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -156,7 +158,6 @@ in let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -206,15 +207,12 @@ in let
./lld/gnu-install-dirs.patch
./lld/add-table-base.patch
];
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {};
lldb = callPackage ../common/lldb.nix {
src = callPackage ({ runCommand }: runCommand "lldb-src-${version}" {} ''
src = callPackage ({ runCommand }: runCommand "lldb-src-${metadata.version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/lldb "$out"
@ -248,7 +246,6 @@ in let
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./lldb/cpu_subtype_arm64e_replacement.patch;
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -351,13 +348,11 @@ in let
# Has to be in tools despite mostly being a library,
# because we use a native helper executable from a
# non-cross build in cross builds.
libclc = callPackage ../common/libclc.nix {
inherit buildLlvmTools;
};
libclc = callPackage ../common/libclc.nix {};
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -374,7 +369,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic)
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -394,7 +388,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -413,7 +406,6 @@ in let
# so: we use the clang from this LLVM package set instead of the regular
# stdenv's compiler.
libcxx = callPackage ../common/libcxx {
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -421,7 +413,6 @@ in let
patches = [
./libunwind/gnu-install-dirs.patch
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -431,9 +422,8 @@ in let
./openmp/gnu-install-dirs.patch
./openmp/run-lit-directly.patch
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version lldbPlugins; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries lldbPlugins; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -39,7 +39,7 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
}:
}@args:
assert
lib.assertMsg
@ -51,15 +51,17 @@ assert
let
monorepoSrc' = monorepoSrc;
in let
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
metadata = rec {
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub gitRelease release_version officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
};
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });
major = lib.versions.major release_version;
callPackage = newScope (tools // args // metadata);
major = lib.versions.major metadata.release_version;
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
@ -133,7 +135,6 @@ in let
# Just like the `llvm-lit-cfg` patch, but for `polly`.
./llvm/polly-lit-cfg-add-libs-to-dylib-path.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -151,7 +152,6 @@ in let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -201,15 +201,12 @@ in let
./lld/gnu-install-dirs.patch
./lld/add-table-base.patch
];
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {};
lldb = callPackage ../common/lldb.nix {
src = callPackage ({ runCommand }: runCommand "lldb-src-${version}" {} ''
src = callPackage ({ runCommand }: runCommand "lldb-src-${metadata.version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/lldb "$out"
@ -233,7 +230,6 @@ in let
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./lldb/cpu_subtype_arm64e_replacement.patch;
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -336,13 +332,11 @@ in let
# Has to be in tools despite mostly being a library,
# because we use a native helper executable from a
# non-cross build in cross builds.
libclc = callPackage ../common/libclc.nix {
inherit buildLlvmTools;
};
libclc = callPackage ../common/libclc.nix {};
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -359,7 +353,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic)
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -379,7 +372,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -406,12 +398,10 @@ in let
hash = "sha256-jo+DYA6zuSv9OH3A0bYwY5TlkWprup4OKQ7rfK1WHBI=";
})
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
libunwind = callPackage ../common/libunwind {
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -421,9 +411,8 @@ in let
./openmp/gnu-install-dirs.patch
./openmp/run-lit-directly.patch
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -39,7 +39,7 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
}:
}@args:
assert
lib.assertMsg
@ -51,15 +51,17 @@ assert
let
monorepoSrc' = monorepoSrc;
in let
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
metadata = rec {
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub gitRelease release_version officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
};
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });
major = lib.versions.major release_version;
callPackage = newScope (tools // args // metadata);
major = lib.versions.major metadata.release_version;
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
@ -133,7 +135,6 @@ in let
# Just like the `llvm-lit-cfg` patch, but for `polly`.
./llvm/polly-lit-cfg-add-libs-to-dylib-path.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -151,7 +152,6 @@ in let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -200,15 +200,12 @@ in let
patches = [
./lld/gnu-install-dirs.patch
];
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {};
lldb = callPackage ../common/lldb.nix {
src = callPackage ({ runCommand }: runCommand "lldb-src-${version}" {} ''
src = callPackage ({ runCommand }: runCommand "lldb-src-${metadata.version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/lldb "$out"
@ -232,7 +229,6 @@ in let
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./lldb/cpu_subtype_arm64e_replacement.patch;
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -335,13 +331,11 @@ in let
# Has to be in tools despite mostly being a library,
# because we use a native helper executable from a
# non-cross build in cross builds.
libclc = callPackage ../common/libclc.nix {
inherit buildLlvmTools;
};
libclc = callPackage ../common/libclc.nix {};
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -355,7 +349,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic)
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -372,7 +365,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -395,12 +387,10 @@ in let
# https://github.com/llvm/llvm-project/issues/64226
./libcxx/0001-darwin-10.12-mbstate_t-fix.patch
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
libunwind = callPackage ../common/libunwind {
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -409,9 +399,8 @@ in let
./openmp/fix-find-tool.patch
./openmp/run-lit-directly.patch
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -44,7 +44,7 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
}:
}@args:
assert
lib.assertMsg
@ -56,15 +56,17 @@ assert
let
monorepoSrc' = monorepoSrc;
in let
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
metadata = rec {
# Import releaseInfo separately to avoid infinite recursion
inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
inherit (releaseInfo) release_version version;
inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub gitRelease release_version officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
};
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });
major = lib.versions.major release_version;
callPackage = newScope (tools // args // metadata);
major = lib.versions.major metadata.release_version;
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
@ -138,7 +140,6 @@ in let
# Just like the `llvm-lit-cfg` patch, but for `polly`.
./llvm/polly-lit-cfg-add-libs-to-dylib-path.patch
];
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
@ -156,7 +157,6 @@ in let
libllvmLibdir = "${tools.libllvm.lib}/lib";
})
];
inherit llvm_meta;
};
clang-unwrapped = tools.libclang;
@ -205,15 +205,12 @@ in let
patches = [
./lld/gnu-install-dirs.patch
];
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {
inherit llvm_meta;
};
mlir = callPackage ../common/mlir {};
lldb = callPackage ../common/lldb.nix {
src = callPackage ({ runCommand }: runCommand "lldb-src-${version}" {} ''
src = callPackage ({ runCommand }: runCommand "lldb-src-${metadata.version}" {} ''
mkdir -p "$out"
cp -r ${monorepoSrc}/cmake "$out"
cp -r ${monorepoSrc}/lldb "$out"
@ -237,7 +234,6 @@ in let
&& !stdenv.targetPlatform.isAarch64
&& (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
) ./lldb/cpu_subtype_arm64e_replacement.patch;
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
@ -340,13 +336,11 @@ in let
# Has to be in tools despite mostly being a library,
# because we use a native helper executable from a
# non-cross build in cross builds.
libclc = callPackage ../common/libclc.nix {
inherit buildLlvmTools;
};
libclc = callPackage ../common/libclc.nix {};
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc; });
callPackage = newScope (libraries // buildLlvmTools // args // metadata);
in {
compiler-rt-libc = callPackage ../common/compiler-rt {
@ -360,7 +354,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic)
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
@ -377,7 +370,6 @@ in let
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
@ -400,12 +392,10 @@ in let
# https://github.com/llvm/llvm-project/issues/64226
./libcxx/0001-darwin-10.12-mbstate_t-fix.patch
];
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
libunwind = callPackage ../common/libunwind {
inherit llvm_meta;
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
};
@ -414,9 +404,8 @@ in let
./openmp/fix-find-tool.patch
./openmp/run-lit-directly.patch
];
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
in { inherit tools libraries; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)