llvmPackages_{12,13,14,15,16,17,18,git}: Allow overriding dependencies

... consistently.

Further to #307211, allow overriding arguments through llvmPackages.override.

This makes it possible to override any dependency of LLVM or
clang by overriding it on `llvmPackages.override { <dependency> = ...; }`.

This is useful in development or customization where sometimes it is
desirable to turn features on or off.

Without this patch the only way to for example override ncurses was to
do `overriddenLLVM = llvmPackages.llvm.override { ncurses }`, but then
you would have to thread `overriddenLLVM` as dependencies into clang and
other packages, which results in quite a difficult expression to write
correctly in cross compilation scenarios.

Signed-off-by: Peter Waller <p@pwaller.net>
(cherry picked from commit 40a7f218c5)
This commit is contained in:
Peter Waller 2024-06-16 14:47:45 +01:00 committed by github-actions[bot]
parent dd457de7e0
commit 311bf24d85
8 changed files with 56 additions and 19 deletions

View File

@ -1,7 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, substitute, substituteAll, fetchFromGitHub, fetchpatch
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub, fetchpatch, fetchurl
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -17,6 +17,10 @@
then null
else pkgs.bintools
, darwin
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
let

View File

@ -1,7 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, fetchpatch
, libxml2, python3, isl, fetchFromGitHub, substitute, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub, fetchpatch
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -40,7 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
assert

View File

@ -1,6 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, libxml2, python3, fetchFromGitHub, substitute, substituteAll, fetchpatch, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub, fetchpatch
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
assert

View File

@ -1,6 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, libxml2, python3, fetchFromGitHub, fetchpatch, substitute, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub, fetchpatch
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
assert

View File

@ -1,6 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
assert

View File

@ -1,6 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, libxml2, python3, fetchFromGitHub, fetchpatch, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub, fetchpatch
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
assert

View File

@ -1,6 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -39,6 +40,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
assert

View File

@ -1,6 +1,7 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
{ lowPrio, newScope, pkgs, lib, stdenv
, preLibcCrossHeaders
, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, substitute, substituteAll, fetchFromGitHub, fetchpatch
, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
@ -44,6 +45,10 @@
# to you to make sure that the LLVM repo given matches the release configuration
# specified.
, monorepoSrc ? null
# Allows passthrough to packages via newScope. This makes it possible to
# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
# an llvmPackages whose packages are overridden in an internally consistent way.
, ...
}@args:
assert