Gentoo Archives: gentoo-commits

From: "Jason A. Donenfeld" <zx2c4@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/chromium/, www-client/chromium/files/
Date: Fri, 28 Dec 2018 02:40:39
Message-Id: 1545964794.666ce8363b1335c0b8472d7e650e12240c52f4ea.zx2c4@gentoo
1 commit: 666ce8363b1335c0b8472d7e650e12240c52f4ea
2 Author: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 27 21:18:03 2018 +0000
4 Commit: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 28 02:39:54 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=666ce836
7
8 www-client/chromium: fix widevine and cleanup unused patch
9
10 Fixes: 670928
11 Package-Manager: Portage-2.3.51, Repoman-2.3.12
12 Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>
13
14 .../chromium/chromium-72.0.3626.28-r1.ebuild | 715 +++++++++++++++++++++
15 .../chromium/files/chromium-widevine-r2.patch | 39 --
16 .../chromium/files/chromium-widevine-r4.patch | 24 +
17 3 files changed, 739 insertions(+), 39 deletions(-)
18
19 diff --git a/www-client/chromium/chromium-72.0.3626.28-r1.ebuild b/www-client/chromium/chromium-72.0.3626.28-r1.ebuild
20 new file mode 100644
21 index 00000000000..814e42f8bfc
22 --- /dev/null
23 +++ b/www-client/chromium/chromium-72.0.3626.28-r1.ebuild
24 @@ -0,0 +1,715 @@
25 +# Copyright 1999-2018 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +PYTHON_COMPAT=( python2_7 )
30 +
31 +CHROMIUM_LANGS="am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he
32 + 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
33 + sv sw ta te th tr uk vi zh-CN zh-TW"
34 +
35 +inherit check-reqs chromium-2 desktop flag-o-matic multilib ninja-utils pax-utils portability python-any-r1 readme.gentoo-r1 toolchain-funcs xdg-utils
36 +
37 +DESCRIPTION="Open-source version of Google Chrome web browser"
38 +HOMEPAGE="http://chromium.org/"
39 +SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
40 + https://dev.gentoo.org/~floppym/dist/chromium-webrtc-includes.patch.xz"
41 +
42 +LICENSE="BSD"
43 +SLOT="0"
44 +KEYWORDS="~amd64 ~x86"
45 +IUSE="component-build cups gnome-keyring +hangouts jumbo-build kerberos neon pic +proprietary-codecs pulseaudio selinux +suid +system-ffmpeg +system-icu +system-libvpx +tcmalloc widevine"
46 +RESTRICT="!system-ffmpeg? ( proprietary-codecs? ( bindist ) )"
47 +
48 +COMMON_DEPEND="
49 + >=app-accessibility/at-spi2-atk-2.26:2
50 + app-arch/bzip2:=
51 + cups? ( >=net-print/cups-1.3.11:= )
52 + >=dev-libs/atk-2.26
53 + dev-libs/expat:=
54 + dev-libs/glib:2
55 + system-icu? ( >=dev-libs/icu-59:= )
56 + >=dev-libs/libxml2-2.9.4-r3:=[icu]
57 + dev-libs/libxslt:=
58 + dev-libs/nspr:=
59 + >=dev-libs/nss-3.26:=
60 + >=dev-libs/re2-0.2016.11.01:=
61 + gnome-keyring? ( >=gnome-base/libgnome-keyring-3.12:= )
62 + >=media-libs/alsa-lib-1.0.19:=
63 + media-libs/fontconfig:=
64 + media-libs/freetype:=
65 + >=media-libs/harfbuzz-2.0.0:0=[icu(-)]
66 + media-libs/libjpeg-turbo:=
67 + media-libs/libpng:=
68 + system-libvpx? ( media-libs/libvpx:=[postproc,svc] )
69 + >=media-libs/openh264-1.6.0:=
70 + pulseaudio? ( media-sound/pulseaudio:= )
71 + system-ffmpeg? (
72 + >=media-video/ffmpeg-4:=
73 + || (
74 + media-video/ffmpeg[-samba]
75 + >=net-fs/samba-4.5.10-r1[-debug(-)]
76 + )
77 + !=net-fs/samba-4.5.12-r0
78 + media-libs/opus:=
79 + )
80 + sys-apps/dbus:=
81 + sys-apps/pciutils:=
82 + virtual/udev
83 + x11-libs/cairo:=
84 + x11-libs/gdk-pixbuf:2
85 + x11-libs/gtk+:3[X]
86 + x11-libs/libX11:=
87 + x11-libs/libXcomposite:=
88 + x11-libs/libXcursor:=
89 + x11-libs/libXdamage:=
90 + x11-libs/libXext:=
91 + x11-libs/libXfixes:=
92 + >=x11-libs/libXi-1.6.0:=
93 + x11-libs/libXrandr:=
94 + x11-libs/libXrender:=
95 + x11-libs/libXScrnSaver:=
96 + x11-libs/libXtst:=
97 + x11-libs/pango:=
98 + app-arch/snappy:=
99 + media-libs/flac:=
100 + >=media-libs/libwebp-0.4.0:=
101 + sys-libs/zlib:=[minizip]
102 + kerberos? ( virtual/krb5 )
103 +"
104 +# For nvidia-drivers blocker, see bug #413637 .
105 +RDEPEND="${COMMON_DEPEND}
106 + !<www-plugins/chrome-binary-plugins-57
107 + x11-misc/xdg-utils
108 + virtual/opengl
109 + virtual/ttf-fonts
110 + selinux? ( sec-policy/selinux-chromium )
111 + tcmalloc? ( !<x11-drivers/nvidia-drivers-331.20 )
112 + widevine? ( www-plugins/chrome-binary-plugins[widevine(-)] )
113 +"
114 +# dev-vcs/git - https://bugs.gentoo.org/593476
115 +# sys-apps/sandbox - https://crbug.com/586444
116 +DEPEND="${COMMON_DEPEND}
117 +"
118 +BDEPEND="
119 + >=app-arch/gzip-1.7
120 + !arm? (
121 + dev-lang/yasm
122 + )
123 + dev-lang/perl
124 + dev-util/gn
125 + dev-vcs/git
126 + >=dev-util/gperf-3.0.3
127 + >=dev-util/ninja-1.7.2
128 + >=net-libs/nodejs-7.6.0[inspector]
129 + sys-apps/hwids[usb(+)]
130 + >=sys-devel/bison-2.4.3
131 + sys-devel/flex
132 + virtual/jre
133 + virtual/pkgconfig
134 +"
135 +
136 +: ${CHROMIUM_FORCE_CLANG=no}
137 +
138 +if [[ ${CHROMIUM_FORCE_CLANG} == yes ]]; then
139 + BDEPEND+=" >=sys-devel/clang-5"
140 +fi
141 +
142 +if ! has chromium_pkg_die ${EBUILD_DEATH_HOOKS}; then
143 + EBUILD_DEATH_HOOKS+=" chromium_pkg_die";
144 +fi
145 +
146 +DISABLE_AUTOFORMATTING="yes"
147 +DOC_CONTENTS="
148 +Some web pages may require additional fonts to display properly.
149 +Try installing some of the following packages if some characters
150 +are not displayed properly:
151 +- media-fonts/arphicfonts
152 +- media-fonts/droid
153 +- media-fonts/ipamonafont
154 +- media-fonts/noto
155 +- media-fonts/ja-ipafonts
156 +- media-fonts/takao-fonts
157 +- media-fonts/wqy-microhei
158 +- media-fonts/wqy-zenhei
159 +
160 +To fix broken icons on the Downloads page, you should install an icon
161 +theme that covers the appropriate MIME types, and configure this as your
162 +GTK+ icon theme.
163 +"
164 +
165 +PATCHES=(
166 + "${FILESDIR}/chromium-compiler-r7.patch"
167 + "${FILESDIR}/chromium-widevine-r4.patch"
168 + "${FILESDIR}/chromium-webrtc-r0.patch"
169 + "${FILESDIR}/chromium-memcpy-r0.patch"
170 + "${FILESDIR}/chromium-math.h-r0.patch"
171 + "${FILESDIR}/chromium-stdint.patch"
172 +)
173 +
174 +pre_build_checks() {
175 + #if [[ ${MERGE_TYPE} != binary ]]; then
176 + # local -x CPP="$(tc-getCXX) -E"
177 + # if tc-is-clang && ! version_is_at_least "3.9.1" "$(clang-fullversion)"; then
178 + # # bugs: #601654
179 + # die "At least clang 3.9.1 is required"
180 + # fi
181 + # if tc-is-gcc && ! version_is_at_least 5.0 "$(gcc-version)"; then
182 + # # bugs: #535730, #525374, #518668, #600288, #627356
183 + # die "At least gcc 5.0 is required"
184 + # fi
185 + #fi
186 +
187 + # Check build requirements, bug #541816 and bug #471810 .
188 + CHECKREQS_MEMORY="3G"
189 + CHECKREQS_DISK_BUILD="5G"
190 + if ( shopt -s extglob; is-flagq '-g?(gdb)?([1-9])' ); then
191 + CHECKREQS_DISK_BUILD="25G"
192 + if ! use component-build; then
193 + CHECKREQS_MEMORY="16G"
194 + fi
195 + fi
196 + check-reqs_pkg_setup
197 +}
198 +
199 +pkg_pretend() {
200 + pre_build_checks
201 +}
202 +
203 +pkg_setup() {
204 + pre_build_checks
205 +
206 + chromium_suid_sandbox_check_kernel_config
207 +}
208 +
209 +src_prepare() {
210 + # Calling this here supports resumption via FEATURES=keepwork
211 + python_setup
212 +
213 + default
214 +
215 + pushd third_party/webrtc >/dev/null || die
216 + eapply "${WORKDIR}"/chromium-webrtc-includes.patch
217 + popd >/dev/null || die
218 +
219 + mkdir -p third_party/node/linux/node-linux-x64/bin || die
220 + ln -s "${EPREFIX}"/usr/bin/node third_party/node/linux/node-linux-x64/bin/node || die
221 +
222 + local keeplibs=(
223 + base/third_party/dmg_fp
224 + base/third_party/dynamic_annotations
225 + base/third_party/icu
226 + base/third_party/nspr
227 + base/third_party/superfasthash
228 + base/third_party/symbolize
229 + base/third_party/valgrind
230 + base/third_party/xdg_mime
231 + base/third_party/xdg_user_dirs
232 + buildtools/third_party/libc++
233 + buildtools/third_party/libc++abi
234 + chrome/third_party/mozilla_security_manager
235 + courgette/third_party
236 + net/third_party/http2
237 + net/third_party/mozilla_security_manager
238 + net/third_party/nss
239 + net/third_party/quic
240 + net/third_party/spdy
241 + net/third_party/uri_template
242 + third_party/abseil-cpp
243 + third_party/angle
244 + third_party/angle/src/common/third_party/base
245 + third_party/angle/src/common/third_party/smhasher
246 + third_party/angle/src/common/third_party/xxhash
247 + third_party/angle/src/third_party/compiler
248 + third_party/angle/src/third_party/libXNVCtrl
249 + third_party/angle/src/third_party/trace_event
250 + third_party/angle/third_party/glslang
251 + third_party/angle/third_party/spirv-headers
252 + third_party/angle/third_party/spirv-tools
253 + third_party/angle/third_party/vulkan-headers
254 + third_party/angle/third_party/vulkan-loader
255 + third_party/angle/third_party/vulkan-tools
256 + third_party/angle/third_party/vulkan-validation-layers
257 + third_party/apple_apsl
258 + third_party/blink
259 + third_party/boringssl
260 + third_party/boringssl/src/third_party/fiat
261 + third_party/breakpad
262 + third_party/breakpad/breakpad/src/third_party/curl
263 + third_party/brotli
264 + third_party/cacheinvalidation
265 + third_party/catapult
266 + third_party/catapult/common/py_vulcanize/third_party/rcssmin
267 + third_party/catapult/common/py_vulcanize/third_party/rjsmin
268 + third_party/catapult/third_party/beautifulsoup4
269 + third_party/catapult/third_party/html5lib-python
270 + third_party/catapult/third_party/polymer
271 + third_party/catapult/third_party/six
272 + third_party/catapult/tracing/third_party/d3
273 + third_party/catapult/tracing/third_party/gl-matrix
274 + third_party/catapult/tracing/third_party/jszip
275 + third_party/catapult/tracing/third_party/mannwhitneyu
276 + third_party/catapult/tracing/third_party/oboe
277 + third_party/catapult/tracing/third_party/pako
278 + third_party/ced
279 + third_party/cld_3
280 + third_party/closure_compiler
281 + third_party/crashpad
282 + third_party/crashpad/crashpad/third_party/zlib
283 + third_party/crc32c
284 + third_party/cros_system_api
285 + third_party/devscripts
286 + third_party/dom_distiller_js
287 + third_party/fips181
288 + third_party/flatbuffers
289 + third_party/flot
290 + third_party/freetype
291 + third_party/google_input_tools
292 + third_party/google_input_tools/third_party/closure_library
293 + third_party/google_input_tools/third_party/closure_library/third_party/closure
294 + third_party/googletest
295 + third_party/hunspell
296 + third_party/iccjpeg
297 + third_party/inspector_protocol
298 + third_party/jinja2
299 + third_party/jsoncpp
300 + third_party/jstemplate
301 + third_party/khronos
302 + third_party/leveldatabase
303 + third_party/libXNVCtrl
304 + third_party/libaddressinput
305 + third_party/libaom
306 + third_party/libaom/source/libaom/third_party/vector
307 + third_party/libaom/source/libaom/third_party/x86inc
308 + third_party/libjingle
309 + third_party/libphonenumber
310 + third_party/libsecret
311 + third_party/libsrtp
312 + third_party/libsync
313 + third_party/libudev
314 + third_party/libwebm
315 + third_party/libxml/chromium
316 + third_party/libyuv
317 + third_party/llvm
318 + third_party/lss
319 + third_party/lzma_sdk
320 + third_party/markupsafe
321 + third_party/mesa
322 + third_party/metrics_proto
323 + third_party/modp_b64
324 + third_party/nasm
325 + third_party/node
326 + third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2
327 + third_party/openmax_dl
328 + third_party/ots
329 + third_party/pdfium
330 + third_party/pdfium/third_party/agg23
331 + third_party/pdfium/third_party/base
332 + third_party/pdfium/third_party/bigint
333 + third_party/pdfium/third_party/freetype
334 + third_party/pdfium/third_party/lcms
335 + third_party/pdfium/third_party/libopenjpeg20
336 + third_party/pdfium/third_party/libpng16
337 + third_party/pdfium/third_party/libtiff
338 + third_party/pdfium/third_party/skia_shared
339 + third_party/perfetto
340 + third_party/ply
341 + third_party/polymer
342 + third_party/protobuf
343 + third_party/protobuf/third_party/six
344 + third_party/pyjson5
345 + third_party/qcms
346 + third_party/rnnoise
347 + third_party/s2cellid
348 + third_party/sfntly
349 + third_party/simplejson
350 + third_party/skia
351 + third_party/skia/third_party/gif
352 + third_party/skia/third_party/skcms
353 + third_party/skia/third_party/vulkan
354 + third_party/smhasher
355 + third_party/spirv-headers
356 + third_party/SPIRV-Tools
357 + third_party/sqlite
358 + third_party/swiftshader
359 + third_party/swiftshader/third_party/llvm-subzero
360 + third_party/swiftshader/third_party/subzero
361 + third_party/unrar
362 + third_party/usrsctp
363 + third_party/vulkan
364 + third_party/web-animations-js
365 + third_party/webdriver
366 + third_party/webrtc
367 + third_party/webrtc/common_audio/third_party/fft4g
368 + third_party/webrtc/common_audio/third_party/spl_sqrt_floor
369 + third_party/webrtc/modules/third_party/fft
370 + third_party/webrtc/modules/third_party/g711
371 + third_party/webrtc/modules/third_party/g722
372 + third_party/webrtc/rtc_base/third_party/base64
373 + third_party/webrtc/rtc_base/third_party/sigslot
374 + third_party/widevine
375 + third_party/woff2
376 + third_party/zlib/google
377 + url/third_party/mozilla
378 + v8/src/third_party/valgrind
379 + v8/src/third_party/utf8-decoder
380 + v8/third_party/inspector_protocol
381 + v8/third_party/v8
382 +
383 + # gyp -> gn leftovers
384 + base/third_party/libevent
385 + third_party/adobe
386 + third_party/speech-dispatcher
387 + third_party/usb_ids
388 + third_party/xdg-utils
389 + third_party/yasm/run_yasm.py
390 + )
391 + if ! use system-ffmpeg; then
392 + keeplibs+=( third_party/ffmpeg third_party/opus )
393 + fi
394 + if ! use system-icu; then
395 + keeplibs+=( third_party/icu )
396 + fi
397 + if ! use system-libvpx; then
398 + keeplibs+=( third_party/libvpx )
399 + keeplibs+=( third_party/libvpx/source/libvpx/third_party/x86inc )
400 + fi
401 + if use tcmalloc; then
402 + keeplibs+=( third_party/tcmalloc )
403 + fi
404 +
405 + # Remove most bundled libraries. Some are still needed.
406 + build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
407 +}
408 +
409 +src_configure() {
410 + # Calling this here supports resumption via FEATURES=keepwork
411 + python_setup
412 +
413 + local myconf_gn=""
414 +
415 + # Make sure the build system will use the right tools, bug #340795.
416 + tc-export AR CC CXX NM
417 +
418 + if [[ ${CHROMIUM_FORCE_CLANG} == yes ]] && ! tc-is-clang; then
419 + # Force clang since gcc is pretty broken at the moment.
420 + CC=${CHOST}-clang
421 + CXX=${CHOST}-clang++
422 + strip-unsupported-flags
423 + fi
424 +
425 + if tc-is-clang; then
426 + myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
427 + else
428 + myconf_gn+=" is_clang=false"
429 + fi
430 +
431 + # Define a custom toolchain for GN
432 + myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
433 +
434 + if tc-is-cross-compiler; then
435 + tc-export BUILD_{AR,CC,CXX,NM}
436 + myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
437 + myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
438 + else
439 + myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
440 + fi
441 +
442 + # GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
443 + myconf_gn+=" is_debug=false"
444 +
445 + # Component build isn't generally intended for use by end users. It's mostly useful
446 + # for development and debugging.
447 + myconf_gn+=" is_component_build=$(usex component-build true false)"
448 +
449 + # https://chromium.googlesource.com/chromium/src/+/lkcr/docs/jumbo.md
450 + myconf_gn+=" use_jumbo_build=$(usex jumbo-build true false)"
451 +
452 + myconf_gn+=" use_allocator=$(usex tcmalloc \"tcmalloc\" \"none\")"
453 +
454 + # Disable nacl, we can't build without pnacl (http://crbug.com/269560).
455 + myconf_gn+=" enable_nacl=false"
456 +
457 + # Use system-provided libraries.
458 + # TODO: freetype -- remove sources (https://bugs.chromium.org/p/pdfium/issues/detail?id=733).
459 + # TODO: use_system_hunspell (upstream changes needed).
460 + # TODO: use_system_libsrtp (bug #459932).
461 + # TODO: use_system_protobuf (bug #525560).
462 + # TODO: use_system_ssl (http://crbug.com/58087).
463 + # TODO: use_system_sqlite (http://crbug.com/22208).
464 +
465 + # libevent: https://bugs.gentoo.org/593458
466 + local gn_system_libraries=(
467 + flac
468 + fontconfig
469 + freetype
470 + # Need harfbuzz_from_pkgconfig target
471 + #harfbuzz-ng
472 + libdrm
473 + libjpeg
474 + libpng
475 + libwebp
476 + libxml
477 + libxslt
478 + openh264
479 + re2
480 + snappy
481 + yasm
482 + zlib
483 + )
484 + if use system-ffmpeg; then
485 + gn_system_libraries+=( ffmpeg opus )
486 + fi
487 + if use system-icu; then
488 + gn_system_libraries+=( icu )
489 + fi
490 + if use system-libvpx; then
491 + gn_system_libraries+=( libvpx )
492 + fi
493 + build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
494 +
495 + # See dependency logic in third_party/BUILD.gn
496 + myconf_gn+=" use_system_harfbuzz=true"
497 +
498 + # Optional dependencies.
499 + myconf_gn+=" enable_hangout_services_extension=$(usex hangouts true false)"
500 + myconf_gn+=" enable_widevine=$(usex widevine true false)"
501 + myconf_gn+=" use_cups=$(usex cups true false)"
502 + myconf_gn+=" use_gnome_keyring=$(usex gnome-keyring true false)"
503 + myconf_gn+=" use_kerberos=$(usex kerberos true false)"
504 + myconf_gn+=" use_pulseaudio=$(usex pulseaudio true false)"
505 +
506 + # TODO: link_pulseaudio=true for GN.
507 +
508 + myconf_gn+=" fieldtrial_testing_like_official_build=true"
509 +
510 + # Never use bundled gold binary. Disable gold linker flags for now.
511 + # Do not use bundled clang.
512 + # Trying to use gold results in linker crash.
513 + myconf_gn+=" use_gold=false use_sysroot=false linux_use_bundled_binutils=false use_custom_libcxx=false"
514 +
515 + # Disable forced lld, bug 641556
516 + myconf_gn+=" use_lld=false"
517 +
518 + ffmpeg_branding="$(usex proprietary-codecs Chrome Chromium)"
519 + myconf_gn+=" proprietary_codecs=$(usex proprietary-codecs true false)"
520 + myconf_gn+=" ffmpeg_branding=\"${ffmpeg_branding}\""
521 +
522 + # Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys .
523 + # Note: these are for Gentoo use ONLY. For your own distribution,
524 + # please get your own set of keys. Feel free to contact chromium@g.o
525 + # for more info.
526 + local google_api_key="AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc"
527 + local google_default_client_id="329227923882.apps.googleusercontent.com"
528 + local google_default_client_secret="vgKG0NNv7GoDpbtoFNLxCUXu"
529 + myconf_gn+=" google_api_key=\"${google_api_key}\""
530 + myconf_gn+=" google_default_client_id=\"${google_default_client_id}\""
531 + myconf_gn+=" google_default_client_secret=\"${google_default_client_secret}\""
532 +
533 + local myarch="$(tc-arch)"
534 + if [[ $myarch = amd64 ]] ; then
535 + myconf_gn+=" target_cpu=\"x64\""
536 + ffmpeg_target_arch=x64
537 + elif [[ $myarch = x86 ]] ; then
538 + myconf_gn+=" target_cpu=\"x86\""
539 + ffmpeg_target_arch=ia32
540 +
541 + # This is normally defined by compiler_cpu_abi in
542 + # build/config/compiler/BUILD.gn, but we patch that part out.
543 + append-flags -msse2 -mfpmath=sse -mmmx
544 + elif [[ $myarch = arm64 ]] ; then
545 + myconf_gn+=" target_cpu=\"arm64\""
546 + ffmpeg_target_arch=arm64
547 + elif [[ $myarch = arm ]] ; then
548 + myconf_gn+=" target_cpu=\"arm\""
549 + ffmpeg_target_arch=$(usex neon arm-neon arm)
550 + else
551 + die "Failed to determine target arch, got '$myarch'."
552 + fi
553 +
554 + # Make sure that -Werror doesn't get added to CFLAGS by the build system.
555 + # Depending on GCC version the warnings are different and we don't want
556 + # the build to fail because of that.
557 + myconf_gn+=" treat_warnings_as_errors=false"
558 +
559 + # Disable fatal linker warnings, bug 506268.
560 + myconf_gn+=" fatal_linker_warnings=false"
561 +
562 + # Avoid CFLAGS problems, bug #352457, bug #390147.
563 + if ! use custom-cflags; then
564 + replace-flags "-Os" "-O2"
565 + strip-flags
566 +
567 + # Prevent linker from running out of address space, bug #471810 .
568 + if use x86; then
569 + filter-flags "-g*"
570 + fi
571 +
572 + # Prevent libvpx build failures. Bug 530248, 544702, 546984.
573 + if [[ ${myarch} == amd64 || ${myarch} == x86 ]]; then
574 + filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 -mno-avx -mno-avx2
575 + fi
576 + fi
577 +
578 + # https://bugs.gentoo.org/588596
579 + #append-cxxflags $(test-flags-CXX -fno-delete-null-pointer-checks)
580 +
581 + # Bug 491582.
582 + export TMPDIR="${WORKDIR}/temp"
583 + mkdir -p -m 755 "${TMPDIR}" || die
584 +
585 + # https://bugs.gentoo.org/654216
586 + addpredict /dev/dri/ #nowarn
587 +
588 + #if ! use system-ffmpeg; then
589 + if false; then
590 + local build_ffmpeg_args=""
591 + if use pic && [[ "${ffmpeg_target_arch}" == "ia32" ]]; then
592 + build_ffmpeg_args+=" --disable-asm"
593 + fi
594 +
595 + # Re-configure bundled ffmpeg. See bug #491378 for example reasons.
596 + einfo "Configuring bundled ffmpeg..."
597 + pushd third_party/ffmpeg > /dev/null || die
598 + chromium/scripts/build_ffmpeg.py linux ${ffmpeg_target_arch} \
599 + --branding ${ffmpeg_branding} -- ${build_ffmpeg_args} || die
600 + chromium/scripts/copy_config.sh || die
601 + chromium/scripts/generate_gn.py || die
602 + popd > /dev/null || die
603 + fi
604 +
605 + einfo "Configuring Chromium..."
606 + set -- gn gen --args="${myconf_gn} ${EXTRA_GN}" out/Release
607 + echo "$@"
608 + "$@" || die
609 +}
610 +
611 +src_compile() {
612 + # Final link uses lots of file descriptors.
613 + ulimit -n 2048
614 +
615 + # Calling this here supports resumption via FEATURES=keepwork
616 + python_setup
617 +
618 + #"${EPYTHON}" tools/clang/scripts/update.py --force-local-build --gcc-toolchain /usr --skip-checkout --use-system-cmake --without-android || die
619 +
620 + # Work around broken deps
621 + eninja -C out/Release gen/ui/accessibility/ax_enums.mojom{,-shared}.h
622 +
623 + # Build mksnapshot and pax-mark it.
624 + local x
625 + for x in mksnapshot v8_context_snapshot_generator; do
626 + if tc-is-cross-compiler; then
627 + eninja -C out/Release "host/${x}"
628 + pax-mark m "out/Release/host/${x}"
629 + else
630 + eninja -C out/Release "${x}"
631 + pax-mark m "out/Release/${x}"
632 + fi
633 + done
634 +
635 + # Even though ninja autodetects number of CPUs, we respect
636 + # user's options, for debugging with -j 1 or any other reason.
637 + eninja -C out/Release chrome chromedriver
638 + use suid && eninja -C out/Release chrome_sandbox
639 +
640 + pax-mark m out/Release/chrome
641 +}
642 +
643 +src_install() {
644 + local CHROMIUM_HOME="/usr/$(get_libdir)/chromium-browser"
645 + exeinto "${CHROMIUM_HOME}"
646 + doexe out/Release/chrome
647 +
648 + if use suid; then
649 + newexe out/Release/chrome_sandbox chrome-sandbox
650 + fperms 4755 "${CHROMIUM_HOME}/chrome-sandbox"
651 + fi
652 +
653 + doexe out/Release/chromedriver
654 +
655 + local sedargs=( -e "s:/usr/lib/:/usr/$(get_libdir)/:g" )
656 + sed "${sedargs[@]}" "${FILESDIR}/chromium-launcher-r3.sh" > chromium-launcher.sh || die
657 + doexe chromium-launcher.sh
658 +
659 + # It is important that we name the target "chromium-browser",
660 + # xdg-utils expect it; bug #355517.
661 + dosym "${CHROMIUM_HOME}/chromium-launcher.sh" /usr/bin/chromium-browser
662 + # keep the old symlink around for consistency
663 + dosym "${CHROMIUM_HOME}/chromium-launcher.sh" /usr/bin/chromium
664 +
665 + dosym "${CHROMIUM_HOME}/chromedriver" /usr/bin/chromedriver
666 +
667 + # Allow users to override command-line options, bug #357629.
668 + insinto /etc/chromium
669 + newins "${FILESDIR}/chromium.default" "default"
670 +
671 + pushd out/Release/locales > /dev/null || die
672 + chromium_remove_language_paks
673 + popd
674 +
675 + insinto "${CHROMIUM_HOME}"
676 + doins out/Release/*.bin
677 + doins out/Release/*.pak
678 + doins out/Release/*.so
679 +
680 + if ! use system-icu; then
681 + doins out/Release/icudtl.dat
682 + fi
683 +
684 + doins -r out/Release/locales
685 + doins -r out/Release/resources
686 +
687 + if [[ -d out/Release/swiftshader ]]; then
688 + insinto "${CHROMIUM_HOME}/swiftshader"
689 + doins out/Release/swiftshader/*.so
690 + fi
691 +
692 + # Install icons and desktop entry.
693 + local branding size
694 + for size in 16 22 24 32 48 64 128 256 ; do
695 + case ${size} in
696 + 16|32) branding="chrome/app/theme/default_100_percent/chromium" ;;
697 + *) branding="chrome/app/theme/chromium" ;;
698 + esac
699 + newicon -s ${size} "${branding}/product_logo_${size}.png" \
700 + chromium-browser.png
701 + done
702 +
703 + local mime_types="text/html;text/xml;application/xhtml+xml;"
704 + mime_types+="x-scheme-handler/http;x-scheme-handler/https;" # bug #360797
705 + mime_types+="x-scheme-handler/ftp;" # bug #412185
706 + mime_types+="x-scheme-handler/mailto;x-scheme-handler/webcal;" # bug #416393
707 + make_desktop_entry \
708 + chromium-browser \
709 + "Chromium" \
710 + chromium-browser \
711 + "Network;WebBrowser" \
712 + "MimeType=${mime_types}\nStartupWMClass=chromium-browser"
713 + sed -e "/^Exec/s/$/ %U/" -i "${ED}"/usr/share/applications/*.desktop || die
714 +
715 + # Install GNOME default application entry (bug #303100).
716 + insinto /usr/share/gnome-control-center/default-apps
717 + newins "${FILESDIR}"/chromium-browser.xml chromium-browser.xml
718 +
719 + readme.gentoo_create_doc
720 +}
721 +
722 +pkg_postrm() {
723 + if type gtk-update-icon-cache &>/dev/null; then
724 + ebegin "Updating GTK icon cache"
725 + gtk-update-icon-cache "${EROOT}/usr/share/icons/hicolor"
726 + eend $?
727 + fi
728 + xdg_desktop_database_update
729 +}
730 +
731 +pkg_postinst() {
732 + if type gtk-update-icon-cache &>/dev/null; then
733 + ebegin "Updating GTK icon cache"
734 + gtk-update-icon-cache "${EROOT}/usr/share/icons/hicolor"
735 + eend $?
736 + fi
737 + xdg_desktop_database_update
738 + readme.gentoo_print_elog
739 +}
740
741 diff --git a/www-client/chromium/files/chromium-widevine-r2.patch b/www-client/chromium/files/chromium-widevine-r2.patch
742 deleted file mode 100644
743 index 5527f7f293c..00000000000
744 --- a/www-client/chromium/files/chromium-widevine-r2.patch
745 +++ /dev/null
746 @@ -1,39 +0,0 @@
747 -Minimal patch to get chromium to compile with widevine support.
748 -
749 -Exactly the same as -r1, but we now need to patch
750 -ninja to pretty please not terminate our build.
751 -
752 -caveat emptor: it's in no way clear that building chromium this
753 -way is safer, from a security perspective, than whatever Google
754 -Chrome does.
755 -
756 -Upstream appears to be cooking up a code-signing trust-chain
757 -which may protect users against malicious cdm blobs; I doubt
758 -we benefit from these using this kludge. Ideally, someone
759 -would look into this more carefully than I have ... tbh as
760 -soon as I got my "stories" back, I pretty much lost interest :)
761 -
762 --gmt
763 -
764 ---
765 ---- a/third_party/widevine/cdm/stub/widevine_cdm_version.h
766 -+++ b/third_party/widevine/cdm/stub/widevine_cdm_version.h
767 -@@ -10,6 +10,7 @@
768 -
769 - #include "third_party/widevine/cdm/widevine_cdm_common.h"
770 -
771 -+#define WIDEVINE_CDM_VERSION_STRING "unknown"
772 - #define WIDEVINE_CDM_AVAILABLE
773 -
774 - #endif // WIDEVINE_CDM_VERSION_H_
775 ---- a/third_party/widevine/cdm/BUILD.gn
776 -+++ b/third_party/widevine/cdm/BUILD.gn
777 -@@ -11,7 +11,7 @@ import("//third_party/widevine/cdm/widev
778 - # Internal Cast builds set enable_widevine=true to bring in Widevine support.
779 - # TODO(xhwang): Support component updated CDM on other platforms and remove this
780 - # assert.
781 --assert(!enable_widevine || is_win || is_mac || is_chromecast,
782 -+assert(!enable_widevine || is_win || is_mac || is_chromecast || is_linux,
783 - "Component updated CDM only supported on Windows and Mac for now.")
784 -
785 - widevine_arch = current_cpu
786
787 diff --git a/www-client/chromium/files/chromium-widevine-r4.patch b/www-client/chromium/files/chromium-widevine-r4.patch
788 new file mode 100644
789 index 00000000000..5f912a675a2
790 --- /dev/null
791 +++ b/www-client/chromium/files/chromium-widevine-r4.patch
792 @@ -0,0 +1,24 @@
793 +Define WIDEVINE_CDM_VERSION_STRING && re-re-re-patch for latest ninja
794 +--
795 +diff -urpN a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
796 +--- a/chrome/common/chrome_content_client.cc 2018-12-19 13:48:52.000000000 -0800
797 ++++ b/chrome/common/chrome_content_client.cc 2018-12-25 20:24:51.062139147 -0800
798 +@@ -99,7 +99,7 @@
799 + // Registers Widevine CDM if Widevine is enabled, the Widevine CDM is
800 + // bundled and not a component. When the Widevine CDM is a component, it is
801 + // registered in widevine_cdm_component_installer.cc.
802 +-#if BUILDFLAG(BUNDLE_WIDEVINE_CDM) && !BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
803 ++#if BUILDFLAG(ENABLE_WIDEVINE) && !BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
804 + #define REGISTER_BUNDLED_WIDEVINE_CDM
805 + #include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck
806 + // TODO(crbug.com/663554): Needed for WIDEVINE_CDM_VERSION_STRING. Support
807 +diff -urpN a/third_party/widevine/cdm/widevine_cdm_version.h b/third_party/widevine/cdm/widevine_cdm_version.h
808 +--- a/third_party/widevine/cdm/widevine_cdm_version.h 2018-12-19 13:49:55.000000000 -0800
809 ++++ b/third_party/widevine/cdm/widevine_cdm_version.h 2018-12-25 20:30:09.290141783 -0800
810 +@@ -11,5 +11,6 @@
811 + // If the Widevine CDM is available define the following:
812 + // - WIDEVINE_CDM_VERSION_STRING (with the version of the CDM that's available
813 + // as a string, e.g., "1.0.123.456").
814 ++#define WIDEVINE_CDM_VERSION_STRING "unknown"
815 +
816 + #endif // WIDEVINE_CDM_VERSION_H_