Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/chromium/
Date: Thu, 02 Mar 2023 16:22:39
Message-Id: 1677774147.15981848f60cf4436c85846d969e358227f0c416.floppym@gentoo
1 commit: 15981848f60cf4436c85846d969e358227f0c416
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 2 16:22:27 2023 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 2 16:22:27 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15981848
7
8 www-client/chromium: add 110.0.5481.177
9
10 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
11
12 www-client/chromium/Manifest | 1 +
13 www-client/chromium/chromium-110.0.5481.177.ebuild | 1228 ++++++++++++++++++++
14 2 files changed, 1229 insertions(+)
15
16 diff --git a/www-client/chromium/Manifest b/www-client/chromium/Manifest
17 index 57afa0fff355..78d0906681e4 100644
18 --- a/www-client/chromium/Manifest
19 +++ b/www-client/chromium/Manifest
20 @@ -2,6 +2,7 @@ DIST chromium-109-patchset-2.tar.xz 7280 BLAKE2B b7f86dbb6c40005df67764a7dea57c8
21 DIST chromium-109.0.5414.119.tar.xz 1747968612 BLAKE2B 9090fcb60165a8e4ba990df4c90cf0252798718407951947d50c35778f62bbbc91f588604af4e3de6cbcc069e7eea340379c450e28532f4b4bae29f3ab393c7c SHA512 3942b282072489134a70e85c60669c8360b35ffdd64fb310f75306cffa4d1117db78fed7b04659d90d13b62c45922503cb31022e1ca9b29a2872c3c445023104
22 DIST chromium-109.0.5414.74.tar.xz 1747778008 BLAKE2B dc2893c59398caf72546c42ada961215ce1b25785da66272b72fe14ac0db00ac4282b0de5ee65cca932e273fe69f41704b4ee2aa173d21da535708e8d0aab633 SHA512 79ff744b813e833ab4f257361a2f1847a57df579b9c925bad7575484f079c4c1b0b1c59c2c48e683bcee27a79e4bfd87f96c83fa28e0209ba4d3a71340842579
23 DIST chromium-110-patchset-4.tar.xz 13584 BLAKE2B 8ed3d438375ceabc02552ff66874ba8f15687fefa96239866cb2f86c57db72c162daafad6e1944df6117e792ca9d992b101c17d35132d429fc6edcf49db29940 SHA512 898416453e129e83dcd70728e382a2916e741b013887e8ec9b4d2737a4ef2738d83d4a868f9260c3906c4934bb9a7b3104a50cfc3d94064eb71a341279e9fcb9
24 +DIST chromium-110.0.5481.177.tar.xz 1703390456 BLAKE2B d9ee898090ea04bff72a5d6278e4aec5b36c8c160c310997835dbcaf963647645949a0d4fa3bc34573e362bb4ead63e4c21fa25c241c93493544e541c8ab5142 SHA512 542125f7530409ae37950a0870c0349d5bea218ebd8deb6bf9929b14f8b1f31ab8a4d910fbb66e5b6fc1e4a1a41c01d12a36dc2d4005d8dcd2b8f1724e7d570b
25 DIST chromium-110.0.5481.38.tar.xz 1703266068 BLAKE2B 8b990eef533f8469afc6ea88c9fc70f316ccf33381fbbe30b43c89cde476a0487b201d7b07e8202bfdf94b44c2c5b184627f27225bb12ad7cef9fb505e608206 SHA512 4ad20231ce1c42d30886cfa179b154f1bd09efb61b971dc55a2aa70538a39141199f9a799c09b546c3e3501cf1981b6dd850e92e44aaa8f816ddb294fc194231
26 DIST chromium-111-patchset-2.tar.xz 21480 BLAKE2B e59d67d261df23c110c2db0644250c20d9e1cd6b99cb9513dbd12463faad8aea8520c5b5dbbfd2187a7795f7e34ebd3379fac4c3b2b01e30ffb4451b45084866 SHA512 7a2e660a9271b9b643dce5f7522570182eb895935312446775bf7c03a4c2d50d7f95c2082cac2dd477060d03f68e5424c990f535e0b1de9f0d12ac248806d043
27 DIST chromium-111.0.5545.6.tar.xz 1721481252 BLAKE2B 22f0d9386a5ea8b473e85324b448f4789f9d6365c723ef254b42db3d059b972bb3e620a4e331ce935805d2b22be867d0e6f923264268fce828fe29394f59c09c SHA512 a52a4e4ebac1cd05bbe08763e4c4cd3e48efd37f8bb60cb6e1d8119e698ddecdc96741d3d4f97ee74d87fb8f27bdc4a60dbe2d09d84c223576983c65bb9fb6b4
28
29 diff --git a/www-client/chromium/chromium-110.0.5481.177.ebuild b/www-client/chromium/chromium-110.0.5481.177.ebuild
30 new file mode 100644
31 index 000000000000..030ad228d824
32 --- /dev/null
33 +++ b/www-client/chromium/chromium-110.0.5481.177.ebuild
34 @@ -0,0 +1,1228 @@
35 +# Copyright 2009-2023 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=8
39 +PYTHON_COMPAT=( python3_{9..11} )
40 +PYTHON_REQ_USE="xml(+)"
41 +LLVM_MAX_SLOT=15
42 +
43 +CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he
44 + 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
45 + sv sw ta te th tr uk ur vi zh-CN zh-TW"
46 +
47 +VIRTUALX_REQUIRED="pgo"
48 +
49 +inherit check-reqs chromium-2 desktop flag-o-matic llvm ninja-utils pax-utils
50 +inherit python-any-r1 qmake-utils readme.gentoo-r1 toolchain-funcs virtualx xdg-utils
51 +
52 +DESCRIPTION="Open-source version of Google Chrome web browser"
53 +HOMEPAGE="https://chromium.org/"
54 +PATCHSET="4"
55 +PATCHSET_NAME="chromium-$(ver_cut 1)-patchset-${PATCHSET}"
56 +SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
57 + https://github.com/stha09/chromium-patches/releases/download/${PATCHSET_NAME}/${PATCHSET_NAME}.tar.xz
58 + pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )"
59 +
60 +LICENSE="BSD"
61 +SLOT="0/beta"
62 +KEYWORDS="~amd64 ~arm64"
63 +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"
64 +REQUIRED_USE="
65 + component-build? ( !suid !libcxx )
66 + screencast? ( wayland )
67 + !headless? ( || ( X wayland ) )
68 + pgo? ( X !wayland )
69 +"
70 +
71 +COMMON_X_DEPEND="
72 + x11-libs/libXcomposite:=
73 + x11-libs/libXcursor:=
74 + x11-libs/libXdamage:=
75 + x11-libs/libXfixes:=
76 + >=x11-libs/libXi-1.6.0:=
77 + x11-libs/libXrandr:=
78 + x11-libs/libXrender:=
79 + x11-libs/libXtst:=
80 + x11-libs/libxshmfence:=
81 +"
82 +
83 +COMMON_SNAPSHOT_DEPEND="
84 + system-icu? ( >=dev-libs/icu-71.1:= )
85 + >=dev-libs/libxml2-2.9.4-r3:=[icu]
86 + dev-libs/nspr:=
87 + >=dev-libs/nss-3.26:=
88 + !libcxx? ( >=dev-libs/re2-0.2019.08.01:= )
89 + dev-libs/libxslt:=
90 + media-libs/fontconfig:=
91 + >=media-libs/freetype-2.11.0-r1:=
92 + system-harfbuzz? ( >=media-libs/harfbuzz-3:0=[icu(-)] )
93 + media-libs/libjpeg-turbo:=
94 + system-png? ( media-libs/libpng:=[-apng(-)] )
95 + >=media-libs/libwebp-0.4.0:=
96 + media-libs/mesa:=[gbm(+)]
97 + >=media-libs/openh264-1.6.0:=
98 + system-av1? (
99 + >=media-libs/dav1d-1.0.0:=
100 + >=media-libs/libaom-3.4.0:=
101 + )
102 + sys-libs/zlib:=
103 + x11-libs/libdrm:=
104 + !headless? (
105 + dev-libs/glib:2
106 + >=media-libs/alsa-lib-1.0.19:=
107 + pulseaudio? ( media-sound/pulseaudio:= )
108 + sys-apps/pciutils:=
109 + kerberos? ( virtual/krb5 )
110 + vaapi? ( >=media-libs/libva-2.7:=[X?,wayland?] )
111 + X? (
112 + x11-libs/libX11:=
113 + x11-libs/libXext:=
114 + x11-libs/libxcb:=
115 + )
116 + x11-libs/libxkbcommon:=
117 + wayland? (
118 + dev-libs/libffi:=
119 + screencast? ( media-video/pipewire:= )
120 + )
121 + )
122 +"
123 +
124 +COMMON_DEPEND="
125 + ${COMMON_SNAPSHOT_DEPEND}
126 + app-arch/bzip2:=
127 + dev-libs/expat:=
128 + system-ffmpeg? (
129 + >=media-video/ffmpeg-4.3:=
130 + || (
131 + media-video/ffmpeg[-samba]
132 + >=net-fs/samba-4.5.10-r1[-debug(-)]
133 + )
134 + >=media-libs/opus-1.3.1:=
135 + )
136 + net-misc/curl[ssl]
137 + sys-apps/dbus:=
138 + media-libs/flac:=
139 + sys-libs/zlib:=[minizip]
140 + !headless? (
141 + X? ( ${COMMON_X_DEPEND} )
142 + >=app-accessibility/at-spi2-core-2.46.0:2
143 + media-libs/mesa:=[X?,wayland?]
144 + cups? ( >=net-print/cups-1.3.11:= )
145 + virtual/udev
146 + x11-libs/cairo:=
147 + x11-libs/gdk-pixbuf:2
148 + x11-libs/pango:=
149 + qt5? (
150 + dev-qt/qtcore:5
151 + dev-qt/qtwidgets:5
152 + )
153 + )
154 +"
155 +RDEPEND="${COMMON_DEPEND}
156 + !headless? (
157 + || (
158 + x11-libs/gtk+:3[X?,wayland?]
159 + gui-libs/gtk:4[X?,wayland?]
160 + )
161 + qt5? ( dev-qt/qtgui:5[X?,wayland?] )
162 + x11-misc/xdg-utils
163 + )
164 + virtual/ttf-fonts
165 + selinux? ( sec-policy/selinux-chromium )
166 +"
167 +DEPEND="${COMMON_DEPEND}
168 + !headless? (
169 + gtk4? ( gui-libs/gtk:4[X?,wayland?] )
170 + !gtk4? ( x11-libs/gtk+:3[X?,wayland?] )
171 + )
172 +"
173 +
174 +depend_clang_llvm_version() {
175 + echo "sys-devel/clang:$1"
176 + echo "sys-devel/llvm:$1"
177 + echo "=sys-devel/lld-$1*"
178 +}
179 +
180 +depend_clang_llvm_versions() {
181 + local _v
182 + if [[ $# -gt 1 ]]; then
183 + echo "|| ("
184 + for _v in "$@"; do
185 + echo "("
186 + depend_clang_llvm_version "${_v}"
187 + echo ")"
188 + done
189 + echo ")"
190 + elif [[ $# -eq 1 ]]; then
191 + depend_clang_llvm_version "$1"
192 + fi
193 +}
194 +
195 +BDEPEND="
196 + ${COMMON_SNAPSHOT_DEPEND}
197 + ${PYTHON_DEPS}
198 + $(python_gen_any_dep '
199 + dev-python/setuptools[${PYTHON_USEDEP}]
200 + ')
201 + >=app-arch/gzip-1.7
202 + !headless? (
203 + qt5? ( dev-qt/qtcore:5 )
204 + )
205 + libcxx? ( >=sys-devel/clang-13 )
206 + lto? ( $(depend_clang_llvm_versions 13 14 15) )
207 + pgo? (
208 + >=dev-python/selenium-3.141.0
209 + >=dev-util/web_page_replay_go-20220314
210 + $(depend_clang_llvm_versions 13 14 15)
211 + )
212 + dev-lang/perl
213 + >=dev-util/gn-0.1807
214 + >=dev-util/gperf-3.0.3
215 + >=dev-util/ninja-1.7.2
216 + dev-vcs/git
217 + >=net-libs/nodejs-7.6.0[inspector]
218 + >=sys-devel/bison-2.4.3
219 + sys-devel/flex
220 + virtual/pkgconfig
221 + js-type-check? ( virtual/jre )
222 +"
223 +
224 +# These are intended for ebuild maintainer use to force clang if GCC is broken.
225 +: ${CHROMIUM_FORCE_CLANG=no}
226 +
227 +if [[ ${CHROMIUM_FORCE_CLANG} == yes ]]; then
228 + BDEPEND+=" >=sys-devel/clang-13"
229 +fi
230 +
231 +if ! has chromium_pkg_die ${EBUILD_DEATH_HOOKS}; then
232 + EBUILD_DEATH_HOOKS+=" chromium_pkg_die";
233 +fi
234 +
235 +DISABLE_AUTOFORMATTING="yes"
236 +DOC_CONTENTS="
237 +Some web pages may require additional fonts to display properly.
238 +Try installing some of the following packages if some characters
239 +are not displayed properly:
240 +- media-fonts/arphicfonts
241 +- media-fonts/droid
242 +- media-fonts/ipamonafont
243 +- media-fonts/noto
244 +- media-fonts/ja-ipafonts
245 +- media-fonts/takao-fonts
246 +- media-fonts/wqy-microhei
247 +- media-fonts/wqy-zenhei
248 +
249 +To fix broken icons on the Downloads page, you should install an icon
250 +theme that covers the appropriate MIME types, and configure this as your
251 +GTK+ icon theme.
252 +
253 +For native file dialogs in KDE, install kde-apps/kdialog.
254 +
255 +To make password storage work with your desktop environment you may
256 +have install one of the supported credentials management applications:
257 +- app-crypt/libsecret (GNOME)
258 +- kde-frameworks/kwallet (KDE)
259 +If you have one of above packages installed, but don't want to use
260 +them in Chromium, then add --password-store=basic to CHROMIUM_FLAGS
261 +in /etc/chromium/default.
262 +"
263 +
264 +python_check_deps() {
265 + python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]"
266 +}
267 +
268 +needs_clang() {
269 + [[ ${CHROMIUM_FORCE_CLANG} == yes ]] || use libcxx || use lto || use pgo
270 +}
271 +
272 +llvm_check_deps() {
273 + if ! has_version -b "sys-devel/clang:${LLVM_SLOT}" ; then
274 + einfo "sys-devel/clang:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
275 + return 1
276 + fi
277 +
278 + if ( use lto || use pgo ) && ! has_version -b "=sys-devel/lld-${LLVM_SLOT}*" ; then
279 + einfo "=sys-devel/lld-${LLVM_SLOT}* is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
280 + return 1
281 + fi
282 +
283 + einfo "Using LLVM slot ${LLVM_SLOT} to build" >&2
284 +}
285 +
286 +pre_build_checks() {
287 + if [[ ${MERGE_TYPE} != binary ]]; then
288 + [[ ${EBUILD_PHASE_FUNC} == pkg_setup ]] && ( use lto || use pgo ) && llvm_pkg_setup
289 +
290 + local -x CPP="$(tc-getCXX) -E"
291 + if tc-is-gcc && ! ver_test "$(gcc-version)" -ge 10.4; then
292 + die "At least gcc 10.4 is required"
293 + fi
294 + if use pgo && tc-is-cross-compiler; then
295 + die "The pgo USE flag cannot be used when cross-compiling"
296 + fi
297 + if needs_clang || tc-is-clang; then
298 + tc-is-cross-compiler && CPP=${CBUILD}-clang++ || CPP=${CHOST}-clang++
299 + CPP+=" -E"
300 + if ! ver_test "$(clang-major-version)" -ge 13; then
301 + die "At least clang 13 is required"
302 + fi
303 + # bug #889374
304 + if ! use libcxx; then
305 + die "Builds using clang fail with USE=-libcxx"
306 + fi
307 + fi
308 + if [[ ${EBUILD_PHASE_FUNC} == pkg_setup ]] && use js-type-check; then
309 + "${BROOT}"/usr/bin/java -version 2>1 > /dev/null || die "Java VM not setup correctly"
310 + fi
311 + fi
312 +
313 + # Check build requirements, bug #541816 and bug #471810 .
314 + CHECKREQS_MEMORY="4G"
315 + CHECKREQS_DISK_BUILD="12G"
316 + tc-is-cross-compiler && CHECKREQS_DISK_BUILD="14G"
317 + if use lto || use pgo; then
318 + CHECKREQS_MEMORY="9G"
319 + CHECKREQS_DISK_BUILD="13G"
320 + tc-is-cross-compiler && CHECKREQS_DISK_BUILD="16G"
321 + use pgo && CHECKREQS_DISK_BUILD="20G"
322 + fi
323 + if is-flagq '-g?(gdb)?([1-9])'; then
324 + if use custom-cflags || use component-build; then
325 + CHECKREQS_DISK_BUILD="25G"
326 + fi
327 + if ! use component-build; then
328 + CHECKREQS_MEMORY="16G"
329 + fi
330 + fi
331 + check-reqs_${EBUILD_PHASE_FUNC}
332 +}
333 +
334 +pkg_pretend() {
335 + pre_build_checks
336 +
337 + if use headless; then
338 + local headless_unused_flags=("cups" "kerberos" "pulseaudio" "qt5" "vaapi" "wayland")
339 + for myiuse in ${headless_unused_flags[@]}; do
340 + use ${myiuse} && ewarn "Ignoring USE=${myiuse} since USE=headless is set."
341 + done
342 + fi
343 +}
344 +
345 +pkg_setup() {
346 + pre_build_checks
347 +
348 + chromium_suid_sandbox_check_kernel_config
349 +
350 + # nvidia-drivers does not work correctly with Wayland due to unsupported EGLStreams
351 + if use wayland && ! use headless && has_version "x11-drivers/nvidia-drivers"; then
352 + ewarn "Proprietary nVidia driver does not work with Wayland. You can disable"
353 + ewarn "Wayland by setting DISABLE_OZONE_PLATFORM=true in /etc/chromium/default."
354 + fi
355 +}
356 +
357 +src_prepare() {
358 + # Calling this here supports resumption via FEATURES=keepwork
359 + python_setup
360 +
361 + # disable global media controls, crashes with libstdc++
362 + sed -i -e \
363 + "/\"GlobalMediaControlsCastStartStop\",/{n;s/ENABLED/DISABLED/;}" \
364 + "chrome/browser/media/router/media_router_feature.cc" || die
365 +
366 + local PATCHES=(
367 + "${WORKDIR}/patches"
368 + "${FILESDIR}/chromium-93-InkDropHost-crash.patch"
369 + "${FILESDIR}/chromium-98-gtk4-build.patch"
370 + "${FILESDIR}/chromium-108-EnumTable-crash.patch"
371 + "${FILESDIR}/chromium-109-system-zlib.patch"
372 + "${FILESDIR}/chromium-109-system-openh264.patch"
373 + "${FILESDIR}/chromium-109-system-icu.patch"
374 + "${FILESDIR}/chromium-use-oauth2-client-switches-as-default.patch"
375 + "${FILESDIR}/chromium-shim_headers.patch"
376 + "${FILESDIR}/chromium-cross-compile.patch"
377 + )
378 +
379 + default
380 +
381 + mkdir -p third_party/node/linux/node-linux-x64/bin || die
382 + ln -s "${EPREFIX}"/usr/bin/node third_party/node/linux/node-linux-x64/bin/node || die
383 +
384 + # adjust python interpreter version
385 + sed -i -e "s|\(^script_executable = \).*|\1\"${EPYTHON}\"|g" .gn || die
386 + sed -i -e "s|vpython3|${EPYTHON}|g" testing/xvfb.py || die
387 +
388 + local keeplibs=(
389 + base/third_party/cityhash
390 + base/third_party/double_conversion
391 + base/third_party/dynamic_annotations
392 + base/third_party/icu
393 + base/third_party/nspr
394 + base/third_party/superfasthash
395 + base/third_party/symbolize
396 + base/third_party/valgrind
397 + base/third_party/xdg_mime
398 + base/third_party/xdg_user_dirs
399 + buildtools/third_party/libc++
400 + buildtools/third_party/libc++abi
401 + chrome/third_party/mozilla_security_manager
402 + courgette/third_party
403 + net/third_party/mozilla_security_manager
404 + net/third_party/nss
405 + net/third_party/quic
406 + net/third_party/uri_template
407 + third_party/abseil-cpp
408 + third_party/angle
409 + third_party/angle/src/common/third_party/xxhash
410 + third_party/angle/src/third_party/libXNVCtrl
411 + third_party/angle/src/third_party/volk
412 + third_party/apple_apsl
413 + third_party/axe-core
414 + third_party/blink
415 + third_party/bidimapper
416 + third_party/boringssl
417 + third_party/boringssl/src/third_party/fiat
418 + third_party/breakpad
419 + third_party/breakpad/breakpad/src/third_party/curl
420 + third_party/brotli
421 + third_party/catapult
422 + third_party/catapult/common/py_vulcanize/third_party/rcssmin
423 + third_party/catapult/common/py_vulcanize/third_party/rjsmin
424 + third_party/catapult/third_party/beautifulsoup4-4.9.3
425 + third_party/catapult/third_party/html5lib-1.1
426 + third_party/catapult/third_party/polymer
427 + third_party/catapult/third_party/six
428 + third_party/catapult/tracing/third_party/d3
429 + third_party/catapult/tracing/third_party/gl-matrix
430 + third_party/catapult/tracing/third_party/jpeg-js
431 + third_party/catapult/tracing/third_party/jszip
432 + third_party/catapult/tracing/third_party/mannwhitneyu
433 + third_party/catapult/tracing/third_party/oboe
434 + third_party/catapult/tracing/third_party/pako
435 + third_party/ced
436 + third_party/cld_3
437 + third_party/closure_compiler
438 + third_party/content_analysis_sdk
439 + third_party/cpuinfo
440 + third_party/crashpad
441 + third_party/crashpad/crashpad/third_party/lss
442 + third_party/crashpad/crashpad/third_party/zlib
443 + third_party/crc32c
444 + third_party/cros_system_api
445 + third_party/dawn
446 + third_party/dawn/third_party/gn/webgpu-cts
447 + third_party/dawn/third_party/khronos
448 + third_party/depot_tools
449 + third_party/devscripts
450 + third_party/devtools-frontend
451 + third_party/devtools-frontend/src/front_end/third_party/acorn
452 + third_party/devtools-frontend/src/front_end/third_party/additional_readme_paths.json
453 + third_party/devtools-frontend/src/front_end/third_party/axe-core
454 + third_party/devtools-frontend/src/front_end/third_party/chromium
455 + third_party/devtools-frontend/src/front_end/third_party/codemirror
456 + third_party/devtools-frontend/src/front_end/third_party/diff
457 + third_party/devtools-frontend/src/front_end/third_party/i18n
458 + third_party/devtools-frontend/src/front_end/third_party/intl-messageformat
459 + third_party/devtools-frontend/src/front_end/third_party/lighthouse
460 + third_party/devtools-frontend/src/front_end/third_party/lit
461 + third_party/devtools-frontend/src/front_end/third_party/lodash-isequal
462 + third_party/devtools-frontend/src/front_end/third_party/marked
463 + third_party/devtools-frontend/src/front_end/third_party/puppeteer
464 + third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt
465 + third_party/devtools-frontend/src/front_end/third_party/wasmparser
466 + third_party/devtools-frontend/src/test/unittests/front_end/third_party/i18n
467 + third_party/devtools-frontend/src/third_party
468 + third_party/distributed_point_functions
469 + third_party/dom_distiller_js
470 + third_party/eigen3
471 + third_party/emoji-segmenter
472 + third_party/farmhash
473 + third_party/fdlibm
474 + third_party/fft2d
475 + third_party/flatbuffers
476 + third_party/fp16
477 + third_party/freetype
478 + third_party/fusejs
479 + third_party/fxdiv
480 + third_party/highway
481 + third_party/liburlpattern
482 + third_party/libzip
483 + third_party/gemmlowp
484 + third_party/google_input_tools
485 + third_party/google_input_tools/third_party/closure_library
486 + third_party/google_input_tools/third_party/closure_library/third_party/closure
487 + third_party/googletest
488 + third_party/hunspell
489 + third_party/iccjpeg
490 + third_party/inspector_protocol
491 + third_party/ipcz
492 + third_party/jinja2
493 + third_party/jsoncpp
494 + third_party/jstemplate
495 + third_party/khronos
496 + third_party/leveldatabase
497 + third_party/libaddressinput
498 + third_party/libavif
499 + third_party/libevent
500 + third_party/libgav1
501 + third_party/libjingle
502 + third_party/libphonenumber
503 + third_party/libsecret
504 + third_party/libsrtp
505 + third_party/libsync
506 + third_party/libudev
507 + third_party/libva_protected_content
508 + third_party/libvpx
509 + third_party/libvpx/source/libvpx/third_party/x86inc
510 + third_party/libwebm
511 + third_party/libx11
512 + third_party/libxcb-keysyms
513 + third_party/libxml/chromium
514 + third_party/libyuv
515 + third_party/llvm
516 + third_party/lottie
517 + third_party/lss
518 + third_party/lzma_sdk
519 + third_party/mako
520 + third_party/maldoca
521 + third_party/maldoca/src/third_party/tensorflow_protos
522 + third_party/maldoca/src/third_party/zlibwrapper
523 + third_party/markupsafe
524 + third_party/mesa
525 + third_party/metrics_proto
526 + third_party/minigbm
527 + third_party/modp_b64
528 + third_party/nasm
529 + third_party/nearby
530 + third_party/neon_2_sse
531 + third_party/node
532 + third_party/omnibox_proto
533 + third_party/one_euro_filter
534 + third_party/openscreen
535 + third_party/openscreen/src/third_party/mozilla
536 + third_party/openscreen/src/third_party/tinycbor/src/src
537 + third_party/ots
538 + third_party/pdfium
539 + third_party/pdfium/third_party/agg23
540 + third_party/pdfium/third_party/base
541 + third_party/pdfium/third_party/bigint
542 + third_party/pdfium/third_party/freetype
543 + third_party/pdfium/third_party/lcms
544 + third_party/pdfium/third_party/libopenjpeg
545 + third_party/pdfium/third_party/libtiff
546 + third_party/pdfium/third_party/skia_shared
547 + third_party/perfetto
548 + third_party/perfetto/protos/third_party/chromium
549 + third_party/pffft
550 + third_party/ply
551 + third_party/polymer
552 + third_party/private-join-and-compute
553 + third_party/private_membership
554 + third_party/protobuf
555 + third_party/protobuf/third_party/six
556 + third_party/pthreadpool
557 + third_party/pyjson5
558 + third_party/pyyaml
559 + third_party/qcms
560 + third_party/rnnoise
561 + third_party/s2cellid
562 + third_party/securemessage
563 + third_party/selenium-atoms
564 + third_party/shell-encryption
565 + third_party/simplejson
566 + third_party/skia
567 + third_party/skia/include/third_party/vulkan
568 + third_party/skia/third_party/vulkan
569 + third_party/smhasher
570 + third_party/snappy
571 + third_party/sqlite
572 + third_party/swiftshader
573 + third_party/swiftshader/third_party/astc-encoder
574 + third_party/swiftshader/third_party/llvm-subzero
575 + third_party/swiftshader/third_party/marl
576 + third_party/swiftshader/third_party/subzero
577 + third_party/swiftshader/third_party/SPIRV-Headers/include/spirv
578 + third_party/swiftshader/third_party/SPIRV-Tools
579 + third_party/tensorflow_models
580 + third_party/tensorflow-text
581 + third_party/tflite
582 + third_party/tflite/src/third_party/eigen3
583 + third_party/tflite/src/third_party/fft2d
584 + third_party/ruy
585 + third_party/six
586 + third_party/ukey2
587 + third_party/unrar
588 + third_party/utf
589 + third_party/vulkan
590 + third_party/wayland
591 + third_party/web-animations-js
592 + third_party/webdriver
593 + third_party/webgpu-cts
594 + third_party/webrtc
595 + third_party/webrtc/common_audio/third_party/ooura
596 + third_party/webrtc/common_audio/third_party/spl_sqrt_floor
597 + third_party/webrtc/modules/third_party/fft
598 + third_party/webrtc/modules/third_party/g711
599 + third_party/webrtc/modules/third_party/g722
600 + third_party/webrtc/rtc_base/third_party/base64
601 + third_party/webrtc/rtc_base/third_party/sigslot
602 + third_party/widevine
603 + third_party/woff2
604 + third_party/wuffs
605 + third_party/x11proto
606 + third_party/xcbproto
607 + third_party/xnnpack
608 + third_party/zxcvbn-cpp
609 + third_party/zlib/google
610 + url/third_party/mozilla
611 + v8/src/third_party/siphash
612 + v8/src/third_party/valgrind
613 + v8/src/third_party/utf8-decoder
614 + v8/third_party/glibc
615 + v8/third_party/inspector_protocol
616 + v8/third_party/v8
617 +
618 + # gyp -> gn leftovers
619 + third_party/speech-dispatcher
620 + third_party/usb_ids
621 + third_party/xdg-utils
622 + )
623 + if ! use system-ffmpeg; then
624 + keeplibs+=( third_party/ffmpeg third_party/opus )
625 + fi
626 + if ! use system-icu; then
627 + keeplibs+=( third_party/icu )
628 + fi
629 + if ! use system-png; then
630 + keeplibs+=( third_party/libpng )
631 + fi
632 + if ! use system-av1; then
633 + keeplibs+=(
634 + third_party/dav1d
635 + third_party/libaom
636 + third_party/libaom/source/libaom/third_party/fastfeat
637 + third_party/libaom/source/libaom/third_party/SVT-AV1
638 + third_party/libaom/source/libaom/third_party/vector
639 + third_party/libaom/source/libaom/third_party/x86inc
640 + )
641 + fi
642 + if ! use system-harfbuzz; then
643 + keeplibs+=( third_party/harfbuzz-ng )
644 + fi
645 + if use libcxx; then
646 + keeplibs+=( third_party/re2 )
647 + fi
648 + if use arm64 || use ppc64 ; then
649 + keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 )
650 + fi
651 + # we need to generate ppc64 stuff because upstream does not ship it yet
652 + # it has to be done before unbundling.
653 + if use ppc64; then
654 + pushd third_party/libvpx >/dev/null || die
655 + mkdir -p source/config/linux/ppc64 || die
656 + # requires git and clang, bug #832803
657 + sed -i -e "s|^update_readme||g; s|clang-format|${EPREFIX}/bin/true|g" \
658 + generate_gni.sh || die
659 + ./generate_gni.sh || die
660 + popd >/dev/null || die
661 +
662 + pushd third_party/ffmpeg >/dev/null || die
663 + cp libavcodec/ppc/h264dsp.c libavcodec/ppc/h264dsp_ppc.c || die
664 + cp libavcodec/ppc/h264qpel.c libavcodec/ppc/h264qpel_ppc.c || die
665 + popd >/dev/null || die
666 + fi
667 +
668 + # Remove most bundled libraries. Some are still needed.
669 + build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
670 +
671 + if use js-type-check; then
672 + ln -s "${EPREFIX}"/usr/bin/java third_party/jdk/current/bin/java || die
673 + fi
674 +
675 + # bundled eu-strip is for amd64 only and we don't want to pre-stripped binaries
676 + mkdir -p buildtools/third_party/eu-strip/bin || die
677 + ln -s "${EPREFIX}"/bin/true buildtools/third_party/eu-strip/bin/eu-strip || die
678 +}
679 +
680 +chromium_configure() {
681 + # Calling this here supports resumption via FEATURES=keepwork
682 + python_setup
683 +
684 + local myconf_gn=""
685 +
686 + # Make sure the build system will use the right tools, bug #340795.
687 + tc-export AR CC CXX NM
688 +
689 + if needs_clang && ! tc-is-clang; then
690 + # Force clang since gcc is either broken or build is using libcxx.
691 + if tc-is-cross-compiler; then
692 + CC="${CBUILD}-clang -target ${CHOST} --sysroot ${ESYSROOT}"
693 + CXX="${CBUILD}-clang++ -target ${CHOST} --sysroot ${ESYSROOT}"
694 + BUILD_CC=${CBUILD}-clang
695 + BUILD_CXX=${CBUILD}-clang++
696 + else
697 + CC=${CHOST}-clang
698 + CXX=${CHOST}-clang++
699 + fi
700 + strip-unsupported-flags
701 + fi
702 +
703 + if tc-is-clang; then
704 + myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
705 + else
706 + myconf_gn+=" is_clang=false"
707 + fi
708 +
709 + # Force lld for lto or pgo builds only, otherwise disable, bug 641556
710 + if use lto || use pgo; then
711 + myconf_gn+=" use_lld=true"
712 + else
713 + myconf_gn+=" use_lld=false"
714 + fi
715 +
716 + if use lto || use pgo; then
717 + AR=llvm-ar
718 + NM=llvm-nm
719 + if tc-is-cross-compiler; then
720 + BUILD_AR=llvm-ar
721 + BUILD_NM=llvm-nm
722 + fi
723 + fi
724 +
725 + # Define a custom toolchain for GN
726 + myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
727 +
728 + if tc-is-cross-compiler; then
729 + tc-export BUILD_{AR,CC,CXX,NM}
730 + myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
731 + myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
732 + myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\""
733 + myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\""
734 +
735 + # setup cups-config, build system only uses --libs option
736 + if use cups; then
737 + mkdir "${T}/cups-config" || die
738 + cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die
739 + export PATH="${PATH}:${T}/cups-config"
740 + fi
741 +
742 + # Don't inherit PKG_CONFIG_PATH from environment
743 + local -x PKG_CONFIG_PATH=
744 + else
745 + myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
746 + fi
747 +
748 + # GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
749 + myconf_gn+=" is_debug=false"
750 +
751 + # enable DCHECK with USE=debug only, increases chrome binary size by 30%, bug #811138.
752 + # DCHECK is fatal by default, make it configurable at runtime, #bug 807881.
753 + myconf_gn+=" dcheck_always_on=$(usex debug true false)"
754 + myconf_gn+=" dcheck_is_configurable=$(usex debug true false)"
755 +
756 + # Component build isn't generally intended for use by end users. It's mostly useful
757 + # for development and debugging.
758 + myconf_gn+=" is_component_build=$(usex component-build true false)"
759 +
760 + # Disable nacl, we can't build without pnacl (http://crbug.com/269560).
761 + myconf_gn+=" enable_nacl=false"
762 +
763 + # Use system-provided libraries.
764 + # TODO: freetype -- remove sources (https://bugs.chromium.org/p/pdfium/issues/detail?id=733).
765 + # TODO: use_system_hunspell (upstream changes needed).
766 + # TODO: use_system_protobuf (bug #525560).
767 + # TODO: use_system_sqlite (http://crbug.com/22208).
768 +
769 + # libevent: https://bugs.gentoo.org/593458
770 + local gn_system_libraries=(
771 + flac
772 + fontconfig
773 + freetype
774 + # Need harfbuzz_from_pkgconfig target
775 + #harfbuzz-ng
776 + libdrm
777 + libjpeg
778 + libwebp
779 + libxml
780 + libxslt
781 + openh264
782 + zlib
783 + )
784 + if use system-ffmpeg; then
785 + gn_system_libraries+=( ffmpeg opus )
786 + fi
787 + if use system-icu; then
788 + gn_system_libraries+=( icu )
789 + fi
790 + if use system-png; then
791 + gn_system_libraries+=( libpng )
792 + fi
793 + if use system-av1; then
794 + gn_system_libraries+=( dav1d libaom )
795 + fi
796 + # re2 library interface relies on std::string and std::vector
797 + if ! use libcxx; then
798 + gn_system_libraries+=( re2 )
799 + fi
800 + build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
801 +
802 + # See dependency logic in third_party/BUILD.gn
803 + myconf_gn+=" use_system_harfbuzz=$(usex system-harfbuzz true false)"
804 +
805 + # Disable deprecated libgnome-keyring dependency, bug #713012
806 + myconf_gn+=" use_gnome_keyring=false"
807 +
808 + # Optional dependencies.
809 + myconf_gn+=" enable_js_type_check=$(usex js-type-check true false)"
810 + myconf_gn+=" enable_hangout_services_extension=$(usex hangouts true false)"
811 + myconf_gn+=" enable_widevine=$(usex widevine true false)"
812 +
813 + if use headless; then
814 + myconf_gn+=" use_cups=false"
815 + myconf_gn+=" use_kerberos=false"
816 + myconf_gn+=" use_pulseaudio=false"
817 + myconf_gn+=" use_vaapi=false"
818 + myconf_gn+=" rtc_use_pipewire=false"
819 + else
820 + myconf_gn+=" use_cups=$(usex cups true false)"
821 + myconf_gn+=" use_kerberos=$(usex kerberos true false)"
822 + myconf_gn+=" use_pulseaudio=$(usex pulseaudio true false)"
823 + myconf_gn+=" use_vaapi=$(usex vaapi true false)"
824 + myconf_gn+=" rtc_use_pipewire=$(usex screencast true false)"
825 + myconf_gn+=" gtk_version=$(usex gtk4 4 3)"
826 + fi
827 +
828 + # TODO: link_pulseaudio=true for GN.
829 +
830 + myconf_gn+=" disable_fieldtrial_testing_config=true"
831 +
832 + # Never use bundled gold binary. Disable gold linker flags for now.
833 + # Do not use bundled clang.
834 + # Trying to use gold results in linker crash.
835 + myconf_gn+=" use_gold=false use_sysroot=false"
836 + myconf_gn+=" use_custom_libcxx=$(usex libcxx true false)"
837 +
838 + # Disable pseudolocales, only used for testing
839 + myconf_gn+=" enable_pseudolocales=false"
840 +
841 + # Disable code formating of generated files
842 + myconf_gn+=" blink_enable_generated_code_formatting=false"
843 +
844 + ffmpeg_branding="$(usex proprietary-codecs Chrome Chromium)"
845 + myconf_gn+=" proprietary_codecs=$(usex proprietary-codecs true false)"
846 + myconf_gn+=" ffmpeg_branding=\"${ffmpeg_branding}\""
847 +
848 + # Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys .
849 + # Note: these are for Gentoo use ONLY. For your own distribution,
850 + # please get your own set of keys. Feel free to contact chromium@g.o
851 + # for more info. The OAuth2 credentials, however, have been left out.
852 + # Those OAuth2 credentials have been broken for quite some time anyway.
853 + # Instead we apply a patch to use the --oauth2-client-id= and
854 + # --oauth2-client-secret= switches for setting GOOGLE_DEFAULT_CLIENT_ID and
855 + # GOOGLE_DEFAULT_CLIENT_SECRET at runtime. This allows signing into
856 + # Chromium without baked-in values.
857 + local google_api_key="AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc"
858 + myconf_gn+=" google_api_key=\"${google_api_key}\""
859 + local myarch="$(tc-arch)"
860 +
861 + # Avoid CFLAGS problems, bug #352457, bug #390147.
862 + if ! use custom-cflags; then
863 + replace-flags "-Os" "-O2"
864 + strip-flags
865 +
866 + # Debug info section overflows without component build
867 + # Prevent linker from running out of address space, bug #471810 .
868 + if ! use component-build || use x86; then
869 + filter-flags "-g*"
870 + fi
871 +
872 + # Prevent libvpx/xnnpack build failures. Bug 530248, 544702, 546984, 853646.
873 + if [[ ${myarch} == amd64 || ${myarch} == x86 ]]; then
874 + filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 -mno-avx -mno-avx2 -mno-fma -mno-fma4 -mno-xop -mno-sse4a
875 + fi
876 + fi
877 +
878 + if [[ $myarch = amd64 ]] ; then
879 + myconf_gn+=" target_cpu=\"x64\""
880 + ffmpeg_target_arch=x64
881 + elif [[ $myarch = x86 ]] ; then
882 + myconf_gn+=" target_cpu=\"x86\""
883 + ffmpeg_target_arch=ia32
884 +
885 + # This is normally defined by compiler_cpu_abi in
886 + # build/config/compiler/BUILD.gn, but we patch that part out.
887 + append-flags -msse2 -mfpmath=sse -mmmx
888 + elif [[ $myarch = arm64 ]] ; then
889 + myconf_gn+=" target_cpu=\"arm64\""
890 + ffmpeg_target_arch=arm64
891 + elif [[ $myarch = arm ]] ; then
892 + myconf_gn+=" target_cpu=\"arm\""
893 + ffmpeg_target_arch=$(usex cpu_flags_arm_neon arm-neon arm)
894 + elif [[ $myarch = ppc64 ]] ; then
895 + myconf_gn+=" target_cpu=\"ppc64\""
896 + ffmpeg_target_arch=ppc64
897 + else
898 + die "Failed to determine target arch, got '$myarch'."
899 + fi
900 +
901 + # Make sure that -Werror doesn't get added to CFLAGS by the build system.
902 + # Depending on GCC version the warnings are different and we don't want
903 + # the build to fail because of that.
904 + myconf_gn+=" treat_warnings_as_errors=false"
905 +
906 + # Disable fatal linker warnings, bug 506268.
907 + myconf_gn+=" fatal_linker_warnings=false"
908 +
909 + # Disable external code space for V8 for ppc64. It is disabled for ppc64
910 + # by default, but cross-compiling on amd64 enables it again.
911 + if tc-is-cross-compiler; then
912 + if ! use amd64 && ! use arm64; then
913 + myconf_gn+=" v8_enable_external_code_space=false"
914 + fi
915 + fi
916 +
917 + # Only enabled for clang, but gcc has endian macros too
918 + myconf_gn+=" v8_use_libm_trig_functions=true"
919 +
920 + # Bug 491582.
921 + export TMPDIR="${WORKDIR}/temp"
922 + mkdir -p -m 755 "${TMPDIR}" || die
923 +
924 + # https://bugs.gentoo.org/654216
925 + addpredict /dev/dri/ #nowarn
926 +
927 + #if ! use system-ffmpeg; then
928 + if false; then
929 + local build_ffmpeg_args=""
930 + if use pic && [[ "${ffmpeg_target_arch}" == "ia32" ]]; then
931 + build_ffmpeg_args+=" --disable-asm"
932 + fi
933 +
934 + # Re-configure bundled ffmpeg. See bug #491378 for example reasons.
935 + einfo "Configuring bundled ffmpeg..."
936 + pushd third_party/ffmpeg > /dev/null || die
937 + chromium/scripts/build_ffmpeg.py linux ${ffmpeg_target_arch} \
938 + --branding ${ffmpeg_branding} -- ${build_ffmpeg_args} || die
939 + chromium/scripts/copy_config.sh || die
940 + chromium/scripts/generate_gn.py || die
941 + popd > /dev/null || die
942 + fi
943 +
944 + # Disable unknown warning message from clang.
945 + if tc-is-clang; then
946 + append-flags -Wno-unknown-warning-option
947 + if tc-is-cross-compiler; then
948 + export BUILD_CXXFLAGS+=" -Wno-unknown-warning-option"
949 + export BUILD_CFLAGS+=" -Wno-unknown-warning-option"
950 + fi
951 + fi
952 +
953 + # Explicitly disable ICU data file support for system-icu/headless builds.
954 + if use system-icu || use headless; then
955 + myconf_gn+=" icu_use_data_file=false"
956 + fi
957 +
958 + # Enable ozone wayland and/or headless support
959 + myconf_gn+=" use_ozone=true ozone_auto_platforms=false"
960 + myconf_gn+=" ozone_platform_headless=true"
961 + if use headless; then
962 + myconf_gn+=" ozone_platform=\"headless\""
963 + myconf_gn+=" use_xkbcommon=false use_gtk=false use_qt=false"
964 + myconf_gn+=" use_glib=false use_gio=false"
965 + myconf_gn+=" use_pangocairo=false use_alsa=false"
966 + myconf_gn+=" use_libpci=false use_udev=false"
967 + myconf_gn+=" enable_print_preview=false"
968 + myconf_gn+=" enable_remoting=false"
969 + else
970 + myconf_gn+=" use_system_libdrm=true"
971 + myconf_gn+=" use_system_minigbm=true"
972 + myconf_gn+=" use_xkbcommon=true"
973 + if use qt5; then
974 + local moc_dir="$(qt5_get_bindir)"
975 + if tc-is-cross-compiler; then
976 + # Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
977 + local cbuild_libdir=$($(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libxslt)
978 + cbuild_libdir=${cbuild_libdir:2}
979 + moc_dir="${EPREFIX}"/${cbuild_libdir/% }/qt5/bin
980 + fi
981 + export PATH="${PATH}:${moc_dir}"
982 + fi
983 + myconf_gn+=" use_qt=$(usex qt5 true false)"
984 + myconf_gn+=" ozone_platform_x11=$(usex X true false)"
985 + myconf_gn+=" ozone_platform_wayland=$(usex wayland true false)"
986 + myconf_gn+=" ozone_platform=$(usex wayland \"wayland\" \"x11\")"
987 + use wayland && myconf_gn+=" use_system_libffi=true"
988 + fi
989 +
990 + # Results in undefined references in chrome linking, may require CFI to work
991 + if use arm64; then
992 + myconf_gn+=" arm_control_flow_integrity=\"none\""
993 + fi
994 +
995 + # Enable official builds
996 + myconf_gn+=" is_official_build=$(usex official true false)"
997 + myconf_gn+=" use_thin_lto=$(usex lto true false)"
998 + myconf_gn+=" thin_lto_enable_optimizations=$(usex lto true false)"
999 + if use official; then
1000 + # Allow building against system libraries in official builds
1001 + sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
1002 + tools/generate_shim_headers/generate_shim_headers.py || die
1003 + # Disable CFI: unsupported for GCC, requires clang+lto+lld
1004 + myconf_gn+=" is_cfi=false"
1005 + # Don't add symbols to build
1006 + myconf_gn+=" symbol_level=0"
1007 + fi
1008 +
1009 + if use pgo; then
1010 + myconf_gn+=" chrome_pgo_phase=${1}"
1011 + if [[ "$1" == "2" ]]; then
1012 + myconf_gn+=" pgo_data_path=\"${2}\""
1013 + fi
1014 + else
1015 + # Disable PGO, because profile data is only compatible with >=clang-11
1016 + myconf_gn+=" chrome_pgo_phase=0"
1017 + fi
1018 +
1019 + # user CXXFLAGS might overwrite -march=armv8-a+crc+crypto, bug #851639
1020 + if use arm64 && tc-is-gcc; then
1021 + sed -i '/^#if HAVE_ARM64_CRC32C/a #pragma GCC target ("+crc+crypto")' \
1022 + third_party/crc32c/src/src/crc32c_arm64.cc || die
1023 + fi
1024 +
1025 + # skipping typecheck is only supported on amd64, bug #876157
1026 + if ! use amd64; then
1027 + myconf_gn+=" devtools_skip_typecheck=false"
1028 + fi
1029 +
1030 + einfo "Configuring Chromium..."
1031 + set -- gn gen --args="${myconf_gn} ${EXTRA_GN}" out/Release
1032 + echo "$@"
1033 + "$@" || die
1034 +}
1035 +
1036 +src_configure() {
1037 + chromium_configure $(usex pgo 1 0)
1038 +}
1039 +
1040 +chromium_compile() {
1041 + # Final link uses lots of file descriptors.
1042 + ulimit -n 2048
1043 +
1044 + # Calling this here supports resumption via FEATURES=keepwork
1045 + python_setup
1046 +
1047 + # Don't inherit PYTHONPATH from environment, bug #789021, #812689
1048 + local -x PYTHONPATH=
1049 +
1050 + # Build mksnapshot and pax-mark it.
1051 + local x
1052 + for x in mksnapshot v8_context_snapshot_generator; do
1053 + if tc-is-cross-compiler; then
1054 + eninja -C out/Release "host/${x}"
1055 + pax-mark m "out/Release/host/${x}"
1056 + else
1057 + eninja -C out/Release "${x}"
1058 + pax-mark m "out/Release/${x}"
1059 + fi
1060 + done
1061 +
1062 + # Even though ninja autodetects number of CPUs, we respect
1063 + # user's options, for debugging with -j 1 or any other reason.
1064 + eninja -C out/Release chrome chromedriver
1065 + use suid && eninja -C out/Release chrome_sandbox
1066 +
1067 + pax-mark m out/Release/chrome
1068 +}
1069 +
1070 +# This function is called from virtx, and must always return so that Xvfb
1071 +# session isn't left running. If we return 1, virtx will call die().
1072 +chromium_profile() {
1073 + einfo "Profiling for PGO"
1074 +
1075 + pushd "${WORKDIR}/chromium-profiler-"* >/dev/null || return 1
1076 +
1077 + # Remove old profdata in case profiling was interrupted.
1078 + rm -rf "${1}" || return 1
1079 +
1080 + if ! "${EPYTHON}" ./chromium_profiler.py \
1081 + --chrome-executable "${S}/out/Release/chrome" \
1082 + --chromedriver-executable "${S}/out/Release/chromedriver.unstripped" \
1083 + --add-arg no-sandbox --add-arg disable-dev-shm-usage \
1084 + --profile-output "${1}"; then
1085 + eerror "Profiling failed"
1086 + return 1
1087 + fi
1088 +
1089 + popd >/dev/null || return 1
1090 +}
1091 +
1092 +src_compile() {
1093 + if use pgo; then
1094 + local profdata
1095 +
1096 + profdata="${WORKDIR}/chromium.profdata"
1097 +
1098 + if [[ ! -e "${WORKDIR}/.pgo-profiled" ]]; then
1099 + chromium_compile
1100 + virtx chromium_profile "$profdata"
1101 +
1102 + touch "${WORKDIR}/.pgo-profiled" || die
1103 + fi
1104 +
1105 + if [[ ! -e "${WORKDIR}/.pgo-phase-2-configured" ]]; then
1106 + # Remove phase 1 output
1107 + rm -r out/Release || die
1108 +
1109 + chromium_configure 2 "$profdata"
1110 +
1111 + touch "${WORKDIR}/.pgo-phase-2-configured" || die
1112 + fi
1113 +
1114 + if [[ ! -e "${WORKDIR}/.pgo-phase-2-compiled" ]]; then
1115 + chromium_compile
1116 + touch "${WORKDIR}/.pgo-phase-2-compiled" || die
1117 + fi
1118 + else
1119 + chromium_compile
1120 + fi
1121 +
1122 + mv out/Release/chromedriver{.unstripped,} || die
1123 +
1124 + rm -f out/Release/locales/*.pak.info || die
1125 +
1126 + # Build manpage; bug #684550
1127 + sed -e 's|@@PACKAGE@@|chromium-browser|g;
1128 + s|@@MENUNAME@@|Chromium|g;' \
1129 + chrome/app/resources/manpage.1.in > \
1130 + out/Release/chromium-browser.1 || die
1131 +
1132 + # Build desktop file; bug #706786
1133 + sed -e 's|@@MENUNAME@@|Chromium|g;
1134 + s|@@USR_BIN_SYMLINK_NAME@@|chromium-browser|g;
1135 + s|@@PACKAGE@@|chromium-browser|g;
1136 + s|\(^Exec=\)/usr/bin/|\1|g;' \
1137 + chrome/installer/linux/common/desktop.template > \
1138 + out/Release/chromium-browser-chromium.desktop || die
1139 +
1140 + # Build vk_swiftshader_icd.json; bug #827861
1141 + sed -e 's|${ICD_LIBRARY_PATH}|./libvk_swiftshader.so|g' \
1142 + third_party/swiftshader/src/Vulkan/vk_swiftshader_icd.json.tmpl > \
1143 + out/Release/vk_swiftshader_icd.json || die
1144 +}
1145 +
1146 +src_install() {
1147 + local CHROMIUM_HOME="/usr/$(get_libdir)/chromium-browser"
1148 + exeinto "${CHROMIUM_HOME}"
1149 + doexe out/Release/chrome
1150 +
1151 + if use suid; then
1152 + newexe out/Release/chrome_sandbox chrome-sandbox
1153 + fperms 4755 "${CHROMIUM_HOME}/chrome-sandbox"
1154 + fi
1155 +
1156 + doexe out/Release/chromedriver
1157 + doexe out/Release/chrome_crashpad_handler
1158 +
1159 + ozone_auto_session () {
1160 + use X && use wayland && ! use headless && echo true || echo false
1161 + }
1162 + local sedargs=( -e
1163 + "s:/usr/lib/:/usr/$(get_libdir)/:g;
1164 + s:@@OZONE_AUTO_SESSION@@:$(ozone_auto_session):g"
1165 + )
1166 + sed "${sedargs[@]}" "${FILESDIR}/chromium-launcher-r7.sh" > chromium-launcher.sh || die
1167 + doexe chromium-launcher.sh
1168 +
1169 + # It is important that we name the target "chromium-browser",
1170 + # xdg-utils expect it; bug #355517.
1171 + dosym "${CHROMIUM_HOME}/chromium-launcher.sh" /usr/bin/chromium-browser
1172 + # keep the old symlink around for consistency
1173 + dosym "${CHROMIUM_HOME}/chromium-launcher.sh" /usr/bin/chromium
1174 +
1175 + dosym "${CHROMIUM_HOME}/chromedriver" /usr/bin/chromedriver
1176 +
1177 + # Allow users to override command-line options, bug #357629.
1178 + insinto /etc/chromium
1179 + newins "${FILESDIR}/chromium.default" "default"
1180 +
1181 + pushd out/Release/locales > /dev/null || die
1182 + chromium_remove_language_paks
1183 + popd
1184 +
1185 + insinto "${CHROMIUM_HOME}"
1186 + doins out/Release/*.bin
1187 + doins out/Release/*.pak
1188 + (
1189 + shopt -s nullglob
1190 + local files=(out/Release/*.so out/Release/*.so.[0-9])
1191 + [[ ${#files[@]} -gt 0 ]] && doins "${files[@]}"
1192 + )
1193 +
1194 + if ! use system-icu && ! use headless; then
1195 + doins out/Release/icudtl.dat
1196 + fi
1197 +
1198 + doins -r out/Release/locales
1199 + doins -r out/Release/MEIPreload
1200 +
1201 + # Install vk_swiftshader_icd.json; bug #827861
1202 + doins out/Release/vk_swiftshader_icd.json
1203 +
1204 + if [[ -d out/Release/swiftshader ]]; then
1205 + insinto "${CHROMIUM_HOME}/swiftshader"
1206 + doins out/Release/swiftshader/*.so
1207 + fi
1208 +
1209 + # Install icons
1210 + local branding size
1211 + for size in 16 24 32 48 64 128 256 ; do
1212 + case ${size} in
1213 + 16|32) branding="chrome/app/theme/default_100_percent/chromium" ;;
1214 + *) branding="chrome/app/theme/chromium" ;;
1215 + esac
1216 + newicon -s ${size} "${branding}/product_logo_${size}.png" \
1217 + chromium-browser.png
1218 + done
1219 +
1220 + # Install desktop entry
1221 + domenu out/Release/chromium-browser-chromium.desktop
1222 +
1223 + # Install GNOME default application entry (bug #303100).
1224 + insinto /usr/share/gnome-control-center/default-apps
1225 + newins "${FILESDIR}"/chromium-browser.xml chromium-browser.xml
1226 +
1227 + # Install manpage; bug #684550
1228 + doman out/Release/chromium-browser.1
1229 + dosym chromium-browser.1 /usr/share/man/man1/chromium.1
1230 +
1231 + readme.gentoo_create_doc
1232 +}
1233 +
1234 +pkg_postrm() {
1235 + xdg_icon_cache_update
1236 + xdg_desktop_database_update
1237 +}
1238 +
1239 +pkg_postinst() {
1240 + xdg_icon_cache_update
1241 + xdg_desktop_database_update
1242 + readme.gentoo_print_elog
1243 +
1244 + if ! use headless; then
1245 + if use vaapi; then
1246 + elog "VA-API is disabled by default at runtime. You have to enable it"
1247 + elog "by adding --enable-features=VaapiVideoDecoder to CHROMIUM_FLAGS"
1248 + elog "in /etc/chromium/default."
1249 + fi
1250 + if use screencast; then
1251 + elog "Screencast is disabled by default at runtime. Either enable it"
1252 + elog "by navigating to chrome://flags/#enable-webrtc-pipewire-capturer"
1253 + elog "inside Chromium or add --enable-features=WebRTCPipeWireCapturer"
1254 + elog "to CHROMIUM_FLAGS in /etc/chromium/default."
1255 + fi
1256 + if use gtk4; then
1257 + elog "Chromium prefers GTK3 over GTK4 at runtime. To override this"
1258 + elog "behavior you need to pass --gtk-version=4, e.g. by adding it"
1259 + elog "to CHROMIUM_FLAGS in /etc/chromium/default."
1260 + fi
1261 + fi
1262 +}