diff options
Diffstat (limited to 'pkgs/applications/networking/browsers/chromium')
7 files changed, 102 insertions, 57 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix index 24811cc336b6a..5b77afaaf3ebb 100644 --- a/pkgs/applications/networking/browsers/chromium/browser.nix +++ b/pkgs/applications/networking/browsers/chromium/browser.nix @@ -73,7 +73,7 @@ mkChromiumDerivation (base: rec { requiredSystemFeatures = [ "big-parallel" ]; meta = { - description = "An open source web browser from Google" + description = "Open source web browser from Google" + lib.optionalString ungoogled ", with dependencies on Google web services removed"; longDescription = '' Chromium is an open source web browser from Google that aims to build a diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index e7597249acdb5..3616189374d30 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -3,7 +3,6 @@ , buildPackages , buildPlatform , pkgsBuildBuild -, pkgsBuildTarget # Channel data: , channel, upstream-info # Helper functions: @@ -13,7 +12,6 @@ , ninja, pkg-config , python3, perl , which -, llvmPackages_attrName , libuuid , overrideCC # postPatch: @@ -132,7 +130,7 @@ let # https://github.com/NixOS/nixpkgs/issues/142901 buildPlatformLlvmStdenv = let - llvmPackages = pkgsBuildBuild.${llvmPackages_attrName}; + llvmPackages = pkgsBuildBuild.rustc.llvmPackages; in overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override { @@ -165,7 +163,7 @@ let ninja pkg-config python3WithPackages perl which - buildPackages.${llvmPackages_attrName}.bintools + buildPackages.rustc.llvmPackages.bintools bison gperf ]; @@ -261,6 +259,14 @@ let # We also need enable_widevine_cdm_component to be false. Unfortunately it isn't exposed as gn # flag (declare_args) so we simply hardcode it to false. ./patches/widevine-disable-auto-download-allow-bundle.patch + ] ++ lib.optionals (versionRange "125" "126") [ + # Fix building M125 with ninja 1.12. Not needed for M126+. + # https://issues.chromium.org/issues/336911498 + # https://chromium-review.googlesource.com/c/chromium/src/+/5487538 + (githubPatch { + commit = "a976cb05b4024b7a6452d1541378d718cdfe33e6"; + hash = "sha256-K2PSeJAvhGH2/Yp63/4mJ85NyqXqDDkMWY+ptrpgmOI="; + }) ] ++ [ # Required to fix the build with a more recent wayland-protocols version # (we currently package 1.26 in Nixpkgs while Chromium bundles 1.21): @@ -269,28 +275,23 @@ let # Chromium reads initial_preferences from its own executable directory # This patch modifies it to read /etc/chromium/initial_preferences ./patches/chromium-initial-prefs.patch - ] ++ lib.optionals (chromiumVersionAtLeast "120") [ - # We need to revert this patch to build M120+ with LLVM 17: + ] ++ lib.optionals (versionRange "120" "126") [ + # Partial revert to build M120+ with LLVM 17: + # https://github.com/chromium/chromium/commit/02b6456643700771597c00741937e22068b0f956 + # https://github.com/chromium/chromium/commit/69736ffe943ff996d4a88d15eb30103a8c854e29 ./patches/chromium-120-llvm-17.patch - ] ++ lib.optionals (!chromiumVersionAtLeast "119.0.6024.0") [ - # Fix build with at-spi2-core ≥ 2.49 - # This version is still needed for electron. - (githubPatch { - commit = "fc09363b2278893790d131c72a4ed96ec9837624"; - hash = "sha256-l60Npgs/+0ozzuKWjwiHUUV6z59ObUjAPTfXN7eXpzw="; - }) - ] ++ lib.optionals (!chromiumVersionAtLeast "121.0.6104.0") [ - # Fix build with at-spi2-core ≥ 2.49 - # https://chromium-review.googlesource.com/c/chromium/src/+/5001687 - (githubPatch { - commit = "b9bef8e9555645fc91fab705bec697214a39dbc1"; - hash = "sha256-CJ1v/qc8+nwaHQR9xsx08EEcuVRbyBfCZCm/G7hRY+4="; - }) - ] ++ lib.optionals (chromiumVersionAtLeast "121") [ + ] ++ lib.optionals (chromiumVersionAtLeast "126") [ + # Rebased variant of patch right above to build M126+ with LLVM 17. + # staging-next will bump LLVM to 18, so we will be able to drop this soon. + ./patches/chromium-126-llvm-17.patch + ] ++ lib.optionals (versionRange "121" "126") [ # M121 is the first version to require the new rust toolchain. # Partial revert of https://github.com/chromium/chromium/commit/3687976b0c6d36cf4157419a24a39f6770098d61 # allowing us to use our rustc and our clang. ./patches/chromium-121-rust.patch + ] ++ lib.optionals (chromiumVersionAtLeast "126") [ + # Rebased variant of patch right above to build M126+ with our rust and our clang. + ./patches/chromium-126-rust.patch ]; postPatch = '' @@ -382,8 +383,8 @@ let llvmCcAndBintools = symlinkJoin { name = "llvmCcAndBintools"; paths = [ - pkgsBuildTarget.${llvmPackages_attrName}.llvm - pkgsBuildTarget.${llvmPackages_attrName}.stdenv.cc + buildPackages.rustc.llvmPackages.llvm + buildPackages.rustc.llvmPackages.stdenv.cc ]; }; @@ -461,10 +462,6 @@ let use_system_libffi = true; # Use nixpkgs Rust compiler instead of the one shipped by Chromium. rust_sysroot_absolute = "${buildPackages.rustc}"; - # 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). @@ -483,10 +480,12 @@ 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") '' + # TODO: Migrate this to env.RUSTC_BOOTSTRAP next mass-rebuild. + # Chromium expects nightly/bleeding edge rustc features to be available. + # Our rustc in nixpkgs follows stable, but since bootstrapping rustc requires + # nightly features too, we can (ab-)use RUSTC_BOOTSTRAP here as well to + # enable those features in our stable builds. + preConfigure = '' export RUSTC_BOOTSTRAP=1 ''; diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index afd25b972d785..095fe13f9197a 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -1,9 +1,9 @@ -{ newScope, config, stdenv, fetchurl, makeWrapper +{ newScope, config, stdenv, makeWrapper , buildPackages , ed, gnugrep, coreutils, xdg-utils , glib, gtk3, gtk4, gnome, gsettings-desktop-schemas, gn, fetchgit , libva, pipewire, wayland -, gcc, nspr, nss, runCommand +, runCommand , lib, libkrb5 , widevine-cdm , electron-source # for warnObsoleteVersionConditional @@ -18,17 +18,12 @@ , cupsSupport ? true , pulseSupport ? config.pulseaudio or stdenv.isLinux , commandLineArgs ? "" -, pkgsBuildTarget , pkgsBuildBuild , pkgs }: let - # Sometimes we access `llvmPackages` via `pkgs`, and other times - # via `pkgsFooBar`, so a string (attrname) is the only way to have - # a single point of control over the LLVM version used. - llvmPackages_attrName = "llvmPackages_17"; - stdenv = pkgs.${llvmPackages_attrName}.stdenv; + stdenv = pkgs.rustc.llvmPackages.stdenv; # Helper functions for changes that depend on specific versions: warnObsoleteVersionConditional = min-version: result: @@ -48,7 +43,7 @@ let callPackage = newScope chromium; chromium = rec { - inherit stdenv llvmPackages_attrName upstream-info; + inherit stdenv upstream-info; mkChromiumDerivation = callPackage ./common.nix ({ inherit channel chromiumVersionAtLeast versionRange; 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 new file mode 100644 index 0000000000000..ea059d884b5a2 --- /dev/null +++ b/pkgs/applications/networking/browsers/chromium/patches/chromium-126-llvm-17.patch @@ -0,0 +1,29 @@ +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-126-rust.patch b/pkgs/applications/networking/browsers/chromium/patches/chromium-126-rust.patch new file mode 100644 index 0000000000000..776655babdd2a --- /dev/null +++ b/pkgs/applications/networking/browsers/chromium/patches/chromium-126-rust.patch @@ -0,0 +1,21 @@ +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index 6efe967eb0a1c..2ddae4efacbfa 100644 +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -1653,16 +1653,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 && toolchain_has_rust) { +- 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/recompress-tarball.nix b/pkgs/applications/networking/browsers/chromium/recompress-tarball.nix index 0e77dd230f657..e663c393d8dc4 100644 --- a/pkgs/applications/networking/browsers/chromium/recompress-tarball.nix +++ b/pkgs/applications/networking/browsers/chromium/recompress-tarball.nix @@ -34,6 +34,7 @@ fetchurl ({ --one-top-level=source \ --exclude=third_party/llvm \ --exclude=third_party/rust-src \ + --exclude='build/linux/debian_*-sysroot' \ --strip-components=1 tar \ diff --git a/pkgs/applications/networking/browsers/chromium/upstream-info.nix b/pkgs/applications/networking/browsers/chromium/upstream-info.nix index feba3721ba636..746cc6d6068bb 100644 --- a/pkgs/applications/networking/browsers/chromium/upstream-info.nix +++ b/pkgs/applications/networking/browsers/chromium/upstream-info.nix @@ -1,37 +1,37 @@ { stable = { chromedriver = { - hash_darwin = "sha256-Zz2U5zQWScID7rAE6FmTADecs4zR430KZVen+hsl+KI="; + hash_darwin = "sha256-OvRkO/mBXOk3IqZtvjKzOsBPBaZzq+YOb//SsXtgB9k="; hash_darwin_aarch64 = - "sha256-NhnJdnrzTj8gQiyp4PzmXHx6ltsxUVrz0AL9x8nGibA="; - hash_linux = "sha256-iyhxx7KIpGPMYgf/I1hLUK8M49kWmgTy+UOXf5WBEWY="; - version = "125.0.6422.141"; + "sha256-ODR4fFW24yh4vIGcWjBVH+mfK+LECU/LXlWVq+NBNlI="; + hash_linux = "sha256-7vWid5i9bOyuGL2v9kdzv2yW2ZqWNNZDQScSDriaxxM="; + version = "126.0.6478.61"; }; deps = { gn = { - hash = "sha256-lrVAb6La+cvuUCNI90O6M/sheOEVFTjgpfA3O/6Odp0="; - rev = "d823fd85da3fb83146f734377da454473b93a2b2"; + hash = "sha256-mNoQeHSSM+rhR0UHrpbyzLJC9vFqfxK1SD0X8GiRsqw="; + rev = "df98b86690c83b81aedc909ded18857296406159"; url = "https://gn.googlesource.com/gn"; - version = "2024-04-10"; + version = "2024-05-13"; }; }; - hash = "sha256-8Qe1hgDEjvdAf2ao4CIieC7l2pTSIPLTZb+vdctUEo0="; - version = "125.0.6422.141"; + hash = "sha256-cB2jrasrtaFWM8tpG9leuC+jUAvoU8g5977cn4r7rbw="; + version = "126.0.6478.61"; }; ungoogled-chromium = { deps = { gn = { - hash = "sha256-lrVAb6La+cvuUCNI90O6M/sheOEVFTjgpfA3O/6Odp0="; - rev = "d823fd85da3fb83146f734377da454473b93a2b2"; + hash = "sha256-mNoQeHSSM+rhR0UHrpbyzLJC9vFqfxK1SD0X8GiRsqw="; + rev = "df98b86690c83b81aedc909ded18857296406159"; url = "https://gn.googlesource.com/gn"; - version = "2024-04-10"; + version = "2024-05-13"; }; ungoogled-patches = { - hash = "sha256-ZYYizL3hFSEQUdDDZIvsEzidq5td+UoaWdertY/pqOc="; - rev = "125.0.6422.141-1"; + hash = "sha256-vQrUQMmNSw+b9nPzP1RmkncQHasmZvnxNHjfiPoMUXo="; + rev = "126.0.6478.61-1"; }; }; - hash = "sha256-8Qe1hgDEjvdAf2ao4CIieC7l2pTSIPLTZb+vdctUEo0="; - version = "125.0.6422.141"; + hash = "sha256-cB2jrasrtaFWM8tpG9leuC+jUAvoU8g5977cn4r7rbw="; + version = "126.0.6478.61"; }; } |