llvmPackages_{12,13,14,15,16,17,18,19,20,git}.libcxx: move patches out of common

This commit is contained in:
Tristan Ross
2025-03-07 14:18:04 +01:00
committed by Alyssa Ross
parent c330ebeb4f
commit 394ef62fb0
2 changed files with 35 additions and 33 deletions
@@ -965,37 +965,6 @@ let
libcxx = callPackage ./libcxx (
{
patches = lib.optionals (lib.versionOlder metadata.release_version "16") (
lib.optional (lib.versions.major metadata.release_version == "15")
# See:
# - https://reviews.llvm.org/D133566
# - https://github.com/NixOS/nixpkgs/issues/214524#issuecomment-1429146432
# !!! Drop in LLVM 16+
(
fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/57c7bb3ec89565c68f858d316504668f9d214d59.patch";
hash = "sha256-B07vHmSjy5BhhkGSj3e1E0XmMv5/9+mvC/k70Z29VwY=";
}
)
++ [
(substitute {
src = ./libcxxabi/wasm.patch;
substitutions = [
"--replace-fail"
"/cmake/"
"/llvm/cmake/"
];
})
]
++ lib.optional stdenv.hostPlatform.isMusl (substitute {
src = ./libcxx/libcxx-0001-musl-hacks.patch;
substitutions = [
"--replace-fail"
"/include/"
"/libcxx/include/"
];
})
);
stdenv =
if stdenv.hostPlatform.isDarwin then
overrideCC darwin.bootstrapStdenv buildLlvmTools.clangWithLibcAndBasicRt
@@ -4,7 +4,6 @@
, release_version
, monorepoSrc ? null
, src ? null
, patches ? []
, runCommand
, cmake
, lndir
@@ -17,6 +16,8 @@
, libunwind
, enableShared ? stdenv.hostPlatform.hasSharedLibraries
, devExtraCmakeFlags ? []
, substitute
, fetchpatch
}:
# external cxxabi is not supported on Darwin as the build will not link libcxx
@@ -120,7 +121,7 @@ let
in
stdenv.mkDerivation (rec {
inherit pname version cmakeFlags patches;
inherit pname version cmakeFlags;
src = src';
@@ -130,6 +131,38 @@ stdenv.mkDerivation (rec {
patchShebangs utils/cat_files.py
'';
patches = lib.optionals (lib.versionOlder release_version "16") (
lib.optional (lib.versions.major release_version == "15")
# See:
# - https://reviews.llvm.org/D133566
# - https://github.com/NixOS/nixpkgs/issues/214524#issuecomment-1429146432
# !!! Drop in LLVM 16+
(
fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/57c7bb3ec89565c68f858d316504668f9d214d59.patch";
hash = "sha256-B07vHmSjy5BhhkGSj3e1E0XmMv5/9+mvC/k70Z29VwY=";
}
)
++ [
(substitute {
src = ../libcxxabi/wasm.patch;
substitutions = [
"--replace-fail"
"/cmake/"
"/llvm/cmake/"
];
})
]
++ lib.optional stdenv.hostPlatform.isMusl (substitute {
src = ./libcxx-0001-musl-hacks.patch;
substitutions = [
"--replace-fail"
"/include/"
"/libcxx/include/"
];
})
);
nativeBuildInputs = [ cmake ninja python3 ]
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames
++ lib.optional (cxxabi != null) lndir;