From c3768c2e3c39f80ad3500fde214231c15f405445 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 18 Feb 2023 09:51:33 -0500 Subject: chromium: rebase from official repo. --- www-client/chromium/Manifest | 3 +- www-client/chromium/chromium-112.0.5596.2.ebuild | 353 ++++++++++++++++++----- 2 files changed, 279 insertions(+), 77 deletions(-) (limited to 'www-client/chromium') diff --git a/www-client/chromium/Manifest b/www-client/chromium/Manifest index 5a9ccf4..b0e088c 100644 --- a/www-client/chromium/Manifest +++ b/www-client/chromium/Manifest @@ -19,5 +19,6 @@ AUX chromium-use-oauth2-client-switches-as-default.patch 1085 BLAKE2B baf3c46330 AUX chromium.default 148 BLAKE2B 5ee5b582c59a6e4bef87bbb0e232e2470ad412b1fbbb3b9af6ef7153edb55c5b9080cc16a5a115b0c5b3c381aa87ce57a7b12bdd2070e67dac10a6c2995ddbaf SHA512 0d4849e03592fb58b05e62a43021eca7e61615616c8907c3b2e445402e03adaf9e8fa25b0a745d6c31eb037456215cc02b59e345a3a06d932e76cf990c92d739 DIST chromium-110.0.5478.4.tar.xz 1702030384 BLAKE2B 8786705ca668056d36a899887731c34b6eda60916741263c0cc73ca195845ee397f175dbc07bf02b70585c2d824a8d8fcf3ec5999beb69f18b74855f01b2f525 SHA512 a7e525b9c3145596de7f16a59605a59c0a7f8c30172379213cc6aac21ed9a820ce79c166e58e2d17d0262f396541c9bfda1629bcc8baaef0a9e101a48e087f99 DIST chromium-112.0.5596.2.tar.xz 1718784936 BLAKE2B ab64af76c9a5b41ec19e32a98170fcb911012316700b225e08fd593ee51d681519e99078f9010a9e3368567a6047776607087b3ae4a6e952bbe5e4c5c49ef681 SHA512 65847b1206bf078d6bc67f597b94bad3219b55c8398bbdac2db01040bc2a37cb1fb2971ceabd8c5c68fd1769a2550c6abcb5c6e726424175af0c5d14eeba16a4 +DIST chromium-profiler-0.2.tar 259952640 BLAKE2B 5e82389fce00b267280d633b26551231c558b80f0c92cd7d60271095a3503365ab673e7a46dc5f74f8a82db1f21262cb24dcc0531d954bab5fb3b175dab3394d SHA512 9fa89a5ab728419683e7495ae676567480987d68a2d589f2aa97bfcbcf123f3c8f97f8bca5f65e5e3f6e41475535add473ded83b9c7a33bb4746a9d05b298a6c EBUILD chromium-110.0.5478.4.ebuild 32927 BLAKE2B 216a8e78a7d1aa59614d83421dbbd7fc1a7d61be3e3bf4eef72c248765bd3cfca3436a1f7ac8c93e489a36915d38c04ad85b5e2930a7fc2ebba66bb57f99e11c SHA512 6e41f29ce43ebab3ef01fb4c1502e68a1f3ff0ce52e6df274e67ff91f61660122a2a5c0bd0ca0f848cac2a78ef2eea83c6e7299ad8b729ec3f381c5cca94c30a -EBUILD chromium-112.0.5596.2.ebuild 33071 BLAKE2B 79c7c08e7acdaf97cde2db789adcaea2bb340f557f1c167aa451060b9aac427d46e4e22a0983dc1832442f507870275894c4fddb83ad0f545eb15f9de3716d1d SHA512 8b8cfc921b44dd1ac8eec74e4da0db73e2cddb1cba72ad7de763c4d3b8e7f28a1b277aa6573f5061d38b01c8339f43205f3564eaafa343d5f75571ff4d085ca7 +EBUILD chromium-112.0.5596.2.ebuild 38314 BLAKE2B 8f53a912808e1f4d4239624d52cca1943a5e19ef4d334c4b40ac38d86b1c69d651dec00f56165499722b9f8cd267f7872c279df357d6e116506d73aaed2bf614 SHA512 17a19fedbfcad49d78843391682554f53ddba1d6e2c0161090cb0c0e47a1172fa36c862852058af51638f79d098cded48db10c7e0d6525ec9c0c531fe8db66d3 diff --git a/www-client/chromium/chromium-112.0.5596.2.ebuild b/www-client/chromium/chromium-112.0.5596.2.ebuild index 961b573..5d22da6 100644 --- a/www-client/chromium/chromium-112.0.5596.2.ebuild +++ b/www-client/chromium/chromium-112.0.5596.2.ebuild @@ -1,31 +1,37 @@ -# Copyright 2009-2022 Gentoo Authors +# Copyright 2009-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 PYTHON_COMPAT=( python3_{9..11} ) -PYTHON_REQ_USE="xml" +PYTHON_REQ_USE="xml(+)" +LLVM_MAX_SLOT=15 CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw ta te th tr uk ur vi zh-CN zh-TW" -inherit check-reqs chromium-2 desktop flag-o-matic ninja-utils pax-utils python-any-r1 qmake-utils readme.gentoo-r1 toolchain-funcs xdg-utils +VIRTUALX_REQUIRED="pgo" + +inherit check-reqs chromium-2 desktop flag-o-matic llvm ninja-utils pax-utils +inherit python-any-r1 qmake-utils readme.gentoo-r1 toolchain-funcs virtualx xdg-utils DESCRIPTION="Open-source version of Google Chrome web browser" HOMEPAGE="https://chromium.org/" -SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz" +SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz + pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )" LICENSE="BSD" -SLOT="0" -KEYWORDS="~amd64 ~arm64 ~x86" -IUSE="component-build cups cpu_flags_arm_neon debug gtk4 qt5 +hangouts headless +js-type-check kerberos libcxx +official pic +proprietary-codecs pulseaudio screencast selinux +suid +system-ffmpeg +system-harfbuzz +system-icu +system-png vaapi wayland widevine" +SLOT="0/dev" +KEYWORDS="~amd64 ~arm64" +IUSE="+X component-build cups cpu_flags_arm_neon debug gtk4 +hangouts headless +js-type-check kerberos libcxx lto +official pgo pic +proprietary-codecs pulseaudio qt5 screencast selinux +suid +system-av1 +system-ffmpeg +system-harfbuzz +system-icu +system-png vaapi wayland widevine" REQUIRED_USE=" component-build? ( !suid !libcxx ) screencast? ( wayland ) + !headless? ( || ( X wayland ) ) + pgo? ( X !wayland ) " COMMON_X_DEPEND=" - x11-libs/gdk-pixbuf:2 x11-libs/libXcomposite:= x11-libs/libXcursor:= x11-libs/libXdamage:= @@ -35,11 +41,10 @@ COMMON_X_DEPEND=" x11-libs/libXrender:= x11-libs/libXtst:= x11-libs/libxshmfence:= - virtual/opengl " COMMON_SNAPSHOT_DEPEND=" - system-icu? ( >=dev-libs/icu-69.1:= ) + system-icu? ( >=dev-libs/icu-71.1:= ) >=dev-libs/libxml2-2.9.4-r3:=[icu] dev-libs/nspr:= >=dev-libs/nss-3.26:= @@ -49,10 +54,14 @@ COMMON_SNAPSHOT_DEPEND=" >=media-libs/freetype-2.11.0-r1:= system-harfbuzz? ( >=media-libs/harfbuzz-3:0=[icu(-)] ) media-libs/libjpeg-turbo:= - system-png? ( media-libs/libpng:=[-apng] ) + system-png? ( media-libs/libpng:=[-apng(-)] ) >=media-libs/libwebp-0.4.0:= media-libs/mesa:=[gbm(+)] >=media-libs/openh264-1.6.0:= + system-av1? ( + >=media-libs/dav1d-1.0.0:= + >=media-libs/libaom-3.4.0:= + ) sys-libs/zlib:= x11-libs/libdrm:= !headless? ( @@ -61,13 +70,15 @@ COMMON_SNAPSHOT_DEPEND=" pulseaudio? ( media-sound/pulseaudio:= ) sys-apps/pciutils:= kerberos? ( virtual/krb5 ) - vaapi? ( >=media-libs/libva-2.7:=[X] ) - x11-libs/libX11:= - x11-libs/libXext:= - x11-libs/libxcb:= + vaapi? ( >=media-libs/libva-2.7:=[X?,wayland?] ) + X? ( + x11-libs/libX11:= + x11-libs/libXext:= + x11-libs/libxcb:= + ) x11-libs/libxkbcommon:= wayland? ( - dev-libs/wayland:= + dev-libs/libffi:= screencast? ( media-video/pipewire:= ) ) ) @@ -90,13 +101,13 @@ COMMON_DEPEND=" media-libs/flac:= sys-libs/zlib:=[minizip] !headless? ( - ${COMMON_X_DEPEND} - >=app-accessibility/at-spi2-atk-2.26:2 - >=app-accessibility/at-spi2-core-2.26:2 - >=dev-libs/atk-2.26 + X? ( ${COMMON_X_DEPEND} ) + >=app-accessibility/at-spi2-core-2.46.0:2 + media-libs/mesa:=[X?,wayland?] cups? ( >=net-print/cups-1.3.11:= ) virtual/udev x11-libs/cairo:= + x11-libs/gdk-pixbuf:2 x11-libs/pango:= qt5? ( dev-qt/qtcore:5 @@ -107,21 +118,42 @@ COMMON_DEPEND=" RDEPEND="${COMMON_DEPEND} !headless? ( || ( - x11-libs/gtk+:3[X,wayland?] - gui-libs/gtk:4[X,wayland?] + x11-libs/gtk+:3[X?,wayland?] + gui-libs/gtk:4[X?,wayland?] ) - qt5? ( dev-qt/qtgui:5[X,wayland?] ) - x11-misc/xdg-utils + qt5? ( dev-qt/qtgui:5[X?,wayland?] ) ) virtual/ttf-fonts selinux? ( sec-policy/selinux-chromium ) " DEPEND="${COMMON_DEPEND} !headless? ( - gtk4? ( gui-libs/gtk:4[X,wayland?] ) - !gtk4? ( x11-libs/gtk+:3[X,wayland?] ) + gtk4? ( gui-libs/gtk:4[X?,wayland?] ) + !gtk4? ( x11-libs/gtk+:3[X?,wayland?] ) ) " + +depend_clang_llvm_version() { + echo "sys-devel/clang:$1" + echo "sys-devel/llvm:$1" + echo "=sys-devel/lld-$1*" +} + +depend_clang_llvm_versions() { + local _v + if [[ $# -gt 1 ]]; then + echo "|| (" + for _v in "$@"; do + echo "(" + depend_clang_llvm_version "${_v}" + echo ")" + done + echo ")" + elif [[ $# -eq 1 ]]; then + depend_clang_llvm_version "$1" + fi +} + BDEPEND=" ${COMMON_SNAPSHOT_DEPEND} ${PYTHON_DEPS} @@ -129,11 +161,21 @@ BDEPEND=" dev-python/setuptools[${PYTHON_USEDEP}] ') >=app-arch/gzip-1.7 - libcxx? ( >=sys-devel/clang-12 ) + !headless? ( + qt5? ( dev-qt/qtcore:5 ) + ) + libcxx? ( >=sys-devel/clang-13 ) + lto? ( $(depend_clang_llvm_versions 13 14 15) ) + pgo? ( + >=dev-python/selenium-3.141.0 + >=dev-util/web_page_replay_go-20220314 + $(depend_clang_llvm_versions 13 14 15) + ) dev-lang/perl >=dev-util/gn-0.1807 >=dev-util/gperf-3.0.3 >=dev-util/ninja-1.7.2 + dev-vcs/git >=net-libs/nodejs-7.6.0[inspector] >=sys-devel/bison-2.4.3 sys-devel/flex @@ -145,7 +187,7 @@ BDEPEND=" : ${CHROMIUM_FORCE_CLANG=yes} if [[ ${CHROMIUM_FORCE_CLANG} == yes ]]; then - BDEPEND+=" >=sys-devel/clang-12" + BDEPEND+=" >=sys-devel/clang-13" fi if ! has chromium_pkg_die ${EBUILD_DEATH_HOOKS}; then @@ -182,29 +224,61 @@ in /etc/chromium/default. " python_check_deps() { - has_version -b "dev-python/setuptools[${PYTHON_USEDEP}]" + python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]" +} + +needs_clang() { + [[ ${CHROMIUM_FORCE_CLANG} == yes ]] || use libcxx || use lto || use pgo +} + +llvm_check_deps() { + if ! has_version -b "sys-devel/clang:${LLVM_SLOT}" ; then + einfo "sys-devel/clang:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2 + return 1 + fi + + if ( use lto || use pgo ) && ! has_version -b "=sys-devel/lld-${LLVM_SLOT}*" ; then + einfo "=sys-devel/lld-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2 + return 1 + fi + + einfo "Using LLVM slot ${LLVM_SLOT} to build" >&2 } pre_build_checks() { if [[ ${MERGE_TYPE} != binary ]]; then + [[ ${EBUILD_PHASE_FUNC} == pkg_setup ]] && ( use lto || use pgo ) && llvm_pkg_setup + local -x CPP="$(tc-getCXX) -E" - if tc-is-gcc && ! ver_test "$(gcc-version)" -ge 9.2; then - die "At least gcc 9.2 is required" + if tc-is-gcc && ! ver_test "$(gcc-version)" -ge 10.4; then + die "At least gcc 10.4 is required" + fi + if use pgo && tc-is-cross-compiler; then + die "The pgo USE flag cannot be used when cross-compiling" fi - if [[ ${CHROMIUM_FORCE_CLANG} == yes ]] || tc-is-clang || use libcxx; then + if needs_clang || tc-is-clang; then tc-is-cross-compiler && CPP=${CBUILD}-clang++ || CPP=${CHOST}-clang++ CPP+=" -E" - if ! ver_test "$(clang-major-version)" -ge 12; then - die "At least clang 12 is required" + if ! ver_test "$(clang-major-version)" -ge 13; then + die "At least clang 13 is required" fi fi + if [[ ${EBUILD_PHASE_FUNC} == pkg_setup ]] && use js-type-check; then + "${BROOT}"/usr/bin/java -version 2>1 > /dev/null || die "Java VM not setup correctly" + fi fi # Check build requirements, bug #541816 and bug #471810 . CHECKREQS_MEMORY="4G" - CHECKREQS_DISK_BUILD="10G" - tc-is-cross-compiler && CHECKREQS_DISK_BUILD="13G" - if ( shopt -s extglob; is-flagq '-g?(gdb)?([1-9])' ); then + CHECKREQS_DISK_BUILD="12G" + tc-is-cross-compiler && CHECKREQS_DISK_BUILD="14G" + if use lto || use pgo; then + CHECKREQS_MEMORY="9G" + CHECKREQS_DISK_BUILD="13G" + tc-is-cross-compiler && CHECKREQS_DISK_BUILD="16G" + use pgo && CHECKREQS_DISK_BUILD="20G" + fi + if is-flagq '-g?(gdb)?([1-9])'; then if use custom-cflags || use component-build; then CHECKREQS_DISK_BUILD="25G" fi @@ -212,7 +286,7 @@ pre_build_checks() { CHECKREQS_MEMORY="16G" fi fi - check-reqs_pkg_setup + check-reqs_${EBUILD_PHASE_FUNC} } pkg_pretend() { @@ -247,6 +321,7 @@ src_prepare() { "${FILESDIR}/chromium-112-compiler.patch" "${FILESDIR}/chromium-103-VirtualCursor-std-layout.patch" "${FILESDIR}/chromium-109-minizip.patch" + "${FILESDIR}/chromium-112-disable-global-media-controls.patch" "${FILESDIR}/chromium-111-InkDropHost-crash.patch" "${FILESDIR}/chromium-109-EnumTable-crash.patch" @@ -260,13 +335,9 @@ src_prepare() { mkdir -p third_party/node/linux/node-linux-x64/bin || die ln -s "${EPREFIX}"/usr/bin/node third_party/node/linux/node-linux-x64/bin/node || die - # only required to fulfill gn dependencies - touch third_party/blink/tools/merge_web_test_results.pydeps || die - mkdir -p third_party/blink/tools/blinkpy/web_tests || die - touch third_party/blink/tools/blinkpy/web_tests/merge_results.pydeps || die - # adjust python interpreter version sed -i -e "s|\(^script_executable = \).*|\1\"${EPYTHON}\"|g" .gn || die + sed -i -e "s|vpython3|${EPYTHON}|g" testing/xvfb.py || die local keeplibs=( base/third_party/cityhash @@ -327,7 +398,6 @@ src_prepare() { third_party/crashpad/crashpad/third_party/zlib third_party/crc32c third_party/cros_system_api - third_party/dav1d third_party/dawn third_party/dawn/third_party/gn/webgpu-cts third_party/dawn/third_party/khronos @@ -382,11 +452,6 @@ src_prepare() { third_party/khronos third_party/leveldatabase third_party/libaddressinput - third_party/libaom - third_party/libaom/source/libaom/third_party/fastfeat - third_party/libaom/source/libaom/third_party/SVT-AV1 - third_party/libaom/source/libaom/third_party/vector - third_party/libaom/source/libaom/third_party/x86inc third_party/libavif third_party/libgav1 third_party/libjingle @@ -523,12 +588,22 @@ src_prepare() { if ! use system-png; then keeplibs+=( third_party/libpng ) fi + if ! use system-av1; then + keeplibs+=( + third_party/dav1d + third_party/libaom + third_party/libaom/source/libaom/third_party/fastfeat + third_party/libaom/source/libaom/third_party/SVT-AV1 + third_party/libaom/source/libaom/third_party/vector + third_party/libaom/source/libaom/third_party/x86inc + ) + fi + if ! use system-harfbuzz; then + keeplibs+=( third_party/harfbuzz-ng ) + fi if use libcxx; then keeplibs+=( third_party/re2 ) fi - if use wayland && ! use headless ; then - keeplibs+=( third_party/wayland ) - fi if use arm64 || use ppc64 ; then keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 ) fi @@ -542,6 +617,11 @@ src_prepare() { generate_gni.sh || die ./generate_gni.sh || die popd >/dev/null || die + + pushd third_party/ffmpeg >/dev/null || die + cp libavcodec/ppc/h264dsp.c libavcodec/ppc/h264dsp_ppc.c || die + cp libavcodec/ppc/h264qpel.c libavcodec/ppc/h264qpel_ppc.c || die + popd >/dev/null || die fi # Remove most bundled libraries. Some are still needed. @@ -556,7 +636,7 @@ src_prepare() { ln -s "${EPREFIX}"/bin/true buildtools/third_party/eu-strip/bin/eu-strip || die } -src_configure() { +chromium_configure() { # Calling this here supports resumption via FEATURES=keepwork python_setup @@ -565,7 +645,7 @@ src_configure() { # Make sure the build system will use the right tools, bug #340795. tc-export AR CC CXX NM - if { [[ ${CHROMIUM_FORCE_CLANG} == yes ]] || use libcxx; } && ! tc-is-clang; then + if needs_clang && ! tc-is-clang; then # Force clang since gcc is either broken or build is using libcxx. if tc-is-cross-compiler; then CC="${CBUILD}-clang -target ${CHOST} --sysroot ${ESYSROOT}" @@ -579,12 +659,28 @@ src_configure() { strip-unsupported-flags fi - if tc-is-clang || use libcxx; then + if tc-is-clang; then myconf_gn+=" is_clang=true clang_use_chrome_plugins=false" else myconf_gn+=" is_clang=false" fi + # Force lld for lto or pgo builds only, otherwise disable, bug 641556 + if use lto || use pgo; then + myconf_gn+=" use_lld=true" + else + myconf_gn+=" use_lld=false" + fi + + if use lto || use pgo; then + AR=llvm-ar + NM=llvm-nm + if tc-is-cross-compiler; then + BUILD_AR=llvm-ar + BUILD_NM=llvm-nm + fi + fi + # Define a custom toolchain for GN myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\"" @@ -608,6 +704,15 @@ src_configure() { myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\"" fi + # Create dummy pkg-config file for libsystemd, only dependency of installer + mkdir "${T}/libsystemd" || die + cat <<- EOF > "${T}/libsystemd/libsystemd.pc" + Name: + Description: + Version: + EOF + local -x PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+"${PKG_CONFIG_PATH}:"}${T}/libsystemd" + # GN needs explicit config for Debug/Release as opposed to inferring it from build directory. myconf_gn+=" is_debug=false" @@ -641,7 +746,7 @@ src_configure() { libwebp libxml libxslt - #openh264 + openh264 zlib ) if use system-ffmpeg; then @@ -653,6 +758,9 @@ src_configure() { if use system-png; then gn_system_libraries+=( libpng ) fi + if use system-av1; then + gn_system_libraries+=( dav1d libaom ) + fi # re2 library interface relies on std::string and std::vector if ! use libcxx; then gn_system_libraries+=( re2 ) @@ -695,9 +803,6 @@ src_configure() { myconf_gn+=" use_gold=false use_sysroot=false" myconf_gn+=" use_custom_libcxx=$(usex libcxx true false)" - # Disable forced lld, bug 641556 - myconf_gn+=" use_lld=false" - # Disable pseudolocales, only used for testing myconf_gn+=" enable_pseudolocales=false" @@ -732,9 +837,9 @@ src_configure() { filter-flags "-g*" fi - # Prevent libvpx build failures. Bug 530248, 544702, 546984. + # Prevent libvpx/xnnpack build failures. Bug 530248, 544702, 546984, 853646. if [[ ${myarch} == amd64 || ${myarch} == x86 ]]; then - filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 -mno-avx -mno-avx2 -mno-fma -mno-fma4 + filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 -mno-avx -mno-avx2 -mno-fma -mno-fma4 -mno-xop -mno-sse4a fi fi @@ -769,6 +874,17 @@ src_configure() { # Disable fatal linker warnings, bug 506268. myconf_gn+=" fatal_linker_warnings=false" + # Disable external code space for V8 for ppc64. It is disabled for ppc64 + # by default, but cross-compiling on amd64 enables it again. + if tc-is-cross-compiler; then + if ! use amd64 && ! use arm64; then + myconf_gn+=" v8_enable_external_code_space=false" + fi + fi + + # Only enabled for clang, but gcc has endian macros too + myconf_gn+=" v8_use_libm_trig_functions=true" + # Bug 491582. export TMPDIR="${WORKDIR}/temp" mkdir -p -m 755 "${TMPDIR}" || die @@ -796,7 +912,6 @@ src_configure() { # Disable unknown warning message from clang. if tc-is-clang; then append-flags -Wno-unknown-warning-option - append-flags "-fbracket-depth=1024" if tc-is-cross-compiler; then export BUILD_CXXFLAGS+=" -Wno-unknown-warning-option" export BUILD_CFLAGS+=" -Wno-unknown-warning-option" @@ -811,7 +926,6 @@ src_configure() { # Enable ozone wayland and/or headless support myconf_gn+=" use_ozone=true ozone_auto_platforms=false" myconf_gn+=" ozone_platform_headless=true" - myconf_gn+=" enable_remoting=false" if use headless; then myconf_gn+=" ozone_platform=\"headless\"" myconf_gn+=" use_xkbcommon=false use_gtk=false use_qt=false" @@ -819,19 +933,26 @@ src_configure() { myconf_gn+=" use_pangocairo=false use_alsa=false" myconf_gn+=" use_libpci=false use_udev=false" myconf_gn+=" enable_print_preview=false" + myconf_gn+=" enable_remoting=false" else myconf_gn+=" use_system_libdrm=true" myconf_gn+=" use_system_minigbm=true" myconf_gn+=" use_xkbcommon=true" - use qt5 && export PATH="${PATH}:$(qt5_get_bindir)" + if use qt5; then + local moc_dir="$(qt5_get_bindir)" + if tc-is-cross-compiler; then + # Hack to workaround get_libdir not being able to handle CBUILD, bug #794181 + local cbuild_libdir=$($(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libxslt) + cbuild_libdir=${cbuild_libdir:2} + moc_dir="${EPREFIX}"/${cbuild_libdir/% }/qt5/bin + fi + export PATH="${PATH}:${moc_dir}" + fi myconf_gn+=" use_qt=$(usex qt5 true false)" - myconf_gn+=" ozone_platform_x11=true" + myconf_gn+=" ozone_platform_x11=$(usex X true false)" myconf_gn+=" ozone_platform_wayland=$(usex wayland true false)" myconf_gn+=" ozone_platform=$(usex wayland \"wayland\" \"x11\")" - if use wayland; then - myconf_gn+=" use_system_libwayland_server=true" - myconf_gn+=" use_system_wayland_scanner=true" - fi + use wayland && myconf_gn+=" use_system_libffi=true" fi # Results in undefined references in chrome linking, may require CFI to work @@ -841,26 +962,50 @@ src_configure() { # Enable official builds myconf_gn+=" is_official_build=$(usex official true false)" - myconf_gn+=" use_thin_lto=false" + myconf_gn+=" use_thin_lto=$(usex lto true false)" + myconf_gn+=" thin_lto_enable_optimizations=$(usex lto true false)" if use official; then # Allow building against system libraries in official builds sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ tools/generate_shim_headers/generate_shim_headers.py || die # Disable CFI: unsupported for GCC, requires clang+lto+lld myconf_gn+=" is_cfi=false" - # Disable PGO, because profile data is only compatible with >=clang-11 - myconf_gn+=" chrome_pgo_phase=0" # Don't add symbols to build myconf_gn+=" symbol_level=0" fi + if use pgo; then + myconf_gn+=" chrome_pgo_phase=${1}" + if [[ "$1" == "2" ]]; then + myconf_gn+=" pgo_data_path=\"${2}\"" + fi + else + # Disable PGO, because profile data is only compatible with >=clang-11 + myconf_gn+=" chrome_pgo_phase=0" + fi + + # user CXXFLAGS might overwrite -march=armv8-a+crc+crypto, bug #851639 + if use arm64 && tc-is-gcc; then + sed -i '/^#if HAVE_ARM64_CRC32C/a #pragma GCC target ("+crc+crypto")' \ + third_party/crc32c/src/src/crc32c_arm64.cc || die + fi + + # skipping typecheck is only supported on amd64, bug #876157 + if ! use amd64; then + myconf_gn+=" devtools_skip_typecheck=false" + fi + einfo "Configuring Chromium..." set -- gn gen --args="${myconf_gn} ${EXTRA_GN}" out/Release echo "$@" "$@" || die } -src_compile() { +src_configure() { + chromium_configure $(usex pgo 1 0) +} + +chromium_compile() { # Final link uses lots of file descriptors. ulimit -n 2048 @@ -870,8 +1015,6 @@ src_compile() { # Don't inherit PYTHONPATH from environment, bug #789021, #812689 local -x PYTHONPATH= - #"${EPYTHON}" tools/clang/scripts/update.py --force-local-build --gcc-toolchain /usr --skip-checkout --use-system-cmake --without-android || die - # Build mksnapshot and pax-mark it. local x for x in mksnapshot v8_context_snapshot_generator; do @@ -890,9 +1033,64 @@ src_compile() { use suid && eninja -C out/Release chrome_sandbox pax-mark m out/Release/chrome +} + +# This function is called from virtx, and must always return so that Xvfb +# session isn't left running. If we return 1, virtx will call die(). +chromium_profile() { + einfo "Profiling for PGO" + + pushd "${WORKDIR}/chromium-profiler-"* >/dev/null || return 1 + + # Remove old profdata in case profiling was interrupted. + rm -rf "${1}" || return 1 + + if ! "${EPYTHON}" ./chromium_profiler.py \ + --chrome-executable "${S}/out/Release/chrome" \ + --chromedriver-executable "${S}/out/Release/chromedriver.unstripped" \ + --add-arg no-sandbox --add-arg disable-dev-shm-usage \ + --profile-output "${1}"; then + eerror "Profiling failed" + return 1 + fi + + popd >/dev/null || return 1 +} + +src_compile() { + if use pgo; then + local profdata + + profdata="${WORKDIR}/chromium.profdata" + + if [[ ! -e "${WORKDIR}/.pgo-profiled" ]]; then + chromium_compile + virtx chromium_profile "$profdata" + + touch "${WORKDIR}/.pgo-profiled" || die + fi + + if [[ ! -e "${WORKDIR}/.pgo-phase-2-configured" ]]; then + # Remove phase 1 output + rm -r out/Release || die + + chromium_configure 2 "$profdata" + + touch "${WORKDIR}/.pgo-phase-2-configured" || die + fi + + if [[ ! -e "${WORKDIR}/.pgo-phase-2-compiled" ]]; then + chromium_compile + touch "${WORKDIR}/.pgo-phase-2-compiled" || die + fi + else + chromium_compile + fi mv out/Release/chromedriver{.unstripped,} || die + rm -f out/Release/locales/*.pak.info || die + # Build manpage; bug #684550 sed -e 's|@@PACKAGE@@|chromium-browser|g; s|@@MENUNAME@@|Chromium|g;' \ @@ -927,7 +1125,7 @@ src_install() { doexe out/Release/chrome_crashpad_handler ozone_auto_session () { - use wayland && ! use headless && echo true || echo false + use X && use wayland && ! use headless && echo true || echo false } local sedargs=( -e "s:/usr/lib/:/usr/$(get_libdir)/:g; @@ -961,6 +1159,9 @@ src_install() { [[ ${#files[@]} -gt 0 ]] && doins "${files[@]}" ) + # Install bundled xdg-utils, avoids installing X11 libraries with USE="-X wayland" + doins out/Release/xdg-{settings,mime} + if ! use system-icu && ! use headless; then doins out/Release/icudtl.dat fi -- cgit v1.2.3