Unverified Commit 3ed8e14f authored by Yureka's avatar Yureka Committed by GitHub
Browse files

electron: fix building with rust 1.87

parent 8e5f9d17
Loading
Loading
Loading
Loading
+730 −0

File added.

Preview size limit exceeded, changes collapsed.

+60 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
  nodejs,
  fetchYarnDeps,
  fetchNpmDeps,
  fetchpatch,
  fixup-yarn-lock,
  npmHooks,
  yarn,
@@ -91,6 +92,65 @@ in
    # This patch makes those older versions also use the new adler2 library
    ++ lib.optionals (lib.versionOlder info.version "35") [
      ./use-rust-adler2.patch
    ]
    # Requirements for the next section
    ++ lib.optionals (lib.versionOlder info.version "35") [
      (fetchpatch {
        name = "Avoid-build-rust-PartitionAlloc-dep-when-not-build_with_chromium.patch";
        url = "https://github.com/chromium/chromium/commit/ee94f376a0dd642a93fbf4a5fa8e7aa8fb2a69b5.patch";
        hash = "sha256-qGjy9VZ4d3T5AuqOrBKEajBswwBU/7j0n80rpvHZLmM=";
      })
      (fetchpatch {
        name = "Suppress-unsafe_libc_call-warning-for-rust-remap_alloc-cc.patch";
        url = "https://github.com/chromium/chromium/commit/d5d79d881e74c6c8630f7d2f3affd4f656fdeb4e.patch";
        hash = "sha256-1oy5WRvNzKuUTJkt8kULUqE4JU+EKEV1PB9QN8HF4SE=";
      })
    ]
    # Fix building with Rust 1.87+
    # https://issues.chromium.org/issues/407024458
    ++ lib.optionals (lib.versionOlder info.version "37") [
      # https://chromium-review.googlesource.com/c/chromium/src/+/6432410
      # Not using fetchpatch here because it ignores file renames: https://github.com/nixos/nixpkgs/issues/32084
      ./Reland-Use-global_allocator-to-provide-Rust-allocator-implementation.patch

      # https://chromium-review.googlesource.com/c/chromium/src/+/6434355
      (fetchpatch {
        name = "Call-Rust-default-allocator-directly-from-Rust.patch";
        url = "https://github.com/chromium/chromium/commit/73eef8797a8138f5c26f52a1372644b20613f5ee.patch";
        hash = "sha256-IcSjPv21xT+l9BwJuzeW2AfwBdKI0dQb3nskk6yeKHU=";
      })

      # https://chromium-review.googlesource.com/c/chromium/src/+/6439711
      (fetchpatch {
        name = "Roll-rust.patch";
        url = "https://github.com/chromium/chromium/commit/a6c30520486be844735dc646cd5b9b434afa0c6b.patch";
        includes = [ "build/rust/allocator/*" ];
        hash = "sha256-MFdR75oSAdFW6telEZt/s0qdUvq/BiYFEHW0vk+RgDk=";
      })

      # https://chromium-review.googlesource.com/c/chromium/src/+/6456604
      (fetchpatch {
        name = "Drop-remap_alloc-dep.patch";
        url = "https://github.com/chromium/chromium/commit/87d5ad2f621e0d5c81849dde24f3a5347efcb167.patch";
        hash = "sha256-bEoR6jxEyw6Fzm4Zv4US54Cxa0li/0UTZTU2WUf0Rgo=";
      })

      # https://chromium-review.googlesource.com/c/chromium/src/+/6454872
      (fetchpatch {
        name = "rust-Clean-up-build-rust-allocator-after-a-Rust-tool.patch";
        url = "https://github.com/chromium/chromium/commit/5c74fcf6fd14491f33dd820022a9ca045f492f68.patch";
        hash = "sha256-vcD0Zfo4Io/FVpupWOdgurFEqwFCv+oDOtSmHbm+ons=";
      })
    ]
    # Fix building with gperf 3.2+
    # https://issues.chromium.org/issues/40209959
    ++ lib.optionals (lib.versionOlder info.version "37") [
      # https://chromium-review.googlesource.com/c/chromium/src/+/6445471
      (fetchpatch {
        name = "Dont-apply-FALLTHROUGH-edit-to-gperf-3-2-output.patch";
        url = "https://github.com/chromium/chromium/commit/f8f21fb4aa01f75acbb12abf5ea8c263c6817141.patch";
        hash = "sha256-z/aQ1oQjFZnkUeRnrD6P/WDZiYAI1ncGhOUM+HmjMZA=";
      })
    ];

  npmRoot = "third_party/node";