chromium: build with clang

This commit is contained in:
volth 2018-10-24 21:25:36 +00:00 committed by Herwig Hochleitner
parent 0b9a859733
commit d2daf0dd6f
3 changed files with 25 additions and 10 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, gn, ninja, which, nodejs, fetchurl, fetchpatch, gnutar
{ stdenv, llvmPackages, gn, ninja, which, nodejs, fetchurl, fetchpatch, gnutar
# default dependencies
, bzip2, flac, speex, libopus
@ -130,14 +130,16 @@ let
patches = optional enableWideVine ./patches/widevine.patch ++ [
./patches/nix_plugin_paths_68.patch
./patches/remove-webp-include-69.patch
# Unfortunately, chromium regularly breaks on major updates and
# then needs various patches backported. Good sources for such patches and other hints:
# then needs various patches backported in order to be compiled with GCC.
# Good sources for such patches and other hints:
# - https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/
# - https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/chromium
# - https://github.com/chromium/chromium/search?q=GCC&s=committer-date&type=Commits
#
# ++ optional (versionRange "68" "72") ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" )
] ++ optionals (versionOlder version "71") [
] ++ optionals (!stdenv.cc.isClang && (versionRange "70" "71")) [
( githubPatch "cbdb8bd6567c8143dc8c1e5e86a21a8ea064eea4" "0258qlffp6f6izswczb11p8zdpn550z5yqa9z7gdg2rg5171n5i8" )
( githubPatch "e98f8ef8b2f236ecbb01df8c39e6ee1c8fbe8d7d" "1ky5xrzch6aya87kn0bgb31lksl3g8kh2v8k676ks7pdl2v132p9" )
( githubPatch "a4de8da116585357c123d71e5f54d1103824c6df" "1y7afnjrsz6j2l3vy1ms8mrkbb51xhcafw9r371algi48il7rajm" )
@ -207,10 +209,16 @@ let
'' + optionalString stdenv.isAarch64 ''
substituteInPlace build/toolchain/linux/BUILD.gn \
--replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""'
'' + optionalString stdenv.cc.isClang ''
mkdir -p third_party/llvm-build/Release+Asserts/bin
ln -s ${stdenv.cc}/bin/clang third_party/llvm-build/Release+Asserts/bin/clang
ln -s ${stdenv.cc}/bin/clang++ third_party/llvm-build/Release+Asserts/bin/clang++
ln -s ${llvmPackages.llvm}/bin/llvm-ar third_party/llvm-build/Release+Asserts/bin/llvm-ar
'';
gnFlags = mkGnFlags ({
linux_use_bundled_binutils = false;
use_lld = false;
use_gold = true;
gold_path = "${stdenv.cc}/bin";
is_debug = false;
@ -224,7 +232,7 @@ let
use_cups = cupsSupport;
treat_warnings_as_errors = false;
is_clang = false;
is_clang = stdenv.cc.isClang;
clang_use_chrome_plugins = false;
remove_webcore_debug_symbols = true;
enable_swiftshader = false;

View file

@ -1,4 +1,4 @@
{ newScope, stdenv, makeWrapper, makeDesktopItem, ed
{ newScope, stdenv, llvmPackages, makeWrapper, makeDesktopItem, ed
, glib, gtk3, gnome3, gsettings-desktop-schemas
# package customization
@ -14,11 +14,12 @@
, commandLineArgs ? ""
}:
assert stdenv.cc.isClang -> (stdenv == llvmPackages.stdenv);
let
callPackage = newScope chromium;
chromium = {
inherit stdenv;
inherit stdenv llvmPackages;
upstream-info = (callPackage ./update.nix {}).getChannel channel;

View file

@ -16016,13 +16016,19 @@ with pkgs;
bookworm = callPackage ../applications/office/bookworm { };
chromium = callPackage ../applications/networking/browsers/chromium {
chromium = callPackage ../applications/networking/browsers/chromium ({
channel = "stable";
pulseSupport = config.pulseaudio or true;
enablePepperFlash = config.chromium.enablePepperFlash or false;
enableWideVine = config.chromium.enableWideVine or false;
gnome = gnome2;
};
} // (if stdenv.isAarch64 then {
stdenv = gcc8Stdenv;
} else {
llvmPackages = llvmPackages_7;
stdenv = llvmPackages_7.stdenv;
})
);
chronos = callPackage ../applications/networking/cluster/chronos { };