Commit 394ef62f authored by Tristan Ross's avatar Tristan Ross Committed by Alyssa Ross
Browse files

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

parent c330ebeb
Loading
Loading
Loading
Loading
+0 −31
Original line number Diff line number Diff line
@@ -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
+35 −2
Original line number Diff line number Diff line
@@ -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;