diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index 948957a1c7ff..225abc626e42 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -27,6 +27,7 @@ officialRelease ? null, monorepoSrc ? null, version ? null, + patchesFn ? lib.id, # Allows passthrough to packages via newScope. This makes it possible to # do `(llvmPackages.override { = bar; }).clang` and get # an llvmPackages whose packages are overridden in an internally consistent way. @@ -80,232 +81,7 @@ let name = builtins.baseNameOf p; path = let - patches = { - "clang/gnu-install-dirs.patch" = [ - { - before = "14"; - path = ../12; - } - { - after = "19"; - path = ../19; - } - ]; - "clang/purity.patch" = [ - { - after = "18"; - path = ../18; - } - { - before = "17"; - after = "15"; - path = ../15; - } - { - before = "16"; - path = ../12; - } - ]; - "clang/aarch64-tblgen.patch" = [ - { - after = "17"; - before = "18"; - path = ../17; - } - ]; - "lld/add-table-base.patch" = [ - { - after = "16"; - path = ../16; - } - ]; - "lld/gnu-install-dirs.patch" = [ - { - after = "18"; - path = ../18; - } - { - before = "14"; - path = ../12; - } - ]; - "llvm/gnu-install-dirs.patch" = [ - { - after = "20"; - path = ../20; - } - { - after = "18"; - before = "20"; - path = ../18; - } - ]; - "llvm/gnu-install-dirs-polly.patch" = [ - { - after = "20"; - path = ../20; - } - { - before = "20"; - after = "18"; - path = ../18; - } - { - before = "18"; - after = "14"; - path = ../14; - } - ]; - "llvm/llvm-lit-cfg-add-libs-to-dylib-path.patch" = [ - { - before = "17"; - after = "15"; - path = ../15; - } - { - after = "17"; - path = ../17; - } - ]; - "llvm/lit-shell-script-runner-set-dyld-library-path.patch" = [ - { - after = "18"; - path = ../18; - } - { - after = "16"; - before = "18"; - path = ../16; - } - ]; - "llvm/polly-lit-cfg-add-libs-to-dylib-path.patch" = [ - { - after = "15"; - path = ../15; - } - ]; - "libunwind/gnu-install-dirs.patch" = [ - { - before = "17"; - after = "15"; - path = ../15; - } - ]; - "compiler-rt/X86-support-extension.patch" = [ - { - after = "15"; - path = ../15; - } - { - before = "15"; - path = ../12; - } - ]; - "compiler-rt/armv6-scudo-libatomic.patch" = [ - { - after = "19"; - path = ../19; - } - { - after = "15"; - before = "19"; - path = ../15; - } - { - before = "15"; - path = ../14; - } - ]; - "compiler-rt/armv7l.patch" = [ - { - before = "15"; - after = "13"; - path = ../13; - } - ]; - "compiler-rt/gnu-install-dirs.patch" = [ - { - before = "14"; - path = ../12; - } - { - after = "13"; - before = "15"; - path = ../14; - } - { - after = "15"; - before = "17"; - path = ../15; - } - { - after = "16"; - path = ../17; - } - ]; - "compiler-rt/darwin-targetconditionals.patch" = [ - { - after = "13"; - path = ../13; - } - ]; - "compiler-rt/codesign.patch" = [ - { - after = "13"; - path = ../13; - } - ]; - "compiler-rt/normalize-var.patch" = [ - { - after = "16"; - path = ../16; - } - { - before = "16"; - path = ../12; - } - ]; - "lldb/procfs.patch" = [ - { - after = "15"; - path = ../15; - } - { - before = "15"; - path = ../12; - } - ]; - "lldb/resource-dir.patch" = [ - { - before = "16"; - path = ../12; - } - ]; - "openmp/fix-find-tool.patch" = [ - { - after = "17"; - before = "19"; - path = ../17; - } - ]; - "openmp/run-lit-directly.patch" = [ - { - after = "16"; - path = ../16; - } - { - after = "14"; - before = "16"; - path = ../14; - } - ]; - "libclc/use-default-paths.patch" = [ - { - after = "19"; - path = ../19; - } - ]; - }; + patches = args.patchesFn (import ./patches.nix); constraints = patches."${p}" or null; matchConstraint = diff --git a/pkgs/development/compilers/llvm/common/patches.nix b/pkgs/development/compilers/llvm/common/patches.nix new file mode 100644 index 000000000000..37ba80c349d2 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/patches.nix @@ -0,0 +1,226 @@ +{ + "clang/gnu-install-dirs.patch" = [ + { + before = "14"; + path = ../12; + } + { + after = "19"; + path = ../19; + } + ]; + "clang/purity.patch" = [ + { + after = "18"; + path = ../18; + } + { + before = "17"; + after = "15"; + path = ../15; + } + { + before = "16"; + path = ../12; + } + ]; + "clang/aarch64-tblgen.patch" = [ + { + after = "17"; + before = "18"; + path = ../17; + } + ]; + "lld/add-table-base.patch" = [ + { + after = "16"; + path = ../16; + } + ]; + "lld/gnu-install-dirs.patch" = [ + { + after = "18"; + path = ../18; + } + { + before = "14"; + path = ../12; + } + ]; + "llvm/gnu-install-dirs.patch" = [ + { + after = "20"; + path = ../20; + } + { + after = "18"; + before = "20"; + path = ../18; + } + ]; + "llvm/gnu-install-dirs-polly.patch" = [ + { + after = "20"; + path = ../20; + } + { + before = "20"; + after = "18"; + path = ../18; + } + { + before = "18"; + after = "14"; + path = ../14; + } + ]; + "llvm/llvm-lit-cfg-add-libs-to-dylib-path.patch" = [ + { + before = "17"; + after = "15"; + path = ../15; + } + { + after = "17"; + path = ../17; + } + ]; + "llvm/lit-shell-script-runner-set-dyld-library-path.patch" = [ + { + after = "18"; + path = ../18; + } + { + after = "16"; + before = "18"; + path = ../16; + } + ]; + "llvm/polly-lit-cfg-add-libs-to-dylib-path.patch" = [ + { + after = "15"; + path = ../15; + } + ]; + "libunwind/gnu-install-dirs.patch" = [ + { + before = "17"; + after = "15"; + path = ../15; + } + ]; + "compiler-rt/X86-support-extension.patch" = [ + { + after = "15"; + path = ../15; + } + { + before = "15"; + path = ../12; + } + ]; + "compiler-rt/armv6-scudo-libatomic.patch" = [ + { + after = "19"; + path = ../19; + } + { + after = "15"; + before = "19"; + path = ../15; + } + { + before = "15"; + path = ../14; + } + ]; + "compiler-rt/armv7l.patch" = [ + { + before = "15"; + after = "13"; + path = ../13; + } + ]; + "compiler-rt/gnu-install-dirs.patch" = [ + { + before = "14"; + path = ../12; + } + { + after = "13"; + before = "15"; + path = ../14; + } + { + after = "15"; + before = "17"; + path = ../15; + } + { + after = "16"; + path = ../17; + } + ]; + "compiler-rt/darwin-targetconditionals.patch" = [ + { + after = "13"; + path = ../13; + } + ]; + "compiler-rt/codesign.patch" = [ + { + after = "13"; + path = ../13; + } + ]; + "compiler-rt/normalize-var.patch" = [ + { + after = "16"; + path = ../16; + } + { + before = "16"; + path = ../12; + } + ]; + "lldb/procfs.patch" = [ + { + after = "15"; + path = ../15; + } + { + before = "15"; + path = ../12; + } + ]; + "lldb/resource-dir.patch" = [ + { + before = "16"; + path = ../12; + } + ]; + "openmp/fix-find-tool.patch" = [ + { + after = "17"; + before = "19"; + path = ../17; + } + ]; + "openmp/run-lit-directly.patch" = [ + { + after = "16"; + path = ../16; + } + { + after = "14"; + before = "16"; + path = ../14; + } + ]; + "libclc/use-default-paths.patch" = [ + { + after = "19"; + path = ../19; + } + ]; +} diff --git a/pkgs/development/compilers/llvm/default.nix b/pkgs/development/compilers/llvm/default.nix index 28bfcb703647..c3d31450830e 100644 --- a/pkgs/development/compilers/llvm/default.nix +++ b/pkgs/development/compilers/llvm/default.nix @@ -14,6 +14,7 @@ bootBintoolsNoLibc ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintoolsNoLibc, bootBintools ? if stdenv.targetPlatform.linker == "lld" then null else pkgs.bintools, llvmVersions ? { }, + patchesFn ? lib.id, # Allows passthrough to packages via newScope in ./common/default.nix. # This makes it possible to do # `(llvmPackages.override { = bar; }).clang` and get @@ -74,6 +75,7 @@ let gitRelease monorepoSrc version + patchesFn ; } // packageSetArgs # Allow overrides.