From 74444fb4e5b72142bc546530ae3b7a5540b73022 Mon Sep 17 00:00:00 2001 From: emilylange Date: Wed, 15 Jul 2026 18:30:44 +0200 Subject: [PATCH] chromium: remove no longer needed version conditionals The minimum versions for both chromium and electron-source are higher than the version bounds of those conditionals. As such, they can be safely removed. This is a no-op. --- .../networking/browsers/chromium/browser.nix | 15 +-- .../networking/browsers/chromium/common.nix | 101 ++---------------- .../patches/chromium-126-llvm-17.patch | 29 ----- .../chromium/patches/chromium-140-rust.patch | 21 ---- ...hromium-144-rustc_nightly_capability.patch | 13 --- 5 files changed, 14 insertions(+), 165 deletions(-) delete mode 100644 pkgs/applications/networking/browsers/chromium/patches/chromium-126-llvm-17.patch delete mode 100644 pkgs/applications/networking/browsers/chromium/patches/chromium-140-rust.patch delete mode 100644 pkgs/applications/networking/browsers/chromium/patches/chromium-144-rustc_nightly_capability.patch diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix index 09925f0f2101..6581009da5b3 100644 --- a/pkgs/applications/networking/browsers/chromium/browser.nix +++ b/pkgs/applications/networking/browsers/chromium/browser.nix @@ -6,11 +6,6 @@ ungoogled, }: -let - # https://chromium-review.googlesource.com/c/chromium/src/+/7253206 - ifElseM145 = new: old: if chromiumVersionAtLeast "145" then new else old; -in - mkChromiumDerivation (base: rec { name = "chromium-browser"; packageName = "chromium"; @@ -67,11 +62,11 @@ mkChromiumDerivation (base: rec { $out/share/applications/chromium-browser.desktop substituteInPlace $out/share/applications/chromium-browser.desktop \ - --replace-fail "${ifElseM145 "@@MENUNAME" "@@MENUNAME@@"}" "Chromium" \ - --replace-fail "${ifElseM145 "@@PACKAGE" "@@PACKAGE@@"}" "chromium" \ - --replace-fail "${ifElseM145 "/usr/bin/@@usr_bin_symlink_name" "/usr/bin/@@USR_BIN_SYMLINK_NAME@@"}" "chromium" \ - --replace-fail "${ifElseM145 "@@uri_scheme" "@@URI_SCHEME@@"}" "x-scheme-handler/chromium;" \ - --replace-fail "${ifElseM145 "@@extra_desktop_entries" "@@EXTRA_DESKTOP_ENTRIES@@"}" "" + --replace-fail "@@MENUNAME" "Chromium" \ + --replace-fail "@@PACKAGE" "chromium" \ + --replace-fail "/usr/bin/@@usr_bin_symlink_name" "chromium" \ + --replace-fail "@@uri_scheme" "x-scheme-handler/chromium;" \ + --replace-fail "@@extra_desktop_entries" "" # See https://github.com/NixOS/nixpkgs/issues/12433 substituteInPlace $out/share/applications/chromium-browser.desktop \ diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index dd4df835a93c..cd18cb55e2b1 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -158,11 +158,6 @@ let # "snappy" "flac" "libjpeg" - ] - ++ lib.optionals needsLibpng [ - "libpng" - ] - ++ [ # Use the vendored libwebp for M124+ until we figure out how to solve: # Running phase: configurePhase # ERROR Unresolved dependencies. @@ -231,9 +226,6 @@ let isElectron = packageName == "electron"; rustcVersion = buildPackages.rustc.version; llvmVersion = buildPackages.rustc.llvmPackages.llvm.version; - # libpng has been replaced by the png rust crate - # https://github.com/image-rs/image-png/discussions/562 - needsLibpng = !chromiumVersionAtLeast "143"; chromiumDeps = lib.mapAttrs ( path: args: @@ -338,9 +330,6 @@ let # maintain a separate list of buildPlatform-dependencies, we # simply throw in the kitchen sink. # ** Because of overrides, we have to copy the list as it otherwise mess with splicing ** - ++ lib.optionals needsLibpng [ - (buildPackages.libpng.override { apngSupport = false; }) # https://bugs.chromium.org/p/chromium/issues/detail?id=752403 - ] ++ [ (buildPackages.libopus.override { withCustomModes = true; }) bzip2 @@ -397,11 +386,6 @@ let ++ lib.optional pulseSupport libpulseaudio; buildInputs = [ - ] - ++ lib.optionals needsLibpng [ - (libpng.override { apngSupport = false; }) # https://bugs.chromium.org/p/chromium/issues/detail?id=752403 - ] - ++ [ (libopus.override { withCustomModes = true; }) bzip2 flac @@ -493,22 +477,10 @@ let # This patch modifies it to read /etc/chromium/initial_preferences ./patches/chromium-initial-prefs.patch ] - ++ lib.optionals (!chromiumVersionAtLeast "142") [ - # https://github.com/chromium/chromium/commit/02b6456643700771597c00741937e22068b0f956 - # https://github.com/chromium/chromium/commit/69736ffe943ff996d4a88d15eb30103a8c854e29 - # Rebased variant of patch to build M126+ with LLVM 17. - # staging-next will bump LLVM to 18, so we will be able to drop this soon. - # Started failing to apply with M142, but this is no longer needed anyway. - ./patches/chromium-126-llvm-17.patch - ] - ++ lib.optionals (versionRange "140" "141") [ - # Partial revert of https://github.com/chromium/chromium/commit/3687976b0c6d36cf4157419a24a39f6770098d61 - # allowing us to use our rustc and our clang. - ./patches/chromium-140-rust.patch - ] ++ lib.optionals (versionRange "141" "150") [ - # Rebased variant of the patch above due to - # https://chromium-review.googlesource.com/c/chromium/src/+/6897026 + # Rebased partial revert of https://chromium-review.googlesource.com/c/chromium/src/+/4596177 + # due to https://chromium-review.googlesource.com/c/chromium/src/+/6897026 + # allowing us to use our rustc and our clang. ./patches/chromium-141-rust.patch ] ++ lib.optionals (chromiumVersionAtLeast "150") [ @@ -516,23 +488,6 @@ let # https://chromium-review.googlesource.com/c/chromium/src/+/7858711 ./patches/chromium-150-rust.patch ] - ++ lib.optionals (!chromiumVersionAtLeast "145" && stdenv.hostPlatform.isAarch64) [ - # Reverts decommit pooled pages which causes random crashes of tabs on systems - # with page sizes different than 4k. It 'supports' runtime page sizes, but has - # a hardcode for aarch64 systems. - # https://issues.chromium.org/issues/378017037 - # Started failing to apply with M145, but this is no longer needed anyway. - (fetchpatch { - name = "reverted-v8-decommit-pooled-paged-by-default.patch"; - # https://chromium-review.googlesource.com/c/v8/v8/+/5864909 - url = "https://chromium.googlesource.com/v8/v8/+/1ab1a14ad97394d384d8dc6de51bb229625e66d6^!?format=TEXT"; - decode = "base64 -d"; - stripLen = 1; - extraPrefix = "v8/"; - revert = true; - hash = "sha256-PuinMLhJ2W4KPXI5K0ujw85ENTB1wG7Hv785SZ55xnY="; - }) - ] ++ [ # Modify the nodejs version check added in https://chromium-review.googlesource.com/c/chromium/src/+/6334038 # to look for the minimal version, not the exact version (major.minor.patch). The linked CL makes a case for @@ -553,38 +508,7 @@ let hash = "sha256-xf1Jq5v3InXkiVH0uT7+h1HPwZse5MDcHKuJNjSLR6k="; }) ] - ++ lib.optionals (versionRange "142" "143") [ - (fetchpatch { - # Fix https://issues.chromium.org/issues/450752866 by backporting - # https://chromium-review.googlesource.com/c/chromium/src/+/7030724 from M143 - name = "chromium-142-Backport-Add-missing-include-for-FormFieldData-type-completeness.patch"; - url = "https://chromium.googlesource.com/chromium/src/+/069d424e41f42c6f4a4551334eafc7cfaed6e880^!?format=TEXT"; - decode = "base64 -d"; - hash = "sha256-0ueOCHYheSFHRFzEat3TDhnU3Avf0TcNBBBpTkz+saw="; - }) - ] - ++ lib.optionals (versionRange "144" "146") [ - # Patch rustc_nightly_capability to eval to false instead of true. - # https://chromium-review.googlesource.com/c/chromium/src/+/7022369 - ./patches/chromium-144-rustc_nightly_capability.patch - ] - ++ lib.optionals (versionRange "144.0.7559.132" "145" && !ungoogled) [ - # Rollup was swapped with esbuild because of compile failures on Windows, - # which is not compatible with our build yet. So let's revert it for now. - # Ungoogled ships its own variant of this patch upstream. - # https://issues.chromium.org/issues/461602362 - (fetchpatch { - name = "revert-devtools-frontend-esbuild-instead-of-rollup.patch"; - # https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7526345 - url = "https://chromium.googlesource.com/devtools/devtools-frontend/+/f130475580017f9f87502343dbcfc0c76dccefe8^!?format=TEXT"; - decode = "base64 -d"; - stripLen = 1; - extraPrefix = "third_party/devtools-frontend/src/"; - revert = true; - hash = "sha256-k+xCfhDuHxtuGhY7LVE8HvbDJt8SEFkslBcJe7t5CAg="; - }) - ] - ++ lib.optionals (chromiumVersionAtLeast "146" && !ungoogled) [ + ++ lib.optionals (!ungoogled) [ # Same as the patch above, but from ungoogled-chromium and much # cleaner (and smaller) than reverting an endless chain of CLs. (fetchpatch { @@ -594,7 +518,7 @@ let hash = "sha256-Ho5I33FOgtYHvKSZlWXWuBaqnSHqy4+f6EZdiL+/rRQ="; }) ] - ++ lib.optionals (chromiumVersionAtLeast "146" && !ungoogled) [ + ++ lib.optionals (!ungoogled) [ # Revert CL 7457194 to fix the following error: # ERROR at //chrome/test/BUILD.gn:6355:9: Unable to load "/build/src/components/variations/test_data/cipd/BUILD.gn". # "//components/variations/test_data/cipd:single_group_per_study_prefer_existing_behavior_seed", @@ -923,8 +847,7 @@ let # Disable PGO because the profile data requires a newer compiler version (LLVM 14 isn't sufficient): chrome_pgo_phase = 0; clang_base_path = "${llvmCcAndBintools}"; - } - // lib.optionalAttrs (chromiumVersionAtLeast "141") { + # TODO: remove opt-out of https://chromium.googlesource.com/chromium/src/+/main/docs/modules.md use_clang_modules = false; } @@ -946,8 +869,7 @@ let use_system_libffi = true; # Use nixpkgs Rust compiler instead of the one shipped by Chromium. rust_sysroot_absolute = "${buildPackages.rustc}"; - rust_bindgen_root = - if chromiumVersionAtLeast "144" then "${rustTools}" else "${buildPackages.rust-bindgen}"; + rust_bindgen_root = "${rustTools}"; enable_rust = true; # While we technically don't need the cache-invalidation rustc_version provides, rustc_version # is still used in some scripts (e.g. build/rust/std/find_std_rlibs.py). @@ -987,7 +909,7 @@ let # which causes a "error: TS2403: Subsequent variable declarations must have the same type" later in the build. # TypeScript is parsing both @lit/reactive-element/reactive-element.d.ts and @lit/reactive-element/development/reactive-element.d.ts, # but lit_reactive_element.patch only patches the former. - + lib.optionalString (chromiumVersionAtLeast "146") '' + + '' rm -r third_party/node/node_modules/@lit/reactive-element/development '' # Similarly, having @types/estree causes: @@ -1045,12 +967,7 @@ let TERM=dumb ninja -C "${buildPath}" -j$NIX_BUILD_CORES "${target}" bash -s << EOL ( - source ${ - if chromiumVersionAtLeast "144" then - "remoting/host/installer/linux/" - else - "chrome/installer/linux/common" - }/installer.include + source remoting/host/installer/linux//installer.include PACKAGE=$packageName MENUNAME="Chromium" process_template chrome/app/resources/manpage.1.in "${buildPath}/chrome.1" diff --git a/pkgs/applications/networking/browsers/chromium/patches/chromium-126-llvm-17.patch b/pkgs/applications/networking/browsers/chromium/patches/chromium-126-llvm-17.patch deleted file mode 100644 index ea059d884b5a..000000000000 --- a/pkgs/applications/networking/browsers/chromium/patches/chromium-126-llvm-17.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn -index 6efe967eb0a1c..590a2c274ac13 100644 ---- a/build/config/compiler/BUILD.gn -+++ b/build/config/compiler/BUILD.gn -@@ -568,24 +568,6 @@ config("compiler") { - } - } - -- # TODO(crbug.com/40283598): This causes binary size growth and potentially -- # other problems. -- # TODO(crbug.com/40284925): This isn't supported by Cronet's mainline llvm version. -- if (default_toolchain != "//build/toolchain/cros:target" && -- !llvm_android_mainline) { -- cflags += [ -- "-mllvm", -- "-split-threshold-for-reg-with-hint=0", -- ] -- if (use_thin_lto && is_a_target_toolchain) { -- if (is_win) { -- ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ] -- } else { -- ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ] -- } -- } -- } -- - # TODO(crbug.com/40192287): Investigate why/if this should be needed. - if (is_win) { - cflags += [ "/clang:-ffp-contract=off" ] diff --git a/pkgs/applications/networking/browsers/chromium/patches/chromium-140-rust.patch b/pkgs/applications/networking/browsers/chromium/patches/chromium-140-rust.patch deleted file mode 100644 index 42990884fa11..000000000000 --- a/pkgs/applications/networking/browsers/chromium/patches/chromium-140-rust.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn -index 77b02f76d2845fdf1a9429f704e59b8f7ab42993..e6ce3abe9872f415a9ef1cfc76f7267e7e44e1c9 100644 ---- a/build/config/compiler/BUILD.gn -+++ b/build/config/compiler/BUILD.gn -@@ -1917,16 +1917,6 @@ config("runtime_library") { - configs += [ "//build/config/c++:runtime_library" ] - } - -- # Rust and C++ both provide intrinsics for LLVM to call for math operations. We -- # want to use the C++ intrinsics, not the ones in the Rust compiler_builtins -- # library. The Rust symbols are marked as weak, so that they can be replaced by -- # the C++ symbols. This config ensures the C++ symbols exist and are strong in -- # order to cause that replacement to occur by explicitly linking in clang's -- # compiler-rt library. -- if (is_clang && !is_cronet_build) { -- configs += [ "//build/config/clang:compiler_builtins" ] -- } -- - # TODO(crbug.com/40570904): Come up with a better name for is POSIX + Fuchsia - # configuration. - if (is_posix || is_fuchsia) { diff --git a/pkgs/applications/networking/browsers/chromium/patches/chromium-144-rustc_nightly_capability.patch b/pkgs/applications/networking/browsers/chromium/patches/chromium-144-rustc_nightly_capability.patch deleted file mode 100644 index 219f6824a5c3..000000000000 --- a/pkgs/applications/networking/browsers/chromium/patches/chromium-144-rustc_nightly_capability.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/build/config/rust.gni b/build/config/rust.gni -index ef45a4a9a6daa45859df27fa00bd17d6ee87aa21..b46cb483330133dd0a02e9b276979dc3a94f2520 100644 ---- a/build/config/rust.gni -+++ b/build/config/rust.gni -@@ -112,7 +112,7 @@ use_chromium_rust_toolchain = rust_sysroot_absolute == "" - # `rustc_nightly_capability = false` will make the build avoid the use of - # Rust nightly features. There are no bots that test this and there is no - # guarantee it will work, but we accept patches for this configuration. --rustc_nightly_capability = use_chromium_rust_toolchain -+rustc_nightly_capability = true - - # Platform support for the Rust toolchain. - chromium_toolchain_supports_platform = !is_wasm