about summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/chromium
diff options
context:
space:
mode:
authorYureka <yuka@yuka.dev>2023-12-05 16:31:24 +0100
committerYureka <yuka@yuka.dev>2023-12-05 19:38:31 +0100
commit17ca7f65295805d8ebfeef2b81b68122fb30886e (patch)
tree7e27e3f86e8fa172491d78e2d7731d3c13ee4a99 /pkgs/applications/networking/browsers/chromium
parent9652f98da0717bbd5a8e1166196e13dd9f7b25b6 (diff)
downloadnixlib-17ca7f65295805d8ebfeef2b81b68122fb30886e.tar
nixlib-17ca7f65295805d8ebfeef2b81b68122fb30886e.tar.gz
nixlib-17ca7f65295805d8ebfeef2b81b68122fb30886e.tar.bz2
nixlib-17ca7f65295805d8ebfeef2b81b68122fb30886e.tar.lz
nixlib-17ca7f65295805d8ebfeef2b81b68122fb30886e.tar.xz
nixlib-17ca7f65295805d8ebfeef2b81b68122fb30886e.tar.zst
nixlib-17ca7f65295805d8ebfeef2b81b68122fb30886e.zip
chromium: fix build for chromium >=120
Diffstat (limited to 'pkgs/applications/networking/browsers/chromium')
-rw-r--r--pkgs/applications/networking/browsers/chromium/chromium-120-llvm-16.patch43
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix4
-rw-r--r--pkgs/applications/networking/browsers/chromium/default.nix1
3 files changed, 47 insertions, 1 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/chromium-120-llvm-16.patch b/pkgs/applications/networking/browsers/chromium/chromium-120-llvm-16.patch
new file mode 100644
index 000000000000..99a8c521a08a
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/chromium-120-llvm-16.patch
@@ -0,0 +1,43 @@
+diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
+index de1cd6e..bb5700b 100644
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -616,24 +616,6 @@ config("compiler") {
+       }
+     }
+ 
+-    # TODO(crbug.com/1488374): This causes binary size growth and potentially
+-    # other problems.
+-    # TODO(crbug.com/1491036): 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/1235145): Investigate why/if this should be needed.
+     if (is_win) {
+       cflags += [ "/clang:-ffp-contract=off" ]
+@@ -800,13 +782,6 @@ config("compiler") {
+       if (is_apple) {
+         ldflags += [ "-Wcrl,object_path_lto" ]
+       }
+-      if (!is_chromeos) {
+-        # TODO(https://crbug.com/972449): turn on for ChromeOS when that
+-        # toolchain has this flag.
+-        # We only use one version of LLVM within a build so there's no need to
+-        # upgrade debug info, which can be expensive since it runs the verifier.
+-        ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ]
+-      }
+     }
+ 
+     # TODO(https://crbug.com/1211155): investigate why this isn't effective on
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index 249c8b45f3f5..a322a171051f 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -246,6 +246,7 @@ let
       # (we currently package 1.26 in Nixpkgs while Chromium bundles 1.21):
       # Source: https://bugs.chromium.org/p/angleproject/issues/detail?id=7582#c1
       ./patches/angle-wayland-include-protocol.patch
+    ] ++ lib.optionals (!chromiumVersionAtLeast "120") [
       # We need to revert this patch to build M114+ with LLVM 16:
       (githubPatch {
         # Reland [clang] Disable autoupgrading debug info in ThinLTO builds
@@ -253,6 +254,9 @@ let
         hash = "sha256-Vryjg8kyn3cxWg3PmSwYRG6zrHOqYWBMSdEMGiaPg6M=";
         revert = true;
       })
+    ] ++ lib.optionals (chromiumVersionAtLeast "120") [
+      # We need to revert this patch to build M120+ with LLVM 16:
+      ./chromium-120-llvm-16.patch
     ] ++ lib.optionals (!chromiumVersionAtLeast "119.0.6024.0") [
       # Fix build with at-spi2-core ≥ 2.49
       # This version is still needed for electron.
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index 7c2c75e74974..c1ac2dee602c 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -1,6 +1,5 @@
 { newScope, config, stdenv, fetchurl, makeWrapper
 , buildPackages
-, llvmPackages_16
 , ed, gnugrep, coreutils, xdg-utils
 , glib, gtk3, gtk4, gnome, gsettings-desktop-schemas, gn, fetchgit
 , libva, pipewire, wayland