about summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers
diff options
context:
space:
mode:
authorEmily <git@emilylange.de>2024-02-02 17:54:13 +0100
committerGitHub <noreply@github.com>2024-02-02 17:54:13 +0100
commit145c58bcc7a890676faccd0741750f444cf168b3 (patch)
tree207dbe1a31859cc370a0d83077c23e2be1c24079 /pkgs/applications/networking/browsers
parent10fb14a187b0b1954959cbf48e0572d7ecdb20ce (diff)
parentdd2517bfc4851d41b99acf6b73d46f76d46608c3 (diff)
downloadnixlib-145c58bcc7a890676faccd0741750f444cf168b3.tar
nixlib-145c58bcc7a890676faccd0741750f444cf168b3.tar.gz
nixlib-145c58bcc7a890676faccd0741750f444cf168b3.tar.bz2
nixlib-145c58bcc7a890676faccd0741750f444cf168b3.tar.lz
nixlib-145c58bcc7a890676faccd0741750f444cf168b3.tar.xz
nixlib-145c58bcc7a890676faccd0741750f444cf168b3.tar.zst
nixlib-145c58bcc7a890676faccd0741750f444cf168b3.zip
Merge pull request #285327 from emilylange/chromium
chromium: fix rust toolchain and remove M121 workaround, {ungoogled-,}chromium: 121.0.6167.85 -> 121.0.6167.139
Diffstat (limited to 'pkgs/applications/networking/browsers')
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix30
-rw-r--r--pkgs/applications/networking/browsers/chromium/patches/chromium-121-rust.patch19
-rw-r--r--pkgs/applications/networking/browsers/chromium/upstream-info.nix16
3 files changed, 44 insertions, 21 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index f860edc93a36..45fc2054c103 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -238,16 +238,9 @@ let
       })
     ] ++ lib.optionals (chromiumVersionAtLeast "121") [
       # M121 is the first version to require the new rust toolchain.
-      # But we don't have that ready yet.
-      # So we have to revert the singular commit that requires rust toolchain.
-      # This works, because the code in question, the QR code generator, is present in
-      # two variants: c++ and rust. This workaround will not last.
-      # The c++ variant in question is deemed to be removed in a month (give or take).
-      (githubPatch {
-        revert = true;
-        commit = "bcf739b95713071687ff25010683248de0092f6a";
-        hash = "sha256-1ZPe45cc2bjnErcF3prbLMlYpU7kpuwDVcjewINQr+Q=";
-      })
+      # Partial revert of https://github.com/chromium/chromium/commit/3687976b0c6d36cf4157419a24a39f6770098d61
+      # allowing us to use our rustc and our clang.
+      ./patches/chromium-121-rust.patch
     ];
 
     postPatch = ''
@@ -412,11 +405,15 @@ let
       # (ld.lld: error: unable to find library -l:libffi_pic.a):
       use_system_libffi = true;
       # Use nixpkgs Rust compiler instead of the one shipped by Chromium.
-      # We do intentionally not set rustc_version as nixpkgs will never do incremental
-      # rebuilds, thus leaving this empty is fine.
       rust_sysroot_absolute = "${buildPackages.rustc}";
-      # Building with rust is disabled for now - this matches the flags in other major distributions.
+      # Rust is enabled for M121+, see next section:
       enable_rust = false;
+    } // lib.optionalAttrs (chromiumVersionAtLeast "121") {
+      # M121 the first version to actually require a functioning rust toolchain
+      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).
+      rustc_version = buildPackages.rustc.version;
     } // lib.optionalAttrs (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) {
       # https://www.mail-archive.com/v8-users@googlegroups.com/msg14528.html
       arm_control_flow_integrity = "none";
@@ -431,6 +428,13 @@ let
     } // lib.optionalAttrs ungoogled (lib.importTOML ./ungoogled-flags.toml)
     // (extraAttrs.gnFlags or {}));
 
+    # We cannot use chromiumVersionAtLeast in mkDerivation's env attrset due
+    # to infinite recursion when chromium.override is used (e.g. electron).
+    # To work aroud this, we use export in the preConfigure phase.
+    preConfigure = lib.optionalString (chromiumVersionAtLeast "121") ''
+      export RUSTC_BOOTSTRAP=1
+    '';
+
     configurePhase = ''
       runHook preConfigure
 
diff --git a/pkgs/applications/networking/browsers/chromium/patches/chromium-121-rust.patch b/pkgs/applications/networking/browsers/chromium/patches/chromium-121-rust.patch
new file mode 100644
index 000000000000..b5292c80858b
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/patches/chromium-121-rust.patch
@@ -0,0 +1,19 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -1629,16 +1629,6 @@
+     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 && toolchain_has_rust) {
+-    configs += [ "//build/config/clang:compiler_builtins" ]
+-  }
+-
+   # TODO(crbug.com/830987): Come up with a better name for is POSIX + Fuchsia
+   # configuration.
+   if (is_posix || is_fuchsia) {
diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.nix b/pkgs/applications/networking/browsers/chromium/upstream-info.nix
index 88c66f4ae119..22b384b27ba5 100644
--- a/pkgs/applications/networking/browsers/chromium/upstream-info.nix
+++ b/pkgs/applications/networking/browsers/chromium/upstream-info.nix
@@ -15,9 +15,9 @@
         version = "2023-11-28";
       };
     };
-    hash = "sha256-2TMTLCqoCxdy9PDlZIUa/5oXjmim1T2/LJu+3/Kf4fQ=";
-    hash_deb_amd64 = "sha256-9vPQAiZPw60oILm0He4Iz9lOc+WvtHCBE9CHA1ejc7s=";
-    version = "121.0.6167.85";
+    hash = "sha256-pZHa4YSJ4rK24f7dNUFeoyf6nDSQeY4MTR81YzPKCtQ=";
+    hash_deb_amd64 = "sha256-cMoYBCuOYzXS7OzFvvBfSL80hBY/PcEv9kWGSx3mCKw=";
+    version = "121.0.6167.139";
   };
   ungoogled-chromium = {
     deps = {
@@ -28,12 +28,12 @@
         version = "2023-11-28";
       };
       ungoogled-patches = {
-        hash = "sha256-Fopr+SiezOs3w52juXvMyfxOAzrVXrRO8j0744oeO5k=";
-        rev = "223fe76bb263a216341739ce2ee333752642cf47";
+        hash = "sha256-W13YPijmdakEJiUd9iKH3V9LcKvL796QlyTrAb+yLMQ=";
+        rev = "121.0.6167.139-1";
       };
     };
-    hash = "sha256-2TMTLCqoCxdy9PDlZIUa/5oXjmim1T2/LJu+3/Kf4fQ=";
-    hash_deb_amd64 = "sha256-9vPQAiZPw60oILm0He4Iz9lOc+WvtHCBE9CHA1ejc7s=";
-    version = "121.0.6167.85";
+    hash = "sha256-pZHa4YSJ4rK24f7dNUFeoyf6nDSQeY4MTR81YzPKCtQ=";
+    hash_deb_amd64 = "sha256-cMoYBCuOYzXS7OzFvvBfSL80hBY/PcEv9kWGSx3mCKw=";
+    version = "121.0.6167.139";
   };
 }