2019-11-06 19:37:25 +00:00
|
|
|
{ stdenv, lib, llvmPackages, gnChromium, ninja, which, nodejs, fetchpatch, fetchurl
|
2014-04-01 06:36:26 +01:00
|
|
|
|
|
|
|
# default dependencies
|
2019-11-06 19:37:25 +00:00
|
|
|
, gnutar, bzip2, flac, speex, libopus
|
2014-04-01 06:36:26 +01:00
|
|
|
, libevent, expat, libjpeg, snappy
|
2017-06-11 09:10:56 +01:00
|
|
|
, libpng, libcap
|
2020-06-06 17:43:04 +01:00
|
|
|
, xdg_utils, yasm, nasm, minizip, libwebp
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
, libusb1, pciutils, nss, re2
|
2014-04-01 06:36:26 +01:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
, python2Packages, perl, pkg-config
|
2016-09-05 17:59:00 +01:00
|
|
|
, nspr, systemd, kerberos
|
2020-11-24 15:29:28 +00:00
|
|
|
, util-linux, alsaLib
|
2014-08-13 03:53:31 +01:00
|
|
|
, bison, gperf
|
2018-10-04 19:01:26 +01:00
|
|
|
, glib, gtk3, dbus-glib
|
2019-01-30 22:55:20 +00:00
|
|
|
, glibc
|
2020-12-24 11:17:35 +00:00
|
|
|
, libXScrnSaver, libXcursor, libXtst, libxshmfence, libGLU, libGL
|
2014-12-07 13:52:36 +00:00
|
|
|
, protobuf, speechd, libXdamage, cups
|
2020-10-09 22:29:16 +01:00
|
|
|
, ffmpeg, libxslt, libxml2, at-spi2-core
|
2020-09-19 12:41:44 +01:00
|
|
|
, jre8
|
2020-06-05 20:52:41 +01:00
|
|
|
, pipewire_0_2
|
2020-11-27 12:49:04 +00:00
|
|
|
, libva
|
2014-04-01 06:36:26 +01:00
|
|
|
|
|
|
|
# optional dependencies
|
|
|
|
, libgcrypt ? null # gnomeSupport || cupsSupport
|
2020-10-15 15:22:14 +01:00
|
|
|
, libdrm ? null, wayland ? null, mesa ? null, libxkbcommon ? null # useOzone
|
2014-04-01 06:36:26 +01:00
|
|
|
|
|
|
|
# package customization
|
2020-11-27 12:49:04 +00:00
|
|
|
, useOzone ? true
|
2014-04-01 06:36:26 +01:00
|
|
|
, gnomeSupport ? false, gnome ? null
|
2018-02-25 02:23:58 +00:00
|
|
|
, gnomeKeyringSupport ? false, libgnome-keyring3 ? null
|
2014-04-01 06:36:26 +01:00
|
|
|
, proprietaryCodecs ? true
|
2014-12-07 13:52:36 +00:00
|
|
|
, cupsSupport ? true
|
2015-05-27 20:42:15 +01:00
|
|
|
, pulseSupport ? false, libpulseaudio ? null
|
2020-12-09 18:13:26 +00:00
|
|
|
, ungoogled ? false, ungoogled-chromium
|
2014-04-01 06:36:26 +01:00
|
|
|
|
2019-11-06 19:37:25 +00:00
|
|
|
, channel
|
2016-03-20 16:50:17 +00:00
|
|
|
, upstream-info
|
2014-04-01 06:36:26 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildFun:
|
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
with lib;
|
2014-04-01 06:36:26 +01:00
|
|
|
|
|
|
|
let
|
2020-09-19 12:41:44 +01:00
|
|
|
jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
|
|
|
|
|
2014-04-01 06:36:26 +01:00
|
|
|
# The additional attributes for creating derivations based on the chromium
|
|
|
|
# source tree.
|
|
|
|
extraAttrs = buildFun base;
|
|
|
|
|
2018-02-26 23:04:33 +00:00
|
|
|
githubPatch = commit: sha256: fetchpatch {
|
|
|
|
url = "https://github.com/chromium/chromium/commit/${commit}.patch";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
2018-01-09 01:11:02 +00:00
|
|
|
|
2016-10-29 03:05:53 +01:00
|
|
|
mkGnFlags =
|
2014-04-01 06:36:26 +01:00
|
|
|
let
|
2016-10-29 03:05:53 +01:00
|
|
|
# Serialize Nix types into GN types according to this document:
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
# https://source.chromium.org/gn/gn/+/master:docs/language.md
|
2016-10-29 03:05:53 +01:00
|
|
|
mkGnString = value: "\"${escape ["\"" "$" "\\"] value}\"";
|
2014-04-01 06:36:26 +01:00
|
|
|
sanitize = value:
|
2016-10-29 03:05:53 +01:00
|
|
|
if value == true then "true"
|
|
|
|
else if value == false then "false"
|
|
|
|
else if isList value then "[${concatMapStringsSep ", " sanitize value}]"
|
|
|
|
else if isInt value then toString value
|
|
|
|
else if isString value then mkGnString value
|
|
|
|
else throw "Unsupported type for GN value `${value}'.";
|
|
|
|
toFlag = key: value: "${key}=${sanitize value}";
|
2014-04-01 06:36:26 +01:00
|
|
|
in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs));
|
|
|
|
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
# https://source.chromium.org/chromium/chromium/src/+/master:build/linux/unbundle/replace_gn_files.py
|
2016-10-29 03:05:53 +01:00
|
|
|
gnSystemLibraries = [
|
2020-10-09 22:29:16 +01:00
|
|
|
"ffmpeg"
|
|
|
|
"flac"
|
|
|
|
"libjpeg"
|
|
|
|
"libpng"
|
|
|
|
"libwebp"
|
|
|
|
"libxslt"
|
|
|
|
"opus"
|
|
|
|
"snappy"
|
|
|
|
"zlib"
|
2020-07-14 21:52:15 +01:00
|
|
|
];
|
2014-04-01 06:36:26 +01:00
|
|
|
|
|
|
|
opusWithCustomModes = libopus.override {
|
2014-07-28 04:05:01 +01:00
|
|
|
withCustomModes = true;
|
2014-04-01 06:36:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
defaultDependencies = [
|
2015-06-11 17:23:58 +01:00
|
|
|
bzip2 flac speex opusWithCustomModes
|
2014-04-01 06:36:26 +01:00
|
|
|
libevent expat libjpeg snappy
|
2017-06-11 09:10:56 +01:00
|
|
|
libpng libcap
|
2020-06-06 17:43:04 +01:00
|
|
|
xdg_utils minizip libwebp
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
libusb1 re2
|
2020-10-09 22:29:16 +01:00
|
|
|
ffmpeg libxslt libxml2
|
2020-07-14 21:52:15 +01:00
|
|
|
nasm
|
|
|
|
];
|
2014-04-01 06:36:26 +01:00
|
|
|
|
|
|
|
# build paths and release info
|
2014-04-20 07:39:40 +01:00
|
|
|
packageName = extraAttrs.packageName or extraAttrs.name;
|
2014-04-01 06:36:26 +01:00
|
|
|
buildType = "Release";
|
|
|
|
buildPath = "out/${buildType}";
|
|
|
|
libExecPath = "$out/libexec/${packageName}";
|
|
|
|
|
2019-10-11 21:55:11 +01:00
|
|
|
versionRange = min-version: upto-version:
|
|
|
|
let inherit (upstream-info) version;
|
|
|
|
result = versionAtLeast version min-version && versionOlder version upto-version;
|
2019-11-06 19:37:25 +00:00
|
|
|
stable-version = (importJSON ./upstream-info.json).stable.version;
|
2019-10-11 21:55:11 +01:00
|
|
|
in if versionAtLeast stable-version upto-version
|
|
|
|
then warn "chromium: stable version ${stable-version} is newer than a patchset bounded at ${upto-version}. You can safely delete it."
|
|
|
|
result
|
|
|
|
else result;
|
|
|
|
|
2020-12-09 18:29:31 +00:00
|
|
|
ungoogler = ungoogled-chromium {
|
|
|
|
inherit (upstream-info.deps.ungoogled-patches) rev sha256;
|
|
|
|
};
|
|
|
|
|
2014-04-01 06:36:26 +01:00
|
|
|
base = rec {
|
2018-11-18 00:51:12 +00:00
|
|
|
name = "${packageName}-unwrapped-${version}";
|
2019-11-06 19:37:25 +00:00
|
|
|
inherit (upstream-info) version;
|
2021-01-22 11:19:27 +00:00
|
|
|
inherit packageName buildType buildPath;
|
2016-03-20 16:50:17 +00:00
|
|
|
|
2019-11-06 19:37:25 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${version}.tar.xz";
|
|
|
|
inherit (upstream-info) sha256;
|
|
|
|
};
|
2016-03-20 16:50:17 +00:00
|
|
|
|
2017-02-08 19:47:07 +00:00
|
|
|
nativeBuildInputs = [
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
llvmPackages.lldClang.bintools
|
2021-01-19 06:50:56 +00:00
|
|
|
ninja which python2Packages.python perl pkg-config
|
2017-05-14 14:03:21 +01:00
|
|
|
python2Packages.ply python2Packages.jinja2 nodejs
|
2020-07-14 21:52:15 +01:00
|
|
|
gnutar python2Packages.setuptools
|
|
|
|
];
|
2017-02-08 19:47:07 +00:00
|
|
|
|
2014-04-01 06:36:26 +01:00
|
|
|
buildInputs = defaultDependencies ++ [
|
2016-09-05 17:59:00 +01:00
|
|
|
nspr nss systemd
|
2020-11-24 15:29:28 +00:00
|
|
|
util-linux alsaLib
|
2014-12-30 08:05:12 +00:00
|
|
|
bison gperf kerberos
|
2018-10-04 19:01:26 +01:00
|
|
|
glib gtk3 dbus-glib
|
2020-12-24 11:17:35 +00:00
|
|
|
libXScrnSaver libXcursor libXtst libxshmfence libGLU libGL
|
2018-12-09 03:00:42 +00:00
|
|
|
pciutils protobuf speechd libXdamage at-spi2-core
|
2019-12-10 12:12:58 +00:00
|
|
|
jre
|
2020-06-05 20:52:41 +01:00
|
|
|
pipewire_0_2
|
2020-11-27 12:49:04 +00:00
|
|
|
libva
|
|
|
|
] ++ optional gnomeKeyringSupport libgnome-keyring3
|
2014-04-01 06:36:26 +01:00
|
|
|
++ optionals gnomeSupport [ gnome.GConf libgcrypt ]
|
2014-12-07 13:52:36 +00:00
|
|
|
++ optionals cupsSupport [ libgcrypt cups ]
|
2020-02-04 21:08:31 +00:00
|
|
|
++ optional pulseSupport libpulseaudio
|
2020-10-15 15:22:14 +01:00
|
|
|
++ optionals useOzone [ libdrm wayland mesa.drivers libxkbcommon ];
|
2014-04-01 06:36:26 +01:00
|
|
|
|
2020-10-07 12:39:57 +01:00
|
|
|
patches = [
|
2020-10-20 11:59:55 +01:00
|
|
|
./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
|
2019-10-11 21:55:11 +01:00
|
|
|
# ++ optional (versionRange "68" "72") ( githubPatch "<patch>" "0000000000000000000000000000000000000000000000000000000000000000" )
|
2020-10-09 12:46:15 +01:00
|
|
|
];
|
2018-10-24 22:25:36 +01:00
|
|
|
|
2020-10-07 12:39:57 +01:00
|
|
|
postPatch = ''
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
# remove unused third-party
|
|
|
|
for lib in ${toString gnSystemLibraries}; do
|
|
|
|
if [ -d "third_party/$lib" ]; then
|
|
|
|
find "third_party/$lib" -type f \
|
|
|
|
\! -path "third_party/$lib/chromium/*" \
|
|
|
|
\! -path "third_party/$lib/google/*" \
|
|
|
|
\! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
|
|
|
|
\! -regex '.*\.\(gn\|gni\|isolate\)' \
|
|
|
|
-delete
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-08-26 13:22:31 +01:00
|
|
|
# Required for patchShebangs (unsupported interpreter directive, basename: invalid option -- '*', etc.):
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
substituteInPlace native_client/SConstruct --replace "#! -*- python -*-" ""
|
|
|
|
if [ -e third_party/harfbuzz-ng/src/src/update-unicode-tables.make ]; then
|
|
|
|
substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \
|
|
|
|
--replace "/usr/bin/env -S make -f" "/usr/bin/make -f"
|
|
|
|
fi
|
2020-10-07 12:39:57 +01:00
|
|
|
|
2016-08-04 20:26:05 +01:00
|
|
|
# We want to be able to specify where the sandbox is via CHROME_DEVEL_SANDBOX
|
|
|
|
substituteInPlace sandbox/linux/suid/client/setuid_sandbox_host.cc \
|
|
|
|
--replace \
|
2016-08-05 10:55:48 +01:00
|
|
|
'return sandbox_binary;' \
|
|
|
|
'return base::FilePath(GetDevelSandboxPath());'
|
2016-08-04 20:26:05 +01:00
|
|
|
|
2019-01-30 22:55:20 +00:00
|
|
|
substituteInPlace services/audio/audio_sandbox_hook_linux.cc \
|
|
|
|
--replace \
|
|
|
|
'/usr/share/alsa/' \
|
|
|
|
'${alsaLib}/share/alsa/' \
|
|
|
|
--replace \
|
|
|
|
'/usr/lib/x86_64-linux-gnu/gconv/' \
|
|
|
|
'${glibc}/lib/gconv/' \
|
|
|
|
--replace \
|
|
|
|
'/usr/share/locale/' \
|
|
|
|
'${glibc}/share/locale/'
|
|
|
|
|
2017-03-07 10:10:58 +00:00
|
|
|
sed -i -e 's@"\(#!\)\?.*xdg-@"\1${xdg_utils}/bin/xdg-@' \
|
|
|
|
chrome/browser/shell_integration_linux.cc
|
|
|
|
|
2020-08-12 19:12:16 +01:00
|
|
|
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \
|
2015-01-23 00:48:56 +00:00
|
|
|
device/udev_linux/udev?_loader.cc
|
|
|
|
|
|
|
|
sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
|
|
|
|
gpu/config/gpu_info_collector_linux.cc
|
2016-05-28 18:04:22 +01:00
|
|
|
|
2017-06-18 03:29:22 +01:00
|
|
|
# Allow to put extensions into the system-path.
|
|
|
|
sed -i -e 's,/usr,/run/current-system/sw,' chrome/common/chrome_paths.cc
|
|
|
|
|
2016-10-29 03:05:53 +01:00
|
|
|
patchShebangs .
|
2017-05-14 14:03:21 +01:00
|
|
|
# use our own nodejs
|
|
|
|
mkdir -p third_party/node/linux/node-linux-x64/bin
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
ln -s "$(command -v node)" third_party/node/linux/node-linux-x64/bin/node
|
|
|
|
|
|
|
|
# Allow building against system libraries in official builds
|
|
|
|
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' tools/generate_shim_headers/generate_shim_headers.py
|
2017-07-06 23:54:10 +01:00
|
|
|
|
2018-01-21 13:31:54 +00:00
|
|
|
'' + optionalString stdenv.isAarch64 ''
|
|
|
|
substituteInPlace build/toolchain/linux/BUILD.gn \
|
|
|
|
--replace 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""'
|
2020-12-09 18:13:26 +00:00
|
|
|
'' + optionalString ungoogled ''
|
|
|
|
${ungoogler}/utils/prune_binaries.py . ${ungoogler}/pruning.list || echo "some errors"
|
|
|
|
${ungoogler}/utils/patches.py . ${ungoogler}/patches
|
|
|
|
${ungoogler}/utils/domain_substitution.py apply -r ${ungoogler}/domain_regex.list -f ${ungoogler}/domain_substitution.list -c ./ungoogled-domsubcache.tar.gz .
|
2014-04-01 06:36:26 +01:00
|
|
|
'';
|
|
|
|
|
2020-07-14 21:52:15 +01:00
|
|
|
gnFlags = mkGnFlags ({
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
custom_toolchain = "//build/toolchain/linux/unbundle:default";
|
|
|
|
host_toolchain = "//build/toolchain/linux/unbundle:default";
|
|
|
|
is_official_build = true;
|
2016-03-28 10:31:21 +01:00
|
|
|
|
2020-11-28 16:35:17 +00:00
|
|
|
use_vaapi = !stdenv.isAarch64; # TODO: Remove once M88 is released
|
2015-12-29 18:32:30 +00:00
|
|
|
use_sysroot = false;
|
2014-04-01 06:36:26 +01:00
|
|
|
use_gnome_keyring = gnomeKeyringSupport;
|
|
|
|
use_gio = gnomeSupport;
|
2019-12-14 18:07:28 +00:00
|
|
|
# ninja: error: '../../native_client/toolchain/linux_x86/pnacl_newlib/bin/x86_64-nacl-objcopy',
|
|
|
|
# needed by 'nacl_irt_x86_64.nexe', missing and no known rule to make it
|
|
|
|
enable_nacl = false;
|
2019-12-14 18:52:43 +00:00
|
|
|
# Enabling the Widevine component here doesn't affect whether we can
|
|
|
|
# redistribute the chromium package; the Widevine component is either
|
|
|
|
# added later in the wrapped -wv build or downloaded from Google.
|
2019-08-11 00:09:55 +01:00
|
|
|
enable_widevine = true;
|
2014-04-01 06:36:26 +01:00
|
|
|
use_cups = cupsSupport;
|
2020-06-05 20:52:41 +01:00
|
|
|
# Provides the enable-webrtc-pipewire-capturer flag to support Wayland screen capture.
|
|
|
|
rtc_use_pipewire = true;
|
2017-07-31 09:01:15 +01:00
|
|
|
|
2016-10-29 03:05:53 +01:00
|
|
|
treat_warnings_as_errors = false;
|
2017-07-31 09:01:15 +01:00
|
|
|
clang_use_chrome_plugins = false;
|
2019-06-05 10:06:03 +01:00
|
|
|
blink_symbol_level = 0;
|
2020-10-09 22:24:20 +01:00
|
|
|
symbol_level = 0;
|
2017-07-31 09:01:15 +01:00
|
|
|
fieldtrial_testing_like_official_build = true;
|
2014-04-01 06:36:26 +01:00
|
|
|
|
2014-04-19 14:25:21 +01:00
|
|
|
# Google API keys, see:
|
|
|
|
# http://www.chromium.org/developers/how-tos/api-keys
|
2014-04-01 06:36:26 +01:00
|
|
|
# Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
|
|
|
|
# please get your own set of keys.
|
|
|
|
google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI";
|
|
|
|
google_default_client_id = "404761575300.apps.googleusercontent.com";
|
|
|
|
google_default_client_secret = "9rIFQjfnkykEmqb6FfjJQD1D";
|
|
|
|
} // optionalAttrs proprietaryCodecs {
|
|
|
|
# enable support for the H.264 codec
|
|
|
|
proprietary_codecs = true;
|
2015-10-07 17:42:24 +01:00
|
|
|
enable_hangout_services_extension = true;
|
2014-04-01 06:36:26 +01:00
|
|
|
ffmpeg_branding = "Chrome";
|
2016-10-29 03:05:53 +01:00
|
|
|
} // optionalAttrs pulseSupport {
|
|
|
|
use_pulseaudio = true;
|
|
|
|
link_pulseaudio = true;
|
2020-02-04 21:08:31 +00:00
|
|
|
} // optionalAttrs useOzone {
|
|
|
|
use_ozone = true;
|
|
|
|
use_xkbcommon = true;
|
|
|
|
use_glib = true;
|
|
|
|
use_gtk = true;
|
|
|
|
use_system_libwayland = true;
|
|
|
|
use_system_minigbm = true;
|
|
|
|
use_system_libdrm = true;
|
|
|
|
system_wayland_scanner_path = "${wayland}/bin/wayland-scanner";
|
2020-12-09 18:13:26 +00:00
|
|
|
} // optionalAttrs ungoogled {
|
|
|
|
chrome_pgo_phase = 0;
|
|
|
|
enable_hangout_services_extension = false;
|
|
|
|
enable_js_type_check = false;
|
|
|
|
enable_mdns = false;
|
|
|
|
enable_nacl_nonsfi = false;
|
|
|
|
enable_one_click_signin = false;
|
|
|
|
enable_reading_list = false;
|
|
|
|
enable_remoting = false;
|
|
|
|
enable_reporting = false;
|
|
|
|
enable_service_discovery = false;
|
|
|
|
exclude_unwind_tables = true;
|
|
|
|
google_api_key = "";
|
|
|
|
google_default_client_id = "";
|
|
|
|
google_default_client_secret = "";
|
|
|
|
safe_browsing_mode = 0;
|
|
|
|
use_official_google_api_keys = false;
|
|
|
|
use_unofficial_version_number = false;
|
2016-10-29 03:05:53 +01:00
|
|
|
} // (extraAttrs.gnFlags or {}));
|
2014-04-01 06:36:26 +01:00
|
|
|
|
|
|
|
configurePhase = ''
|
2017-02-08 19:48:05 +00:00
|
|
|
runHook preConfigure
|
|
|
|
|
2014-04-01 06:36:26 +01:00
|
|
|
# This is to ensure expansion of $out.
|
|
|
|
libExecPath="${libExecPath}"
|
chromium: use official build settings (#101467)
LLD: https://lld.llvm.org/
When you link a large program on a multicore machine, you can expect that LLD runs more than twice as fast as the GNU gold linker. Your mileage may vary, though.
Link-time optimization (LTO) is supported by default.
Some default settings have been tuned for the 21st century. For example, the stack is marked as non-executable by default to tighten security.
LTO & ThinLTO: https://clang.llvm.org/docs/ThinLTO.html
LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles. ThinLTO is a new approach that is designed to scale like a non-LTO build, while retaining most of the performance achievement of full LTO.
PGO: https://llvm.org/docs/HowToBuildWithPGO.html https://blog.chromium.org/2020/08/chrome-just-got-faster-with-profile.html
Allows your compiler to better optimize code for how it actually runs. Users report that applying this to Clang and LLVM can decrease overall compile time by 20%.
Because PGO uses real usage scenarios that match the workflows of Chrome users around the world, the most common tasks get prioritized and made faster. Delivers up to 10% faster page loads.
CFI: https://clang.llvm.org/docs/ControlFlowIntegrity.html https://www.chromium.org/developers/testing/control-flow-integrity
Aborts the program upon detecting certain forms of undefined behavior that can potentially allow attackers to subvert the program’s control flow. These schemes have been optimized for performance, allowing developers to enable them in release builds.
By default, a program compiled with CFI will crash with SIGILL if it detects a CFI violation.
Additionally:
Use minizip instead of zlib. Chromium says zlib but actually uses minizip.
Remove old unused workarounds.
Make shell scripts POSIX compliant.
Update documentation URLs.
Prepare for using system libraries.
2020-10-24 11:27:40 +01:00
|
|
|
python build/linux/unbundle/replace_gn_files.py --system-libraries ${toString gnSystemLibraries}
|
2020-04-03 18:17:57 +01:00
|
|
|
${gnChromium}/bin/gn gen --args=${escapeShellArg gnFlags} out/Release | tee gn-gen-outputs.txt
|
2018-06-19 01:48:42 +01:00
|
|
|
|
|
|
|
# Fail if `gn gen` contains a WARNING.
|
|
|
|
grep -o WARNING gn-gen-outputs.txt && echo "Found gn WARNING, exiting nix build" && exit 1
|
2017-02-08 19:48:05 +00:00
|
|
|
|
|
|
|
runHook postConfigure
|
2014-04-01 06:36:26 +01:00
|
|
|
'';
|
|
|
|
|
2020-04-02 23:02:23 +01:00
|
|
|
# Don't spam warnings about unknown warning options. This is useful because
|
|
|
|
# our Clang is always older than Chromium's and the build logs have a size
|
|
|
|
# of approx. 25 MB without this option (and this saves e.g. 66 %).
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-unknown-warning-option";
|
|
|
|
|
2014-04-01 06:36:26 +01:00
|
|
|
buildPhase = let
|
2014-08-13 03:49:53 +01:00
|
|
|
buildCommand = target: ''
|
2020-10-16 13:54:34 +01:00
|
|
|
ninja -C "${buildPath}" -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES "${target}"
|
2017-11-08 22:44:20 +00:00
|
|
|
(
|
|
|
|
source chrome/installer/linux/common/installer.include
|
|
|
|
PACKAGE=$packageName
|
|
|
|
MENUNAME="Chromium"
|
|
|
|
process_template chrome/app/resources/manpage.1.in "${buildPath}/chrome.1"
|
|
|
|
)
|
2014-04-25 02:58:33 +01:00
|
|
|
'';
|
|
|
|
targets = extraAttrs.buildTargets or [];
|
|
|
|
commands = map buildCommand targets;
|
|
|
|
in concatStringsSep "\n" commands;
|
2019-07-15 07:35:03 +01:00
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Make sure that libGLESv2 is found by dlopen (if using EGL).
|
|
|
|
chromiumBinary="$libExecPath/$packageName"
|
|
|
|
origRpath="$(patchelf --print-rpath "$chromiumBinary")"
|
|
|
|
patchelf --set-rpath "${libGL}/lib:$origRpath" "$chromiumBinary"
|
|
|
|
'';
|
2019-11-06 19:37:25 +00:00
|
|
|
|
2020-11-03 12:08:09 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.py;
|
|
|
|
chromiumDeps = {
|
|
|
|
gn = gnChromium;
|
|
|
|
};
|
|
|
|
};
|
2014-04-01 06:36:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# Remove some extraAttrs we supplied to the base attributes already.
|
|
|
|
in stdenv.mkDerivation (base // removeAttrs extraAttrs [
|
2016-10-29 03:05:53 +01:00
|
|
|
"name" "gnFlags" "buildTargets"
|
2019-11-06 19:37:25 +00:00
|
|
|
] // { passthru = base.passthru // (extraAttrs.passthru or {}); })
|