diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/15/default.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/15/default.nix | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/pkgs/development/compilers/llvm/15/default.nix b/pkgs/development/compilers/llvm/15/default.nix index 5003ef32d1ee0..e30e9f9a59db7 100644 --- a/pkgs/development/compilers/llvm/15/default.nix +++ b/pkgs/development/compilers/llvm/15/default.nix @@ -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) |