chromium,electron: fix build with rust 1.89.0 (#434962)

+41 -33
+18
pkgs/applications/networking/browsers/chromium/common.nix
··· 526 526 # preventing compilations of chromium with versions below their intended version, not about running the very 527 527 # exact version or even running a newer version. 528 528 ./patches/chromium-136-nodejs-assert-minimal-version-instead-of-exact-match.patch 529 + ] 530 + ++ lib.optionals (chromiumVersionAtLeast "138") [ 531 + (fetchpatch { 532 + # Unbreak building with Rust 1.89+ which introduced 533 + # a new mismatched_lifetime_syntaxes lint. 534 + # https://issues.chromium.org/issues/424424323 535 + name = "chromium-138-rust-1.86-mismatched_lifetime_syntaxes.patch"; 536 + # https://chromium-review.googlesource.com/c/chromium/src/+/6658267 537 + url = "https://chromium.googlesource.com/chromium/src/+/94a87ff38c51fd1a71980a5051d3553978391608^!?format=TEXT"; 538 + decode = "base64 -d"; 539 + includes = [ "build/rust/cargo_crate.gni" ]; 540 + hash = "sha256-xf1Jq5v3InXkiVH0uT7+h1HPwZse5MDcHKuJNjSLR6k="; 541 + }) 542 + ] 543 + ++ lib.optionals (!chromiumVersionAtLeast "138") [ 544 + # Rebased variant of the patch above for 545 + # electron 35 (M134) and 36 (M136) 546 + ./patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch 529 547 ]; 530 548 531 549 postPatch =
+14
pkgs/applications/networking/browsers/chromium/patches/chromium-134-rust-1.86-mismatched_lifetime_syntaxes.patch
··· 1 + diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni 2 + index 8266c44cbd1dfb8a53797dbe911ea74c32ce070e..ec7d751f2d068151dfeb71aa1f6510483bebd95c 100644 3 + --- a/build/rust/cargo_crate.gni 4 + +++ b/build/rust/cargo_crate.gni 5 + @@ -285,6 +285,9 @@ template("cargo_crate") { 6 + } 7 + rustenv = _rustenv 8 + 9 + + # TODO(crbug.com/424424323): Clean up and enable. 10 + + rustflags += [ "-Amismatched_lifetime_syntaxes" ] 11 + + 12 + if (!defined(build_native_rust_unit_tests)) { 13 + build_native_rust_unit_tests = _crate_type != "proc-macro" 14 + }
+9 -20
pkgs/development/tools/electron/common.nix
··· 86 86 87 87 patches = 88 88 base.patches 89 - # Fix building with Rust 1.86+ 90 - # electron_33 and electron_34 use older chromium versions which expect rust 91 - # to provide the older `adler` library instead of the newer `adler2` library 92 - # This patch makes those older versions also use the new adler2 library 93 - ++ lib.optionals (lib.versionOlder info.version "35") [ 94 - ./use-rust-adler2.patch 95 - ] 96 - # Requirements for the next section 97 - ++ lib.optionals (lib.versionOlder info.version "35") [ 98 - (fetchpatch { 99 - name = "Avoid-build-rust-PartitionAlloc-dep-when-not-build_with_chromium.patch"; 100 - url = "https://github.com/chromium/chromium/commit/ee94f376a0dd642a93fbf4a5fa8e7aa8fb2a69b5.patch"; 101 - hash = "sha256-qGjy9VZ4d3T5AuqOrBKEajBswwBU/7j0n80rpvHZLmM="; 102 - }) 103 - (fetchpatch { 104 - name = "Suppress-unsafe_libc_call-warning-for-rust-remap_alloc-cc.patch"; 105 - url = "https://github.com/chromium/chromium/commit/d5d79d881e74c6c8630f7d2f3affd4f656fdeb4e.patch"; 106 - hash = "sha256-1oy5WRvNzKuUTJkt8kULUqE4JU+EKEV1PB9QN8HF4SE="; 107 - }) 108 - ] 109 89 # Fix building with Rust 1.87+ 110 90 # https://issues.chromium.org/issues/407024458 111 91 ++ lib.optionals (lib.versionOlder info.version "37") [ ··· 150 130 name = "Dont-apply-FALLTHROUGH-edit-to-gperf-3-2-output.patch"; 151 131 url = "https://github.com/chromium/chromium/commit/f8f21fb4aa01f75acbb12abf5ea8c263c6817141.patch"; 152 132 hash = "sha256-z/aQ1oQjFZnkUeRnrD6P/WDZiYAI1ncGhOUM+HmjMZA="; 133 + }) 134 + ] 135 + # Fix build with Rust 1.89.0 136 + ++ lib.optionals (lib.versionOlder info.version "38") [ 137 + # https://chromium-review.googlesource.com/c/chromium/src/+/6624733 138 + (fetchpatch { 139 + name = "Define-rust-no-alloc-shim-is-unstable-v2.patch"; 140 + url = "https://github.com/chromium/chromium/commit/6aae0e2353c857d98980ff677bf304288d7c58de.patch"; 141 + hash = "sha256-Dd38c/0hiH+PbGPJhhEFuW6kUR45A36XZqOVExoxlhM="; 153 142 }) 154 143 ]; 155 144
-13
pkgs/development/tools/electron/use-rust-adler2.patch
··· 1 - diff --git a/build/rust/std/BUILD.gn b/build/rust/std/BUILD.gn 2 - index 6b996aa1fe3865187d02c017e56c0918bcc9b8f4..68b085be200fa4f116aa709b9157c4d2efdf7d6a 100644 3 - --- a/build/rust/std/BUILD.gn 4 - +++ b/build/rust/std/BUILD.gn 5 - @@ -89,7 +89,7 @@ if (toolchain_has_rust) { 6 - # These are no longer present in the Windows toolchain. 7 - stdlib_files += [ 8 - "addr2line", 9 - - "adler", 10 - + "adler2", 11 - "gimli", 12 - "libc", 13 - "memchr",