Merge pull request #124183 from primeos/chromium-backport

[20.09] chromiumBeta: Backport patches to fix the build
This commit is contained in:
Michael Weiss
2021-05-24 14:52:22 +02:00
committed by GitHub
2 changed files with 46 additions and 38 deletions

View File

@@ -7,7 +7,7 @@
, xdg_utils, yasm, nasm, minizip, libwebp
, libusb1, pciutils, nss, re2
, python2Packages, perl, pkgconfig
, python2, python3, perl, pkgconfig
, nspr, systemd, kerberos
, utillinux, alsaLib
, bison, gperf
@@ -20,6 +20,7 @@
, pipewire
, libva
, libdrm, wayland, mesa, libxkbcommon # Ozone
, curl
# optional dependencies
, libgcrypt ? null # gnomeSupport || cupsSupport
@@ -42,6 +43,12 @@ with stdenv.lib;
let
jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
python2WithPackages = python2.withPackages(ps: with ps; [
ply jinja2 setuptools
]);
python3WithPackages = python3.withPackages(ps: with ps; [
ply jinja2 setuptools
]);
# The additional attributes for creating derivations based on the chromium
# source tree.
@@ -100,16 +107,19 @@ let
buildPath = "out/${buildType}";
libExecPath = "$out/libexec/${packageName}";
warnObsoleteVersionConditional = min-version: result:
let ungoogled-version = (importJSON ./upstream-info.json).ungoogled-chromium.version;
in if versionAtLeast ungoogled-version min-version
then warn "chromium: ungoogled version ${ungoogled-version} is newer than a conditional bounded at ${min-version}. You can safely delete it."
result
else result;
chromiumVersionAtLeast = min-version:
versionAtLeast upstream-info.version min-version;
let result = versionAtLeast upstream-info.version min-version;
in warnObsoleteVersionConditional min-version result;
versionRange = min-version: upto-version:
let inherit (upstream-info) version;
result = versionAtLeast version min-version && versionOlder version upto-version;
ungoogled-version = (importJSON ./upstream-info.json).ungoogled-chromium.version;
in if versionAtLeast ungoogled-version upto-version
then warn "chromium: ungoogled version ${ungoogled-version} is newer than a patchset bounded at ${upto-version}. You can safely delete it."
result
else result;
in warnObsoleteVersionConditional upto-version result;
ungoogler = ungoogled-chromium {
inherit (upstream-info.deps.ungoogled-patches) rev sha256;
@@ -126,10 +136,12 @@ let
};
nativeBuildInputs = [
ninja pkgconfig
python2WithPackages perl nodejs
gnutar which
llvmPackages.lldClang.bintools
ninja which python2Packages.python perl pkgconfig
python2Packages.ply python2Packages.jinja2 nodejs
gnutar python2Packages.setuptools
] ++ lib.optionals (chromiumVersionAtLeast "92") [
python3WithPackages
];
buildInputs = defaultDependencies ++ [
@@ -143,6 +155,7 @@ let
pipewire
libva
libdrm wayland mesa.drivers libxkbcommon
curl
] ++ optional gnomeKeyringSupport libgnome-keyring3
++ optionals gnomeSupport [ gnome.GConf libgcrypt ]
++ optionals cupsSupport [ libgcrypt cups ]
@@ -151,18 +164,16 @@ let
patches = [
./patches/no-build-timestamps.patch # Optional patch to use SOURCE_DATE_EPOCH in compute_build_timestamp.py (should be upstreamed)
./patches/widevine-79.patch # For bundling Widevine (DRM), might be replaceable via bundle_widevine_cdm=true in gnFlags
] ++ optional (chromiumVersionAtLeast "90")
# Fix the build by adding a missing dependency (s. https://crbug.com/1197837):
./patches/fix-missing-atspi2-dependency.patch
++ optionals (chromiumVersionAtLeast "91") [
] ++ optionals (chromiumVersionAtLeast "91") [
./patches/closure_compiler-Use-the-Java-binary-from-the-system.patch
(githubPatch
# Revert "Reland #7 of "Force Python 3 to be used in build.""
"38b6a9a8e5901766613879b6976f207aa163588a"
"1lvxbd7rl6hz5j6kh6q83yb6vd9g7anlqbai8g1w1bp6wdpgwvp9"
)
];
postPatch = ''
postPatch = lib.optionalString (chromiumVersionAtLeast "91") ''
# Required for patchShebangs (unsupported):
chmod -x third_party/webgpu-cts/src/tools/deno
'' + ''
# remove unused third-party
for lib in ${toString gnSystemLibraries}; do
if [ -d "third_party/$lib" ]; then
@@ -266,12 +277,9 @@ let
} // optionalAttrs pulseSupport {
use_pulseaudio = true;
link_pulseaudio = true;
} // optionalAttrs (chromiumVersionAtLeast "89") {
rtc_pipewire_version = "0.3"; # TODO: Can be removed once ungoogled-chromium is at M90
# Disable PGO (defaults to 2 since M89) because it fails without additional changes:
# error: Could not read profile ../../chrome/build/pgo_profiles/chrome-linux-master-1610647094-405a32bcf15e5a84949640f99f84a5b9f61e2f2e.profdata: Unsupported instrumentation profile format version
chrome_pgo_phase = 0;
} // optionalAttrs (chromiumVersionAtLeast "90") {
# Disable build with TFLite library because it fails without additional changes:
# ninja: error: '../../chrome/test/data/simple_test.tflite', needed by 'test_data/simple_test.tflite', missing and no known rule to make it
# Note: chrome/test/data/simple_test.tflite is in the Git repository but not in chromium-90.0.4400.8.tar.xz
@@ -302,7 +310,7 @@ let
# This is to ensure expansion of $out.
libExecPath="${libExecPath}"
python build/linux/unbundle/replace_gn_files.py --system-libraries ${toString gnSystemLibraries}
${python2}/bin/python2 build/linux/unbundle/replace_gn_files.py --system-libraries ${toString gnSystemLibraries}
${gnChromium}/bin/gn gen --args=${escapeShellArg gnFlags} out/Release | tee gn-gen-outputs.txt
# Fail if `gn gen` contains a WARNING.

