chromium: fix increased build time for non-cross-compilation builds

Having

```nix
host_toolchain = "//build/toolchain/linux/unbundle:host";
v8_snapshot_toolchain = "//build/toolchain/linux/unbundle:host";
```

on native, non-cross-compilation builds roughly doubles the build steps
and, by proxy, compute and time needed to build.

So to resolve this, we conditionally change those values depending on
whether we are cross-compiling or not.

Co-authored-by: Adam Joseph <adam@westernsemico.com>
This commit is contained in:
emilylange 2023-12-10 22:24:41 +01:00 committed by Yureka
parent 0eb389be6e
commit 0ed60bbcd1

View file

@ -387,9 +387,13 @@ let
# depending on which part of the codebase you are in; see:
# https://github.com/chromium/chromium/blob/d36462cc9279464395aea5e65d0893d76444a296/build/config/BUILDCONFIG.gn#L17-L44
custom_toolchain = "//build/toolchain/linux/unbundle:default";
host_toolchain = "//build/toolchain/linux/unbundle:default";
# We only build those specific toolchains when we cross-compile, as native non-cross-compilations would otherwise
# end up building much more things than they need to (roughtly double the build steps and time/compute):
} // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
host_toolchain = "//build/toolchain/linux/unbundle:host";
v8_snapshot_toolchain = "//build/toolchain/linux/unbundle:host";
} // {
host_pkg_config = "${pkgsBuildBuild.pkg-config}/bin/pkg-config";
pkg_config = "${pkgsBuildHost.pkg-config}/bin/${stdenv.cc.targetPrefix}pkg-config";