@@ -1,4 +1,4 @@
1−{ stdenv, gn, ninja, which, nodejs, fetchurl, fetchpatch, gnutar
1+{ stdenv, llvmPackages, gn, ninja, which, nodejs, fetchurl, fetchpatch, gnutar
22
33# default dependencies
44, bzip2, flac, speex, libopus
@@ -130,14 +130,16 @@ let
130130 patches = optional enableWideVine ./patches/widevine.patch ++ [
131131 ./patches/nix_plugin_paths_68.patch
132132 ./patches/remove-webp-include-69.patch
133+
133134 # Unfortunately, chromium regularly breaks on major updates and
134− # then needs various patches backported. Good sources for such patches and other hints:
135+ # then needs various patches backported in order to be compiled with GCC.
136+ # Good sources for such patches and other hints:
135137 # - https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/
136138 # - https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/chromium
137139 # - https://github.com/chromium/chromium/search?q=GCC&s=committer-date&type=Commits
138140 #
139141 # ++ optional (versionRange "68" "72") ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" )
140− ] ++ optionals (versionOlder version "71") [
142+ ] ++ optionals (!stdenv.cc.isClang && (versionRange "70" "71")) [
141143 ( githubPatch "cbdb8bd6567c8143dc8c1e5e86a21a8ea064eea4" "0258qlffp6f6izswczb11p8zdpn550z5yqa9z7gdg2rg5171n5i8" )
142144 ( githubPatch "e98f8ef8b2f236ecbb01df8c39e6ee1c8fbe8d7d" "1ky5xrzch6aya87kn0bgb31lksl3g8kh2v8k676ks7pdl2v132p9" )
143145 ( githubPatch "a4de8da116585357c123d71e5f54d1103824c6df" "1y7afnjrsz6j2l3vy1ms8mrkbb51xhcafw9r371algi48il7rajm" )
@@ -159,7 +161,7 @@ let
159161 sha256 = "018fbdzyw9rvia8m0qkk5gv8q8gl7x34rrjbn7mi1fgxdsayn22s";
160162 }
161163 );
162−
164+
163165 postPatch = ''
164166 # We want to be able to specify where the sandbox is via CHROME_DEVEL_SANDBOX
165167 substituteInPlace sandbox/linux/suid/client/setuid_sandbox_host.cc \
@@ -207,10 +209,16 @@ let
207209 '' + optionalString stdenv.isAarch64 ''
208210 substituteInPlace build/toolchain/linux/BUILD.gn \
209211 --replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""'
212+ '' + optionalString stdenv.cc.isClang ''
213+ mkdir -p third_party/llvm-build/Release+Asserts/bin
214+ ln -s ${stdenv.cc}/bin/clang third_party/llvm-build/Release+Asserts/bin/clang
215+ ln -s ${stdenv.cc}/bin/clang++ third_party/llvm-build/Release+Asserts/bin/clang++
216+ ln -s ${llvmPackages.llvm}/bin/llvm-ar third_party/llvm-build/Release+Asserts/bin/llvm-ar
210217 '';
211218
212219 gnFlags = mkGnFlags ({
213220 linux_use_bundled_binutils = false;
221+ use_lld = false;
214222 use_gold = true;
215223 gold_path = "${stdenv.cc}/bin";
216224 is_debug = false;
@@ -224,7 +232,7 @@ let
224232 use_cups = cupsSupport;
225233
226234 treat_warnings_as_errors = false;
227− is_clang = false;
235+ is_clang = stdenv.cc.isClang;
228236 clang_use_chrome_plugins = false;
229237 remove_webcore_debug_symbols = true;
230238 enable_swiftshader = false;