View File

@@ -18,22 +18,9 @@
}
},
"beta": {
"version": "90.0.4430.72",
"sha256": "0hw916j55lm3qnidfp92i8w6zywdd47rhihn9pn23b7ziz58ik55",
"sha256bin64": "1ddj2pk4m26dpl1ja0r56fvm67c1z1hq5rq5an8px6ixy78s2760",
"deps": {
"gn": {
"version": "2021-02-09",
"url": "https://gn.googlesource.com/gn",
"rev": "dfcbc6fed0a8352696f92d67ccad54048ad182b3",
"sha256": "1941bzg37c4dpsk3sh6ga3696gpq6vjzpcw9rsnf6kdr9mcgdxvn"
}
}
},
"dev": {
"version": "91.0.4469.4",
"sha256": "08lffqjfcszniwwshililab553a0dvycaa72h1dklxvxf360nz5f",
"sha256bin64": "14xyzjwzcyp6idscq6i87yh2fibjamkz5xfsb2y0hrf2diaqijw1",
"version": "91.0.4472.69",
"sha256": "0yqc7py5x48wqg5x90j57vp07qfc20w1j0f30rmyxbgl6v346s0z",
"sha256bin64": "1z82i6pq4wbx44d6ij32dkappywdpaxlfp23kl3p7x4x9hv1c0yq",
"deps": {
"gn": {
"version": "2021-04-06",
@@ -43,6 +30,19 @@
}
}
},
"dev": {
"version": "92.0.4512.4",
"sha256": "0ycwr11bz2hlzczs6cajxn5k32m44ndhmqh86iykcbi982dj7jq2",
"sha256bin64": "0wv29rghcbin725qbl8cq20j8w5mlcjmjaqdcr73m753dv3jv8rq",
"deps": {
"gn": {
"version": "2021-05-07",
"url": "https://gn.googlesource.com/gn",
"rev": "39a87c0b36310bdf06b692c098f199a0d97fc810",
"sha256": "0x63jr5hssm9dl6la4q5ahy669k4gxvbapqxi5w32vv107jrj8v4"
}
}
},
"ungoogled-chromium": {
"version": "90.0.4430.212",
"sha256": "17nmhrkl81qqvzbh861k2mmifncx4wg1mv1fmn52f8gzn461vqdb",