chromium: control llvmPackages version selection with a string

Sometimes we access `llvmPackages` via `pkgs`, and other times via
`pkgsFooBar`, so unfortunately a string (attrname) is the only way
to have a single point of control over the LLVM version used for
both buildPlatform and hostPlatform.
This commit is contained in:
Adam Joseph 2023-04-23 16:01:56 -07:00
parent 53af611dd2
commit 5f3c644b1a
2 changed files with 13 additions and 6 deletions

View file

@ -1,4 +1,7 @@
{ stdenv, lib, fetchurl, fetchpatch
, buildPackages
, pkgsBuildBuild
, pkgsBuildTarget
# Channel data:
, channel, upstream-info
# Helper functions:
@ -8,7 +11,7 @@
, ninja, pkg-config
, python3, perl
, which
, llvmPackages
, llvmPackages_attrName
, rustc
# postPatch:
, pkgsBuildHost
@ -130,7 +133,7 @@ let
ninja pkg-config
python3WithPackages perl
which
llvmPackages.bintools
buildPackages.${llvmPackages_attrName}.bintools
bison gperf
];
@ -308,7 +311,7 @@ let
rtc_use_pipewire = true;
# Disable PGO because the profile data requires a newer compiler version (LLVM 14 isn't sufficient):
chrome_pgo_phase = 0;
clang_base_path = "${llvmPackages.stdenv.cc}";
clang_base_path = "${pkgsBuildTarget.${llvmPackages_attrName}.stdenv.cc}";
use_qt = false;
# To fix the build as we don't provide libffi_pic.a
# (ld.lld: error: unable to find library -l:libffi_pic.a):

View file

@ -18,11 +18,15 @@
, commandLineArgs ? ""
, pkgsBuildTarget
, pkgsBuildBuild
, pkgs
}:
let
llvmPackages = pkgsBuildTarget.llvmPackages_16;
stdenv = llvmPackages.stdenv;
# 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_16";
stdenv = pkgs.${llvmPackages_attrName}.stdenv;
upstream-info = (lib.importJSON ./upstream-info.json).${channel};
@ -44,7 +48,7 @@ let
callPackage = newScope chromium;
chromium = rec {
inherit stdenv llvmPackages upstream-info;
inherit stdenv llvmPackages_attrName upstream-info;
mkChromiumDerivation = callPackage ./common.nix ({
inherit channel chromiumVersionAtLeast versionRange;