mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-23 23:27:12 -08:00
www-client/chromium: security cleanup
Bug: https://bugs.gentoo.org/766207 Package-Manager: Portage-3.0.13, Repoman-3.0.2 Signed-off-by: Stephan Hartmann <sultan@gentoo.org>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
DIST chromium-87-patchset-9.tar.xz 6036 BLAKE2B 4dd9aa0e88f11a9104cb13e73607c3b4fcd7e9cb556034472e2fd46158db6e7505b22c098df1c7cab6c7ff06ba6dc45914dcab58a405e0eafffa58d8b0cafbbf SHA512 c036ee20b4906bdb1b3104ecacf30a092ee3662ec10754bf2b168f1b7e1dbf593216e4dc70f8264540fadf91a33b48a8b8040028966dfcc8d8be99807b5f1b99
|
||||
DIST chromium-87.0.4280.141.tar.xz 856467564 BLAKE2B 9c0a43b3326bcfba911e5d19e984c9722d31559664b30398da9f0067106957b154c04968f9376d9b3709e34edb248ca55abe8050f33622152cbe837c95e55c08 SHA512 402a8ff60512b855925cefa862093b70629376d99bc465e3255aeecea29d79a04e5f9bf72c7a497d768b7987b855bc8e8819ebaa5226ca3f5c9d6602e9cd62d6
|
||||
DIST chromium-88-patchset-3.tar.xz 8396 BLAKE2B 4c978f1a6efef3f71e3dd6340c392b74bc6a734b49a9ca43343d03903159dafc66159939f9a6c4b55665ddbe7bd97a26d8d86c285ec02cf76cad5f5cc7410570 SHA512 c39afa26f5b0b9930f6f67ce0c42eefd74c09d528b26bc0db57129b150f75ff83c8b1cb97bd9c5d75f288fb4767cc68c9c5ce89231b4a59f8ca02493e4dd281a
|
||||
DIST chromium-88.0.4324.96.tar.xz 857138392 BLAKE2B 6c3136ff7bd0fe3cde3cfd9340804b5ddd9dd10f892870eac677a2364b8ddd8a6ab09770b167287e890b525d0ef572a5c03a1e8e28d1d16740043ae17ad56746 SHA512 f51e6dbbd4ea2b6528a601c1bd7e76820a4b614f05366d2999b4a30d8e13581279f69a1a76d3f417ae1cea38f9f834d011f754d078784a70388e2cde0ccba6b6
|
||||
DIST chromium-89-patchset-5.tar.xz 5712 BLAKE2B f9cd9bc584048b6e96e74938aa8f7ba8238ab772d184697fd3af1df061f97ce135d9372531e6313618e66470fa94c28128daf916b18cb0c1246ddba3564c6f35 SHA512 9b2480c4eeccb6adc1b74e92e4d31737a99b2da5ebc3b6a90d90c1b5648e4a280aeb93231d1a926b03fb30fec71e72568a6cfe08783bc5870f081cca68f135e3
|
||||
|
||||
@@ -1,900 +0,0 @@
|
||||
# Copyright 2009-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
PYTHON_COMPAT=( python2_7 )
|
||||
PYTHON_REQ_USE="xml"
|
||||
|
||||
CHROMIUM_LANGS="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 vi zh-CN zh-TW"
|
||||
|
||||
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
|
||||
|
||||
DESCRIPTION="Open-source version of Google Chrome web browser"
|
||||
HOMEPAGE="https://chromium.org/"
|
||||
PATCHSET="9"
|
||||
PATCHSET_NAME="chromium-$(ver_cut 1)-patchset-${PATCHSET}"
|
||||
SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz
|
||||
https://files.pythonhosted.org/packages/ed/7b/bbf89ca71e722b7f9464ebffe4b5ee20a9e5c9a555a56e2d3914bb9119a6/setuptools-44.1.0.zip
|
||||
https://github.com/stha09/chromium-patches/releases/download/${PATCHSET_NAME}/${PATCHSET_NAME}.tar.xz"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm64 ~x86"
|
||||
IUSE="component-build cups cpu_flags_arm_neon +hangouts headless +js-type-check kerberos official pic +proprietary-codecs pulseaudio selinux +suid +system-ffmpeg +system-icu +tcmalloc vaapi wayland widevine"
|
||||
REQUIRED_USE="
|
||||
component-build? ( !suid )
|
||||
"
|
||||
|
||||
COMMON_X_DEPEND="
|
||||
media-libs/mesa:=[gbm]
|
||||
x11-libs/libX11:=
|
||||
x11-libs/libXcomposite:=
|
||||
x11-libs/libXcursor:=
|
||||
x11-libs/libXdamage:=
|
||||
x11-libs/libXext:=
|
||||
x11-libs/libXfixes:=
|
||||
>=x11-libs/libXi-1.6.0:=
|
||||
x11-libs/libXrandr:=
|
||||
x11-libs/libXrender:=
|
||||
x11-libs/libXtst:=
|
||||
x11-libs/libXScrnSaver:=
|
||||
x11-libs/libxcb:=
|
||||
vaapi? ( >=x11-libs/libva-2.7:=[X,drm] )
|
||||
"
|
||||
|
||||
COMMON_DEPEND="
|
||||
app-arch/bzip2:=
|
||||
cups? ( >=net-print/cups-1.3.11:= )
|
||||
dev-libs/expat:=
|
||||
dev-libs/glib:2
|
||||
>=dev-libs/libxml2-2.9.4-r3:=[icu]
|
||||
dev-libs/nspr:=
|
||||
>=dev-libs/nss-3.26:=
|
||||
>=media-libs/alsa-lib-1.0.19:=
|
||||
media-libs/fontconfig:=
|
||||
media-libs/freetype:=
|
||||
>=media-libs/harfbuzz-2.4.0:0=[icu(-)]
|
||||
media-libs/libjpeg-turbo:=
|
||||
media-libs/libpng:=
|
||||
pulseaudio? ( media-sound/pulseaudio:= )
|
||||
system-ffmpeg? (
|
||||
>=media-video/ffmpeg-4.3:=
|
||||
|| (
|
||||
media-video/ffmpeg[-samba]
|
||||
>=net-fs/samba-4.5.10-r1[-debug(-)]
|
||||
)
|
||||
>=media-libs/opus-1.3.1:=
|
||||
)
|
||||
sys-apps/dbus:=
|
||||
sys-apps/pciutils:=
|
||||
virtual/udev
|
||||
x11-libs/cairo:=
|
||||
x11-libs/gdk-pixbuf:2
|
||||
x11-libs/pango:=
|
||||
media-libs/flac:=
|
||||
>=media-libs/libwebp-0.4.0:=
|
||||
sys-libs/zlib:=[minizip]
|
||||
kerberos? ( virtual/krb5 )
|
||||
!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
|
||||
x11-libs/gtk+:3[X]
|
||||
wayland? (
|
||||
dev-libs/wayland:=
|
||||
dev-libs/libffi:=
|
||||
x11-libs/gtk+:3[wayland,X]
|
||||
x11-libs/libdrm:=
|
||||
x11-libs/libxkbcommon:=
|
||||
)
|
||||
)
|
||||
"
|
||||
# For nvidia-drivers blocker, see bug #413637 .
|
||||
RDEPEND="${COMMON_DEPEND}
|
||||
x11-misc/xdg-utils
|
||||
virtual/opengl
|
||||
virtual/ttf-fonts
|
||||
selinux? ( sec-policy/selinux-chromium )
|
||||
tcmalloc? ( !<x11-drivers/nvidia-drivers-331.20 )
|
||||
"
|
||||
DEPEND="${COMMON_DEPEND}
|
||||
"
|
||||
# dev-vcs/git - https://bugs.gentoo.org/593476
|
||||
BDEPEND="
|
||||
${PYTHON_DEPS}
|
||||
>=app-arch/gzip-1.7
|
||||
app-arch/unzip
|
||||
dev-lang/perl
|
||||
>=dev-util/gn-0.1807
|
||||
dev-vcs/git
|
||||
>=dev-util/gperf-3.0.3
|
||||
>=dev-util/ninja-1.7.2
|
||||
>=net-libs/nodejs-7.6.0[inspector]
|
||||
sys-apps/hwids[usb(+)]
|
||||
>=sys-devel/bison-2.4.3
|
||||
sys-devel/flex
|
||||
virtual/pkgconfig
|
||||
js-type-check? ( virtual/jre )
|
||||
"
|
||||
|
||||
# These are intended for ebuild maintainer use to force clang if GCC is broken.
|
||||
: ${CHROMIUM_FORCE_CLANG=no}
|
||||
: ${CHROMIUM_FORCE_LIBCXX=no}
|
||||
|
||||
if [[ ${CHROMIUM_FORCE_CLANG} == yes ]]; then
|
||||
BDEPEND+=" >=sys-devel/clang-10"
|
||||
fi
|
||||
|
||||
if [[ ${CHROMIUM_FORCE_LIBCXX} == yes ]]; then
|
||||
RDEPEND+=" >=sys-libs/libcxx-10"
|
||||
DEPEND+=" >=sys-libs/libcxx-10"
|
||||
else
|
||||
COMMON_DEPEND="
|
||||
app-arch/snappy:=
|
||||
dev-libs/libxslt:=
|
||||
>=dev-libs/re2-0.2019.08.01:=
|
||||
>=media-libs/openh264-1.6.0:=
|
||||
system-icu? ( >=dev-libs/icu-67.1:= )
|
||||
"
|
||||
RDEPEND+="${COMMON_DEPEND}"
|
||||
DEPEND+="${COMMON_DEPEND}"
|
||||
fi
|
||||
|
||||
if ! has chromium_pkg_die ${EBUILD_DEATH_HOOKS}; then
|
||||
EBUILD_DEATH_HOOKS+=" chromium_pkg_die";
|
||||
fi
|
||||
|
||||
DISABLE_AUTOFORMATTING="yes"
|
||||
DOC_CONTENTS="
|
||||
Some web pages may require additional fonts to display properly.
|
||||
Try installing some of the following packages if some characters
|
||||
are not displayed properly:
|
||||
- media-fonts/arphicfonts
|
||||
- media-fonts/droid
|
||||
- media-fonts/ipamonafont
|
||||
- media-fonts/noto
|
||||
- media-fonts/ja-ipafonts
|
||||
- media-fonts/takao-fonts
|
||||
- media-fonts/wqy-microhei
|
||||
- media-fonts/wqy-zenhei
|
||||
|
||||
To fix broken icons on the Downloads page, you should install an icon
|
||||
theme that covers the appropriate MIME types, and configure this as your
|
||||
GTK+ icon theme.
|
||||
|
||||
For native file dialogs in KDE, install kde-apps/kdialog.
|
||||
|
||||
To make password storage work with your desktop environment you may
|
||||
have install one of the supported credentials management applications:
|
||||
- app-crypt/libsecret (GNOME)
|
||||
- kde-frameworks/kwallet (KDE)
|
||||
If you have one of above packages installed, but don't want to use
|
||||
them in Chromium, then add --password-store=basic to CHROMIUM_FLAGS
|
||||
in /etc/chromium/default.
|
||||
"
|
||||
|
||||
pre_build_checks() {
|
||||
if [[ ${MERGE_TYPE} != binary ]]; then
|
||||
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"
|
||||
fi
|
||||
# component build hangs with tcmalloc enabled due to sandbox issue, bug #695976.
|
||||
if has usersandbox ${FEATURES} && use tcmalloc && use component-build; then
|
||||
die "Component build with tcmalloc requires FEATURES=-usersandbox."
|
||||
fi
|
||||
if [[ ${CHROMIUM_FORCE_CLANG} == yes ]] || tc-is-clang; then
|
||||
if use component-build; then
|
||||
die "Component build with clang requires fuzzer headers."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check build requirements, bug #541816 and bug #471810 .
|
||||
CHECKREQS_MEMORY="3G"
|
||||
CHECKREQS_DISK_BUILD="7G"
|
||||
if ( shopt -s extglob; is-flagq '-g?(gdb)?([1-9])' ); then
|
||||
if use custom-cflags || use component-build; then
|
||||
CHECKREQS_DISK_BUILD="25G"
|
||||
fi
|
||||
if ! use component-build; then
|
||||
CHECKREQS_MEMORY="16G"
|
||||
fi
|
||||
fi
|
||||
check-reqs_pkg_setup
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
pre_build_checks
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
pre_build_checks
|
||||
|
||||
chromium_suid_sandbox_check_kernel_config
|
||||
|
||||
# nvidia-drivers does not work correctly with Wayland due to unsupported EGLStreams
|
||||
if use wayland && ! use headless && has_version "x11-drivers/nvidia-drivers"; then
|
||||
ewarn "Proprietary nVidia driver does not work with Wayland. You can disable"
|
||||
ewarn "Wayland by setting DISABLE_OZONE_PLATFORM=true in /etc/chromium/default."
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Calling this here supports resumption via FEATURES=keepwork
|
||||
python_setup
|
||||
|
||||
rm "${WORKDIR}/patches/chromium-84-blink-disable-clang-format.patch" || die
|
||||
|
||||
local PATCHES=(
|
||||
"${WORKDIR}/patches"
|
||||
"${FILESDIR}/chromium-87-ozone-deps.patch"
|
||||
"${FILESDIR}/chromium-87-webcodecs-deps.patch"
|
||||
"${FILESDIR}/chromium-87-v8-icu68.patch"
|
||||
"${FILESDIR}/chromium-87-icu68.patch"
|
||||
)
|
||||
|
||||
if use vaapi; then
|
||||
PATCHES+=( "${FILESDIR}/chromium-86-fix-vaapi-on-intel.patch" )
|
||||
fi
|
||||
|
||||
default
|
||||
|
||||
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
|
||||
|
||||
local keeplibs=(
|
||||
base/third_party/cityhash
|
||||
base/third_party/double_conversion
|
||||
base/third_party/dynamic_annotations
|
||||
base/third_party/icu
|
||||
base/third_party/nspr
|
||||
base/third_party/superfasthash
|
||||
base/third_party/symbolize
|
||||
base/third_party/valgrind
|
||||
base/third_party/xdg_mime
|
||||
base/third_party/xdg_user_dirs
|
||||
buildtools/third_party/libc++
|
||||
buildtools/third_party/libc++abi
|
||||
chrome/third_party/mozilla_security_manager
|
||||
courgette/third_party
|
||||
net/third_party/mozilla_security_manager
|
||||
net/third_party/nss
|
||||
net/third_party/quic
|
||||
net/third_party/uri_template
|
||||
third_party/abseil-cpp
|
||||
third_party/angle
|
||||
third_party/angle/src/common/third_party/base
|
||||
third_party/angle/src/common/third_party/smhasher
|
||||
third_party/angle/src/common/third_party/xxhash
|
||||
third_party/angle/src/third_party/compiler
|
||||
third_party/angle/src/third_party/libXNVCtrl
|
||||
third_party/angle/src/third_party/trace_event
|
||||
third_party/angle/src/third_party/volk
|
||||
third_party/angle/third_party/glslang
|
||||
third_party/angle/third_party/spirv-headers
|
||||
third_party/angle/third_party/spirv-tools
|
||||
third_party/angle/third_party/vulkan-headers
|
||||
third_party/angle/third_party/vulkan-loader
|
||||
third_party/angle/third_party/vulkan-tools
|
||||
third_party/angle/third_party/vulkan-validation-layers
|
||||
third_party/apple_apsl
|
||||
third_party/axe-core
|
||||
third_party/blink
|
||||
third_party/boringssl
|
||||
third_party/boringssl/src/third_party/fiat
|
||||
third_party/breakpad
|
||||
third_party/breakpad/breakpad/src/third_party/curl
|
||||
third_party/brotli
|
||||
third_party/catapult
|
||||
third_party/catapult/common/py_vulcanize/third_party/rcssmin
|
||||
third_party/catapult/common/py_vulcanize/third_party/rjsmin
|
||||
third_party/catapult/third_party/beautifulsoup4
|
||||
third_party/catapult/third_party/html5lib-python
|
||||
third_party/catapult/third_party/polymer
|
||||
third_party/catapult/third_party/six
|
||||
third_party/catapult/tracing/third_party/d3
|
||||
third_party/catapult/tracing/third_party/gl-matrix
|
||||
third_party/catapult/tracing/third_party/jpeg-js
|
||||
third_party/catapult/tracing/third_party/jszip
|
||||
third_party/catapult/tracing/third_party/mannwhitneyu
|
||||
third_party/catapult/tracing/third_party/oboe
|
||||
third_party/catapult/tracing/third_party/pako
|
||||
third_party/ced
|
||||
third_party/cld_3
|
||||
third_party/closure_compiler
|
||||
third_party/crashpad
|
||||
third_party/crashpad/crashpad/third_party/lss
|
||||
third_party/crashpad/crashpad/third_party/zlib
|
||||
third_party/crc32c
|
||||
third_party/cros_system_api
|
||||
third_party/dav1d
|
||||
third_party/dawn
|
||||
third_party/depot_tools
|
||||
third_party/devscripts
|
||||
third_party/devtools-frontend
|
||||
third_party/devtools-frontend/src/front_end/third_party/acorn
|
||||
third_party/devtools-frontend/src/front_end/third_party/axe-core
|
||||
third_party/devtools-frontend/src/front_end/third_party/chromium
|
||||
third_party/devtools-frontend/src/front_end/third_party/codemirror
|
||||
third_party/devtools-frontend/src/front_end/third_party/fabricjs
|
||||
third_party/devtools-frontend/src/front_end/third_party/i18n
|
||||
third_party/devtools-frontend/src/front_end/third_party/intl-messageformat
|
||||
third_party/devtools-frontend/src/front_end/third_party/lighthouse
|
||||
third_party/devtools-frontend/src/front_end/third_party/lit-html
|
||||
third_party/devtools-frontend/src/front_end/third_party/lodash-isequal
|
||||
third_party/devtools-frontend/src/front_end/third_party/marked
|
||||
third_party/devtools-frontend/src/front_end/third_party/puppeteer
|
||||
third_party/devtools-frontend/src/front_end/third_party/wasmparser
|
||||
third_party/devtools-frontend/src/third_party
|
||||
third_party/dom_distiller_js
|
||||
third_party/emoji-segmenter
|
||||
third_party/flatbuffers
|
||||
third_party/freetype
|
||||
third_party/libgifcodec
|
||||
third_party/glslang
|
||||
third_party/google_input_tools
|
||||
third_party/google_input_tools/third_party/closure_library
|
||||
third_party/google_input_tools/third_party/closure_library/third_party/closure
|
||||
third_party/googletest
|
||||
third_party/harfbuzz-ng/utils
|
||||
third_party/hunspell
|
||||
third_party/iccjpeg
|
||||
third_party/inspector_protocol
|
||||
third_party/jinja2
|
||||
third_party/jsoncpp
|
||||
third_party/jstemplate
|
||||
third_party/khronos
|
||||
third_party/leveldatabase
|
||||
third_party/libXNVCtrl
|
||||
third_party/libaddressinput
|
||||
third_party/libaom
|
||||
third_party/libaom/source/libaom/third_party/vector
|
||||
third_party/libaom/source/libaom/third_party/x86inc
|
||||
third_party/libavif
|
||||
third_party/libjingle
|
||||
third_party/libphonenumber
|
||||
third_party/libsecret
|
||||
third_party/libsrtp
|
||||
third_party/libsync
|
||||
third_party/libudev
|
||||
third_party/libvpx
|
||||
third_party/libvpx/source/libvpx/third_party/x86inc
|
||||
third_party/libwebm
|
||||
third_party/libxml/chromium
|
||||
third_party/libyuv
|
||||
third_party/llvm
|
||||
third_party/lottie
|
||||
third_party/lss
|
||||
third_party/lzma_sdk
|
||||
third_party/mako
|
||||
third_party/markupsafe
|
||||
third_party/mesa
|
||||
third_party/metrics_proto
|
||||
third_party/modp_b64
|
||||
third_party/nasm
|
||||
third_party/nearby
|
||||
third_party/node
|
||||
third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2
|
||||
third_party/one_euro_filter
|
||||
third_party/opencv
|
||||
third_party/openscreen
|
||||
third_party/openscreen/src/third_party/mozilla
|
||||
third_party/openscreen/src/third_party/tinycbor/src/src
|
||||
third_party/ots
|
||||
third_party/pdfium
|
||||
third_party/pdfium/third_party/agg23
|
||||
third_party/pdfium/third_party/base
|
||||
third_party/pdfium/third_party/bigint
|
||||
third_party/pdfium/third_party/freetype
|
||||
third_party/pdfium/third_party/lcms
|
||||
third_party/pdfium/third_party/libopenjpeg20
|
||||
third_party/pdfium/third_party/libpng16
|
||||
third_party/pdfium/third_party/libtiff
|
||||
third_party/pdfium/third_party/skia_shared
|
||||
third_party/perfetto
|
||||
third_party/pffft
|
||||
third_party/ply
|
||||
third_party/polymer
|
||||
third_party/private-join-and-compute
|
||||
third_party/private_membership
|
||||
third_party/protobuf
|
||||
third_party/protobuf/third_party/six
|
||||
third_party/pyjson5
|
||||
third_party/qcms
|
||||
third_party/rnnoise
|
||||
third_party/s2cellid
|
||||
third_party/schema_org
|
||||
third_party/securemessage
|
||||
third_party/shaka-player
|
||||
third_party/shell-encryption
|
||||
third_party/simplejson
|
||||
third_party/skia
|
||||
third_party/skia/include/third_party/skcms
|
||||
third_party/skia/include/third_party/vulkan
|
||||
third_party/skia/third_party/skcms
|
||||
third_party/skia/third_party/vulkan
|
||||
third_party/smhasher
|
||||
third_party/spirv-headers
|
||||
third_party/SPIRV-Tools
|
||||
third_party/sqlite
|
||||
third_party/swiftshader
|
||||
third_party/swiftshader/third_party/astc-encoder
|
||||
third_party/swiftshader/third_party/llvm-subzero
|
||||
third_party/swiftshader/third_party/marl
|
||||
third_party/swiftshader/third_party/subzero
|
||||
third_party/swiftshader/third_party/SPIRV-Headers/include/spirv/unified1
|
||||
third_party/ukey2
|
||||
third_party/unrar
|
||||
third_party/usrsctp
|
||||
third_party/vulkan
|
||||
third_party/web-animations-js
|
||||
third_party/webdriver
|
||||
third_party/webrtc
|
||||
third_party/webrtc/common_audio/third_party/ooura
|
||||
third_party/webrtc/common_audio/third_party/spl_sqrt_floor
|
||||
third_party/webrtc/modules/third_party/fft
|
||||
third_party/webrtc/modules/third_party/g711
|
||||
third_party/webrtc/modules/third_party/g722
|
||||
third_party/webrtc/rtc_base/third_party/base64
|
||||
third_party/webrtc/rtc_base/third_party/sigslot
|
||||
third_party/widevine
|
||||
third_party/woff2
|
||||
third_party/wuffs
|
||||
third_party/xcbproto
|
||||
third_party/zxcvbn-cpp
|
||||
third_party/zlib/google
|
||||
tools/grit/third_party/six
|
||||
url/third_party/mozilla
|
||||
v8/src/third_party/siphash
|
||||
v8/src/third_party/valgrind
|
||||
v8/src/third_party/utf8-decoder
|
||||
v8/third_party/inspector_protocol
|
||||
v8/third_party/v8
|
||||
|
||||
# gyp -> gn leftovers
|
||||
base/third_party/libevent
|
||||
third_party/adobe
|
||||
third_party/speech-dispatcher
|
||||
third_party/usb_ids
|
||||
third_party/xdg-utils
|
||||
)
|
||||
if ! use system-ffmpeg; then
|
||||
keeplibs+=( third_party/ffmpeg third_party/opus )
|
||||
fi
|
||||
if ! use system-icu; then
|
||||
keeplibs+=( third_party/icu )
|
||||
fi
|
||||
if use tcmalloc; then
|
||||
keeplibs+=( third_party/tcmalloc )
|
||||
fi
|
||||
if use wayland && ! use headless ; then
|
||||
keeplibs+=( third_party/wayland )
|
||||
fi
|
||||
if [[ ${CHROMIUM_FORCE_LIBCXX} == yes ]]; then
|
||||
keeplibs+=( third_party/libxml )
|
||||
keeplibs+=( third_party/libxslt )
|
||||
keeplibs+=( third_party/openh264 )
|
||||
keeplibs+=( third_party/re2 )
|
||||
keeplibs+=( third_party/snappy )
|
||||
if use system-icu; then
|
||||
keeplibs+=( third_party/icu )
|
||||
fi
|
||||
fi
|
||||
if use arm64 || use ppc64 ; then
|
||||
keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 )
|
||||
fi
|
||||
# we need to generate ppc64 stuff because upstream does not ship it yet
|
||||
# it has to be done before unbundling.
|
||||
if use ppc64; then
|
||||
pushd third_party/libvpx >/dev/null || die
|
||||
mkdir -p source/config/linux/ppc64 || die
|
||||
./generate_gni.sh || die
|
||||
popd >/dev/null || die
|
||||
fi
|
||||
|
||||
# Remove most bundled libraries. Some are still needed.
|
||||
build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# Calling this here supports resumption via FEATURES=keepwork
|
||||
python_setup
|
||||
|
||||
local myconf_gn=""
|
||||
|
||||
# Make sure the build system will use the right tools, bug #340795.
|
||||
tc-export AR CC CXX NM
|
||||
|
||||
if [[ ${CHROMIUM_FORCE_CLANG} == yes ]] && ! tc-is-clang; then
|
||||
# Force clang since gcc is pretty broken at the moment.
|
||||
CC=${CHOST}-clang
|
||||
CXX=${CHOST}-clang++
|
||||
strip-unsupported-flags
|
||||
fi
|
||||
|
||||
if tc-is-clang; then
|
||||
myconf_gn+=" is_clang=true clang_use_chrome_plugins=false"
|
||||
else
|
||||
if [[ ${CHROMIUM_FORCE_LIBCXX} == yes ]]; then
|
||||
die "Compiling with sys-libs/libcxx requires clang."
|
||||
fi
|
||||
myconf_gn+=" is_clang=false"
|
||||
fi
|
||||
|
||||
# Define a custom toolchain for GN
|
||||
myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
|
||||
|
||||
if tc-is-cross-compiler; then
|
||||
tc-export BUILD_{AR,CC,CXX,NM}
|
||||
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\""
|
||||
myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\""
|
||||
else
|
||||
myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
|
||||
fi
|
||||
|
||||
# GN needs explicit config for Debug/Release as opposed to inferring it from build directory.
|
||||
myconf_gn+=" is_debug=false"
|
||||
|
||||
# Component build isn't generally intended for use by end users. It's mostly useful
|
||||
# for development and debugging.
|
||||
myconf_gn+=" is_component_build=$(usex component-build true false)"
|
||||
|
||||
myconf_gn+=" use_allocator=$(usex tcmalloc \"tcmalloc\" \"none\")"
|
||||
|
||||
# Disable nacl, we can't build without pnacl (http://crbug.com/269560).
|
||||
myconf_gn+=" enable_nacl=false"
|
||||
|
||||
# Use system-provided libraries.
|
||||
# TODO: freetype -- remove sources (https://bugs.chromium.org/p/pdfium/issues/detail?id=733).
|
||||
# TODO: use_system_hunspell (upstream changes needed).
|
||||
# TODO: use_system_libsrtp (bug #459932).
|
||||
# TODO: use_system_protobuf (bug #525560).
|
||||
# TODO: use_system_ssl (http://crbug.com/58087).
|
||||
# TODO: use_system_sqlite (http://crbug.com/22208).
|
||||
|
||||
# libevent: https://bugs.gentoo.org/593458
|
||||
local gn_system_libraries=(
|
||||
flac
|
||||
fontconfig
|
||||
freetype
|
||||
# Need harfbuzz_from_pkgconfig target
|
||||
#harfbuzz-ng
|
||||
libdrm
|
||||
libjpeg
|
||||
libpng
|
||||
libwebp
|
||||
zlib
|
||||
)
|
||||
if use system-ffmpeg; then
|
||||
gn_system_libraries+=( ffmpeg opus )
|
||||
fi
|
||||
if use system-icu; then
|
||||
gn_system_libraries+=( icu )
|
||||
fi
|
||||
if [[ ${CHROMIUM_FORCE_LIBCXX} != yes ]]; then
|
||||
# unbundle only without libc++, because libc++ is not fully ABI compatible with libstdc++
|
||||
gn_system_libraries+=( libxml )
|
||||
gn_system_libraries+=( libxslt )
|
||||
gn_system_libraries+=( openh264 )
|
||||
gn_system_libraries+=( re2 )
|
||||
gn_system_libraries+=( snappy )
|
||||
fi
|
||||
build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
|
||||
|
||||
# See dependency logic in third_party/BUILD.gn
|
||||
myconf_gn+=" use_system_harfbuzz=true"
|
||||
|
||||
# Disable deprecated libgnome-keyring dependency, bug #713012
|
||||
myconf_gn+=" use_gnome_keyring=false"
|
||||
|
||||
# Optional dependencies.
|
||||
myconf_gn+=" enable_js_type_check=$(usex js-type-check true false)"
|
||||
myconf_gn+=" enable_hangout_services_extension=$(usex hangouts true false)"
|
||||
myconf_gn+=" enable_widevine=$(usex widevine true false)"
|
||||
myconf_gn+=" use_cups=$(usex cups true false)"
|
||||
myconf_gn+=" use_kerberos=$(usex kerberos true false)"
|
||||
myconf_gn+=" use_pulseaudio=$(usex pulseaudio true false)"
|
||||
myconf_gn+=" use_vaapi=$(usex vaapi true false)"
|
||||
|
||||
# TODO: link_pulseaudio=true for GN.
|
||||
|
||||
myconf_gn+=" fieldtrial_testing_like_official_build=true"
|
||||
|
||||
# Never use bundled gold binary. Disable gold linker flags for now.
|
||||
# Do not use bundled clang.
|
||||
# Trying to use gold results in linker crash.
|
||||
myconf_gn+=" use_gold=false use_sysroot=false use_custom_libcxx=false"
|
||||
|
||||
# Disable forced lld, bug 641556
|
||||
myconf_gn+=" use_lld=false"
|
||||
|
||||
ffmpeg_branding="$(usex proprietary-codecs Chrome Chromium)"
|
||||
myconf_gn+=" proprietary_codecs=$(usex proprietary-codecs true false)"
|
||||
myconf_gn+=" ffmpeg_branding=\"${ffmpeg_branding}\""
|
||||
|
||||
# Set up Google API keys, see http://www.chromium.org/developers/how-tos/api-keys .
|
||||
# Note: these are for Gentoo use ONLY. For your own distribution,
|
||||
# please get your own set of keys. Feel free to contact chromium@gentoo.org
|
||||
# for more info.
|
||||
local google_api_key="AIzaSyDEAOvatFo0eTgsV_ZlEzx0ObmepsMzfAc"
|
||||
local google_default_client_id="329227923882.apps.googleusercontent.com"
|
||||
local google_default_client_secret="vgKG0NNv7GoDpbtoFNLxCUXu"
|
||||
myconf_gn+=" google_api_key=\"${google_api_key}\""
|
||||
myconf_gn+=" google_default_client_id=\"${google_default_client_id}\""
|
||||
myconf_gn+=" google_default_client_secret=\"${google_default_client_secret}\""
|
||||
local myarch="$(tc-arch)"
|
||||
|
||||
# Avoid CFLAGS problems, bug #352457, bug #390147.
|
||||
if ! use custom-cflags; then
|
||||
replace-flags "-Os" "-O2"
|
||||
strip-flags
|
||||
|
||||
# Debug info section overflows without component build
|
||||
# Prevent linker from running out of address space, bug #471810 .
|
||||
if ! use component-build || use x86; then
|
||||
filter-flags "-g*"
|
||||
fi
|
||||
|
||||
# Prevent libvpx build failures. Bug 530248, 544702, 546984.
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${CHROMIUM_FORCE_LIBCXX} == yes ]]; then
|
||||
append-flags -stdlib=libc++
|
||||
append-ldflags -stdlib=libc++
|
||||
fi
|
||||
|
||||
if [[ $myarch = amd64 ]] ; then
|
||||
myconf_gn+=" target_cpu=\"x64\""
|
||||
ffmpeg_target_arch=x64
|
||||
elif [[ $myarch = x86 ]] ; then
|
||||
myconf_gn+=" target_cpu=\"x86\""
|
||||
ffmpeg_target_arch=ia32
|
||||
|
||||
# This is normally defined by compiler_cpu_abi in
|
||||
# build/config/compiler/BUILD.gn, but we patch that part out.
|
||||
append-flags -msse2 -mfpmath=sse -mmmx
|
||||
elif [[ $myarch = arm64 ]] ; then
|
||||
myconf_gn+=" target_cpu=\"arm64\""
|
||||
ffmpeg_target_arch=arm64
|
||||
elif [[ $myarch = arm ]] ; then
|
||||
myconf_gn+=" target_cpu=\"arm\""
|
||||
ffmpeg_target_arch=$(usex cpu_flags_arm_neon arm-neon arm)
|
||||
elif [[ $myarch = ppc64 ]] ; then
|
||||
myconf_gn+=" target_cpu=\"ppc64\""
|
||||
ffmpeg_target_arch=ppc64
|
||||
else
|
||||
die "Failed to determine target arch, got '$myarch'."
|
||||
fi
|
||||
|
||||
# Make sure that -Werror doesn't get added to CFLAGS by the build system.
|
||||
# Depending on GCC version the warnings are different and we don't want
|
||||
# the build to fail because of that.
|
||||
myconf_gn+=" treat_warnings_as_errors=false"
|
||||
|
||||
# Disable fatal linker warnings, bug 506268.
|
||||
myconf_gn+=" fatal_linker_warnings=false"
|
||||
|
||||
# Bug 491582.
|
||||
export TMPDIR="${WORKDIR}/temp"
|
||||
mkdir -p -m 755 "${TMPDIR}" || die
|
||||
|
||||
# https://bugs.gentoo.org/654216
|
||||
addpredict /dev/dri/ #nowarn
|
||||
|
||||
#if ! use system-ffmpeg; then
|
||||
if false; then
|
||||
local build_ffmpeg_args=""
|
||||
if use pic && [[ "${ffmpeg_target_arch}" == "ia32" ]]; then
|
||||
build_ffmpeg_args+=" --disable-asm"
|
||||
fi
|
||||
|
||||
# Re-configure bundled ffmpeg. See bug #491378 for example reasons.
|
||||
einfo "Configuring bundled ffmpeg..."
|
||||
pushd third_party/ffmpeg > /dev/null || die
|
||||
chromium/scripts/build_ffmpeg.py linux ${ffmpeg_target_arch} \
|
||||
--branding ${ffmpeg_branding} -- ${build_ffmpeg_args} || die
|
||||
chromium/scripts/copy_config.sh || die
|
||||
chromium/scripts/generate_gn.py || die
|
||||
popd > /dev/null || die
|
||||
fi
|
||||
|
||||
# Chromium relies on this, but was disabled in >=clang-10, crbug.com/1042470
|
||||
append-cxxflags $(test-flags-CXX -flax-vector-conversions=all)
|
||||
|
||||
# Disable unknown warning message from clang.
|
||||
tc-is-clang && append-flags -Wno-unknown-warning-option
|
||||
|
||||
# Explicitly disable ICU data file support for system-icu builds.
|
||||
if use system-icu; then
|
||||
myconf_gn+=" icu_use_data_file=false"
|
||||
fi
|
||||
|
||||
# Enable ozone wayland and/or headless support
|
||||
if use wayland || use headless; then
|
||||
myconf_gn+=" use_ozone=true ozone_auto_platforms=false"
|
||||
myconf_gn+=" ozone_platform_headless=true"
|
||||
if use headless; then
|
||||
myconf_gn+=" ozone_platform=\"headless\""
|
||||
myconf_gn+=" use_x11=false"
|
||||
else
|
||||
myconf_gn+=" ozone_platform_wayland=true"
|
||||
myconf_gn+=" use_system_libdrm=true"
|
||||
myconf_gn+=" use_system_minigbm=true"
|
||||
myconf_gn+=" use_xkbcommon=true"
|
||||
myconf_gn+=" ozone_platform=\"wayland\""
|
||||
fi
|
||||
else
|
||||
myconf_gn+=" use_ozone=false"
|
||||
fi
|
||||
|
||||
# Enable official builds
|
||||
myconf_gn+=" is_official_build=$(usex official 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 missing in tarball
|
||||
# (https://groups.google.com/a/chromium.org/g/chromium-packagers/c/2ID9c4j6UkY)
|
||||
myconf_gn+=" chrome_pgo_phase=0"
|
||||
fi
|
||||
|
||||
einfo "Configuring Chromium..."
|
||||
set -- gn gen --args="${myconf_gn} ${EXTRA_GN}" out/Release
|
||||
echo "$@"
|
||||
"$@" || die
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# Final link uses lots of file descriptors.
|
||||
ulimit -n 2048
|
||||
|
||||
# Calling this here supports resumption via FEATURES=keepwork
|
||||
python_setup
|
||||
|
||||
# https://bugs.gentoo.org/717456
|
||||
local -x PYTHONPATH="${WORKDIR}/setuptools-44.1.0:${PYTHONPATH+:}${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
|
||||
if tc-is-cross-compiler; then
|
||||
eninja -C out/Release "host/${x}"
|
||||
pax-mark m "out/Release/host/${x}"
|
||||
else
|
||||
eninja -C out/Release "${x}"
|
||||
pax-mark m "out/Release/${x}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Even though ninja autodetects number of CPUs, we respect
|
||||
# user's options, for debugging with -j 1 or any other reason.
|
||||
eninja -C out/Release chrome chromedriver
|
||||
use suid && eninja -C out/Release chrome_sandbox
|
||||
|
||||
pax-mark m out/Release/chrome
|
||||
|
||||
# Build manpage; bug #684550
|
||||
sed -e 's|@@PACKAGE@@|chromium-browser|g;
|
||||
s|@@MENUNAME@@|Chromium|g;' \
|
||||
chrome/app/resources/manpage.1.in > \
|
||||
out/Release/chromium-browser.1 || die
|
||||
|
||||
# Build desktop file; bug #706786
|
||||
sed -e 's|@@MENUNAME@@|Chromium|g;
|
||||
s|@@USR_BIN_SYMLINK_NAME@@|chromium-browser|g;
|
||||
s|@@PACKAGE@@|chromium-browser|g;
|
||||
s|\(^Exec=\)/usr/bin/|\1|g;' \
|
||||
chrome/installer/linux/common/desktop.template > \
|
||||
out/Release/chromium-browser-chromium.desktop || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local CHROMIUM_HOME="/usr/$(get_libdir)/chromium-browser"
|
||||
exeinto "${CHROMIUM_HOME}"
|
||||
doexe out/Release/chrome
|
||||
|
||||
if use suid; then
|
||||
newexe out/Release/chrome_sandbox chrome-sandbox
|
||||
fperms 4755 "${CHROMIUM_HOME}/chrome-sandbox"
|
||||
fi
|
||||
|
||||
doexe out/Release/chromedriver
|
||||
|
||||
local sedargs=( -e
|
||||
"s:/usr/lib/:/usr/$(get_libdir)/:g;
|
||||
s:@@OZONE_AUTO_SESSION@@:$(usex wayland true false):g;
|
||||
s:@@FORCE_OZONE_PLATFORM@@:$(usex headless true false):g"
|
||||
)
|
||||
sed "${sedargs[@]}" "${FILESDIR}/chromium-launcher-r6.sh" > chromium-launcher.sh || die
|
||||
doexe chromium-launcher.sh
|
||||
|
||||
# It is important that we name the target "chromium-browser",
|
||||
# xdg-utils expect it; bug #355517.
|
||||
dosym "${CHROMIUM_HOME}/chromium-launcher.sh" /usr/bin/chromium-browser
|
||||
# keep the old symlink around for consistency
|
||||
dosym "${CHROMIUM_HOME}/chromium-launcher.sh" /usr/bin/chromium
|
||||
|
||||
dosym "${CHROMIUM_HOME}/chromedriver" /usr/bin/chromedriver
|
||||
|
||||
# Allow users to override command-line options, bug #357629.
|
||||
insinto /etc/chromium
|
||||
newins "${FILESDIR}/chromium.default" "default"
|
||||
|
||||
pushd out/Release/locales > /dev/null || die
|
||||
chromium_remove_language_paks
|
||||
popd
|
||||
|
||||
insinto "${CHROMIUM_HOME}"
|
||||
doins out/Release/*.bin
|
||||
doins out/Release/*.pak
|
||||
(
|
||||
shopt -s nullglob
|
||||
local files=(out/Release/*.so)
|
||||
[[ ${#files[@]} -gt 0 ]] && doins "${files[@]}"
|
||||
)
|
||||
|
||||
if ! use system-icu; then
|
||||
doins out/Release/icudtl.dat
|
||||
fi
|
||||
|
||||
doins -r out/Release/locales
|
||||
doins -r out/Release/resources
|
||||
|
||||
if [[ -d out/Release/swiftshader ]]; then
|
||||
insinto "${CHROMIUM_HOME}/swiftshader"
|
||||
doins out/Release/swiftshader/*.so
|
||||
fi
|
||||
|
||||
# Install icons
|
||||
local branding size
|
||||
for size in 16 24 32 48 64 128 256 ; do
|
||||
case ${size} in
|
||||
16|32) branding="chrome/app/theme/default_100_percent/chromium" ;;
|
||||
*) branding="chrome/app/theme/chromium" ;;
|
||||
esac
|
||||
newicon -s ${size} "${branding}/product_logo_${size}.png" \
|
||||
chromium-browser.png
|
||||
done
|
||||
|
||||
# Install desktop entry
|
||||
domenu out/Release/chromium-browser-chromium.desktop
|
||||
|
||||
# Install GNOME default application entry (bug #303100).
|
||||
insinto /usr/share/gnome-control-center/default-apps
|
||||
newins "${FILESDIR}"/chromium-browser.xml chromium-browser.xml
|
||||
|
||||
# Install manpage; bug #684550
|
||||
doman out/Release/chromium-browser.1
|
||||
dosym chromium-browser.1 /usr/share/man/man1/chromium.1
|
||||
|
||||
readme.gentoo_create_doc
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
xdg_icon_cache_update
|
||||
xdg_desktop_database_update
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
xdg_icon_cache_update
|
||||
xdg_desktop_database_update
|
||||
readme.gentoo_print_elog
|
||||
|
||||
if use vaapi; then
|
||||
elog "VA-API is disabled by default at runtime. Either enable it"
|
||||
elog "by navigating to chrome://flags/#enable-accelerated-video-decode"
|
||||
elog "inside Chromium or add --enable-accelerated-video-decode"
|
||||
elog "to CHROMIUM_FLAGS in /etc/chromium/default."
|
||||
fi
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
From 9ff06536caf7ea51aad9fd2bb649c858eaf7ee84 Mon Sep 17 00:00:00 2001
|
||||
From: Akarshan Biswas <akarshanbiswas@fedoraproject.org>
|
||||
Date: Sat, 26 Oct 2019 10:06:30 +0530
|
||||
Subject: [PATCH] Move offending function to chromeos only
|
||||
|
||||
--- a/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
|
||||
+++ b/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
|
||||
@@ -58,6 +58,7 @@ unsigned int GetVaFormatForVideoCodecProfile(VideoCodecProfile profile) {
|
||||
return VA_RT_FORMAT_YUV420;
|
||||
}
|
||||
|
||||
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
|
||||
// Returns true if the CPU is an Intel Gemini Lake or later (including Kaby
|
||||
// Lake) Cpu platform id's are referenced from the following file in kernel
|
||||
// source arch/x86/include/asm/intel-family.h
|
||||
@@ -70,6 +71,7 @@ bool IsGeminiLakeOrLater() {
|
||||
cpuid.model() >= kGeminiLakeModelId;
|
||||
return is_geminilake_or_later;
|
||||
}
|
||||
+#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1213,6 +1215,8 @@ VaapiVideoDecodeAccelerator::DecideBufferAllocationMode() {
|
||||
if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT)
|
||||
return BufferAllocationMode::kNormal;
|
||||
|
||||
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
|
||||
+ // Move this to chromeOs only as it is causing problem in some intel linux drivers
|
||||
// On Gemini Lake, Kaby Lake and later we can pass to libva the client's
|
||||
// PictureBuffers to decode onto, which skips the use of the Vpp unit and its
|
||||
// associated format reconciliation copy, avoiding all internal buffer
|
||||
@@ -1228,6 +1232,7 @@ VaapiVideoDecodeAccelerator::DecideBufferAllocationMode() {
|
||||
num_extra_pics_ = 3;
|
||||
return BufferAllocationMode::kNone;
|
||||
}
|
||||
+#endif
|
||||
|
||||
// For H.264 on older devices, another +1 is experimentally needed for
|
||||
// high-to-high resolution changes.
|
||||
@@ -1,400 +0,0 @@
|
||||
From 4d16e52a5e6771c4aa5f892e14486bf0e87027d1 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Tang <ftang@chromium.org>
|
||||
Date: Tue, 20 Oct 2020 00:11:50 +0000
|
||||
Subject: [PATCH] Prepare for landing ICU68
|
||||
|
||||
In the landing process of ICU68 we found these need to be changed
|
||||
since ICU68 no longer define TRUE and FALSE for UBool to
|
||||
avoid C++20 problem.
|
||||
|
||||
Bug: 1138555
|
||||
Change-Id: I64fd98c99864aa86b07280537a780105cb0eabbe
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2473522
|
||||
Reviewed-by: Frank Tang <ftang@chromium.org>
|
||||
Reviewed-by: Colin Blundell <blundell@chromium.org>
|
||||
Reviewed-by: Dominic Battré <battre@chromium.org>
|
||||
Reviewed-by: Guillaume Jenkins <gujen@google.com>
|
||||
Reviewed-by: Jungshik Shin <jshin@chromium.org>
|
||||
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
|
||||
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
|
||||
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
|
||||
Reviewed-by: Marian Fechete <marianfe@google.com>
|
||||
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
|
||||
Commit-Queue: Frank Tang <ftang@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/master@{#818713}
|
||||
---
|
||||
|
||||
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
|
||||
index b225f1d..20debbe 100644
|
||||
--- a/base/i18n/icu_util.cc
|
||||
+++ b/base/i18n/icu_util.cc
|
||||
@@ -327,7 +327,7 @@
|
||||
// https://ssl.icu-project.org/trac/ticket/13208 .
|
||||
string16 zone_id = android::GetDefaultTimeZoneId();
|
||||
icu::TimeZone::adoptDefault(icu::TimeZone::createTimeZone(
|
||||
- icu::UnicodeString(FALSE, zone_id.data(), zone_id.length())));
|
||||
+ icu::UnicodeString(false, zone_id.data(), zone_id.length())));
|
||||
#elif defined(OS_FUCHSIA)
|
||||
// The platform-specific mechanisms used by ICU's detectHostTimeZone() to
|
||||
// determine the default time zone will not work on Fuchsia. Therefore,
|
||||
diff --git a/base/i18n/string_compare.cc b/base/i18n/string_compare.cc
|
||||
index c0e83c6..e4fb687 100644
|
||||
--- a/base/i18n/string_compare.cc
|
||||
+++ b/base/i18n/string_compare.cc
|
||||
@@ -18,8 +18,8 @@
|
||||
StringPiece16 rhs) {
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
UCollationResult result = collator.compare(
|
||||
- icu::UnicodeString(FALSE, lhs.data(), static_cast<int>(lhs.length())),
|
||||
- icu::UnicodeString(FALSE, rhs.data(), static_cast<int>(rhs.length())),
|
||||
+ icu::UnicodeString(false, lhs.data(), static_cast<int>(lhs.length())),
|
||||
+ icu::UnicodeString(false, rhs.data(), static_cast<int>(rhs.length())),
|
||||
error);
|
||||
DCHECK(U_SUCCESS(error));
|
||||
return result;
|
||||
diff --git a/base/i18n/time_formatting.cc b/base/i18n/time_formatting.cc
|
||||
index c769b57..c085f5e 100644
|
||||
--- a/base/i18n/time_formatting.cc
|
||||
+++ b/base/i18n/time_formatting.cc
|
||||
@@ -240,7 +240,7 @@
|
||||
icu::FieldPosition ignore(icu::FieldPosition::DONT_CARE);
|
||||
measure_format.formatMeasures(measures, 3, formatted, ignore, status);
|
||||
*out = i18n::UnicodeStringToString16(formatted);
|
||||
- return U_SUCCESS(status) == TRUE;
|
||||
+ return U_SUCCESS(status);
|
||||
}
|
||||
|
||||
string16 DateIntervalFormat(const Time& begin_time,
|
||||
diff --git a/components/autofill/core/common/autofill_regexes.cc b/components/autofill/core/common/autofill_regexes.cc
|
||||
index 02254fa..1cf12f3 100644
|
||||
--- a/components/autofill/core/common/autofill_regexes.cc
|
||||
+++ b/components/autofill/core/common/autofill_regexes.cc
|
||||
@@ -43,7 +43,7 @@
|
||||
icu::RegexMatcher* AutofillRegexes::GetMatcher(const base::string16& pattern) {
|
||||
auto it = matchers_.find(pattern);
|
||||
if (it == matchers_.end()) {
|
||||
- const icu::UnicodeString icu_pattern(FALSE, pattern.data(),
|
||||
+ const icu::UnicodeString icu_pattern(false, pattern.data(),
|
||||
pattern.length());
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@@ -71,21 +71,21 @@
|
||||
base::AutoLock lock(*g_lock);
|
||||
|
||||
icu::RegexMatcher* matcher = g_autofill_regexes->GetMatcher(pattern);
|
||||
- icu::UnicodeString icu_input(FALSE, input.data(), input.length());
|
||||
+ icu::UnicodeString icu_input(false, input.data(), input.length());
|
||||
matcher->reset(icu_input);
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UBool matched = matcher->find(0, status);
|
||||
DCHECK(U_SUCCESS(status));
|
||||
|
||||
- if (matched == TRUE && match) {
|
||||
+ if (matched && match) {
|
||||
icu::UnicodeString match_unicode =
|
||||
matcher->group(group_to_be_captured, status);
|
||||
DCHECK(U_SUCCESS(status));
|
||||
*match = base::i18n::UnicodeStringToString16(match_unicode);
|
||||
}
|
||||
|
||||
- return matched == TRUE;
|
||||
+ return matched;
|
||||
}
|
||||
|
||||
} // namespace autofill
|
||||
diff --git a/components/autofill_assistant/browser/string_conversions_util.cc b/components/autofill_assistant/browser/string_conversions_util.cc
|
||||
index 212bafa..1d00d68 100644
|
||||
--- a/components/autofill_assistant/browser/string_conversions_util.cc
|
||||
+++ b/components/autofill_assistant/browser/string_conversions_util.cc
|
||||
@@ -39,13 +39,13 @@
|
||||
// |target|.
|
||||
bool AppendUnicodeToUTF8(const UChar32 source, std::string* target) {
|
||||
char bytes[4];
|
||||
- UBool error = FALSE;
|
||||
+ UBool error = false;
|
||||
size_t offset = 0;
|
||||
U8_APPEND(bytes, offset, base::size(bytes), source, error);
|
||||
- if (error == FALSE) {
|
||||
+ if (error == false) {
|
||||
target->append(bytes, offset);
|
||||
}
|
||||
- return error == FALSE;
|
||||
+ return !error;
|
||||
}
|
||||
|
||||
} // namespace autofill_assistant
|
||||
diff --git a/components/signin/public/identity_manager/identity_utils.cc b/components/signin/public/identity_manager/identity_utils.cc
|
||||
index 1c414e2..014d674 100644
|
||||
--- a/components/signin/public/identity_manager/identity_utils.cc
|
||||
+++ b/components/signin/public/identity_manager/identity_utils.cc
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
// See if the username matches the policy-provided pattern.
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
- const icu::UnicodeString icu_pattern(FALSE, utf16_pattern.data(),
|
||||
+ const icu::UnicodeString icu_pattern(false, utf16_pattern.data(),
|
||||
utf16_pattern.length());
|
||||
icu::RegexMatcher matcher(icu_pattern, UREGEX_CASE_INSENSITIVE, status);
|
||||
if (!U_SUCCESS(status)) {
|
||||
diff --git a/components/spellcheck/renderer/spellcheck_worditerator.cc b/components/spellcheck/renderer/spellcheck_worditerator.cc
|
||||
index ec16fef..3b1f060 100644
|
||||
--- a/components/spellcheck/renderer/spellcheck_worditerator.cc
|
||||
+++ b/components/spellcheck/renderer/spellcheck_worditerator.cc
|
||||
@@ -442,7 +442,7 @@
|
||||
// spellchecker and we need manual normalization as well. The normalized
|
||||
// text does not have to be NUL-terminated since its characters are copied to
|
||||
// string16, which adds a NUL character when we need.
|
||||
- icu::UnicodeString input(FALSE, &text_[input_start],
|
||||
+ icu::UnicodeString input(false, &text_[input_start],
|
||||
base::checked_cast<int32_t>(input_length));
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
icu::UnicodeString output;
|
||||
diff --git a/components/url_formatter/spoof_checks/idn_spoof_checker.cc b/components/url_formatter/spoof_checks/idn_spoof_checker.cc
|
||||
index 6d66a7c..d73192b1 100644
|
||||
--- a/components/url_formatter/spoof_checks/idn_spoof_checker.cc
|
||||
+++ b/components/url_formatter/spoof_checks/idn_spoof_checker.cc
|
||||
@@ -368,7 +368,7 @@
|
||||
return Result::kICUSpoofChecks;
|
||||
}
|
||||
|
||||
- icu::UnicodeString label_string(FALSE /* isTerminated */, label.data(),
|
||||
+ icu::UnicodeString label_string(false /* isTerminated */, label.data(),
|
||||
base::checked_cast<int32_t>(label.size()));
|
||||
|
||||
// A punycode label with 'xn--' prefix is not subject to the URL
|
||||
@@ -711,7 +711,7 @@
|
||||
base::StringPiece tld,
|
||||
base::StringPiece16 tld_unicode) {
|
||||
icu::UnicodeString tld_string(
|
||||
- FALSE /* isTerminated */, tld_unicode.data(),
|
||||
+ false /* isTerminated */, tld_unicode.data(),
|
||||
base::checked_cast<int32_t>(tld_unicode.size()));
|
||||
// Allow if the TLD contains any letter from the script, in which case it's
|
||||
// likely to be a TLD in that script.
|
||||
diff --git a/components/url_formatter/spoof_checks/skeleton_generator.cc b/components/url_formatter/spoof_checks/skeleton_generator.cc
|
||||
index 9628626..9a77901 100644
|
||||
--- a/components/url_formatter/spoof_checks/skeleton_generator.cc
|
||||
+++ b/components/url_formatter/spoof_checks/skeleton_generator.cc
|
||||
@@ -116,7 +116,7 @@
|
||||
Skeletons SkeletonGenerator::GetSkeletons(base::StringPiece16 hostname) {
|
||||
Skeletons skeletons;
|
||||
size_t hostname_length = hostname.length() - (hostname.back() == '.' ? 1 : 0);
|
||||
- icu::UnicodeString host(FALSE, hostname.data(), hostname_length);
|
||||
+ icu::UnicodeString host(false, hostname.data(), hostname_length);
|
||||
// If input has any characters outside Latin-Greek-Cyrillic and [0-9._-],
|
||||
// there is no point in getting rid of diacritics because combining marks
|
||||
// attached to non-LGC characters are already blocked.
|
||||
diff --git a/content/zygote/zygote_linux.cc b/content/zygote/zygote_linux.cc
|
||||
index 95d5a82..b6d8e5a 100644
|
||||
--- a/content/zygote/zygote_linux.cc
|
||||
+++ b/content/zygote/zygote_linux.cc
|
||||
@@ -557,7 +557,7 @@
|
||||
if (!iter.ReadString16(&timezone_id))
|
||||
return -1;
|
||||
icu::TimeZone::adoptDefault(icu::TimeZone::createTimeZone(
|
||||
- icu::UnicodeString(FALSE, timezone_id.data(), timezone_id.length())));
|
||||
+ icu::UnicodeString(false, timezone_id.data(), timezone_id.length())));
|
||||
|
||||
if (!iter.ReadInt(&numfds))
|
||||
return -1;
|
||||
diff --git a/services/device/time_zone_monitor/time_zone_monitor_android.cc b/services/device/time_zone_monitor/time_zone_monitor_android.cc
|
||||
index 818670a..f57f972 100644
|
||||
--- a/services/device/time_zone_monitor/time_zone_monitor_android.cc
|
||||
+++ b/services/device/time_zone_monitor/time_zone_monitor_android.cc
|
||||
@@ -34,7 +34,7 @@
|
||||
// See base/i18n/icu_util.cc:InitializeIcuTimeZone() for more information.
|
||||
base::string16 zone_id = base::android::GetDefaultTimeZoneId();
|
||||
std::unique_ptr<icu::TimeZone> new_zone(icu::TimeZone::createTimeZone(
|
||||
- icu::UnicodeString(FALSE, zone_id.data(), zone_id.length())));
|
||||
+ icu::UnicodeString(false, zone_id.data(), zone_id.length())));
|
||||
UpdateIcuAndNotifyClients(std::move(new_zone));
|
||||
}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/exported/web_view_test.cc b/third_party/blink/renderer/core/exported/web_view_test.cc
|
||||
index a6b9552..36809d91 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_test.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_test.cc
|
||||
@@ -4868,18 +4868,18 @@
|
||||
|
||||
TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithMutateDom) {
|
||||
// Test dom mutation.
|
||||
- TestEachMouseEvent("mutateDom", FALSE);
|
||||
+ TestEachMouseEvent("mutateDom", false);
|
||||
|
||||
// Test without any DOM mutation.
|
||||
- TestEachMouseEvent("none", TRUE);
|
||||
+ TestEachMouseEvent("none", true);
|
||||
}
|
||||
|
||||
TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithMutateStyle) {
|
||||
// Test style mutation.
|
||||
- TestEachMouseEvent("mutateStyle", FALSE);
|
||||
+ TestEachMouseEvent("mutateStyle", false);
|
||||
|
||||
// Test checkbox:indeterminate style mutation.
|
||||
- TestEachMouseEvent("mutateIndeterminate", FALSE);
|
||||
+ TestEachMouseEvent("mutateIndeterminate", false);
|
||||
|
||||
// Test click div with :active style.
|
||||
Tap("style_active");
|
||||
@@ -4888,10 +4888,10 @@
|
||||
|
||||
TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithPreventDefault) {
|
||||
// Test swallowing.
|
||||
- TestEachMouseEvent("preventDefault", FALSE);
|
||||
+ TestEachMouseEvent("preventDefault", false);
|
||||
|
||||
// Test without any preventDefault.
|
||||
- TestEachMouseEvent("none", TRUE);
|
||||
+ TestEachMouseEvent("none", true);
|
||||
}
|
||||
|
||||
TEST_F(ShowUnhandledTapTest, ShowUnhandledTapUIIfNeededWithNonTriggeringNodes) {
|
||||
diff --git a/third_party/blink/renderer/platform/text/locale_icu.cc b/third_party/blink/renderer/platform/text/locale_icu.cc
|
||||
index 92fb99e0..f991b51 100644
|
||||
--- a/third_party/blink/renderer/platform/text/locale_icu.cc
|
||||
+++ b/third_party/blink/renderer/platform/text/locale_icu.cc
|
||||
@@ -169,12 +169,12 @@
|
||||
return g_empty_string;
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
- int32_t length = udat_toPattern(date_format, TRUE, nullptr, 0, &status);
|
||||
+ int32_t length = udat_toPattern(date_format, true, nullptr, 0, &status);
|
||||
if (status != U_BUFFER_OVERFLOW_ERROR || !length)
|
||||
return g_empty_string;
|
||||
StringBuffer<UChar> buffer(length);
|
||||
status = U_ZERO_ERROR;
|
||||
- udat_toPattern(date_format, TRUE, buffer.Characters(), length, &status);
|
||||
+ udat_toPattern(date_format, true, buffer.Characters(), length, &status);
|
||||
if (U_FAILURE(status))
|
||||
return g_empty_string;
|
||||
return String::Adopt(buffer);
|
||||
diff --git a/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc b/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc
|
||||
index 5bea007..0e8c60a 100644
|
||||
--- a/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc
|
||||
+++ b/third_party/blink/renderer/platform/text/text_break_iterator_icu.cc
|
||||
@@ -312,13 +312,13 @@
|
||||
text->chunkOffset = offset <= std::numeric_limits<int32_t>::max()
|
||||
? static_cast<int32_t>(offset)
|
||||
: 0;
|
||||
- is_accessible = TRUE;
|
||||
+ is_accessible = true;
|
||||
return true;
|
||||
}
|
||||
if (native_index >= native_length &&
|
||||
text->chunkNativeLimit == native_length) {
|
||||
text->chunkOffset = text->chunkLength;
|
||||
- is_accessible = FALSE;
|
||||
+ is_accessible = false;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@@ -331,12 +331,12 @@
|
||||
text->chunkOffset = offset <= std::numeric_limits<int32_t>::max()
|
||||
? static_cast<int32_t>(offset)
|
||||
: 0;
|
||||
- is_accessible = TRUE;
|
||||
+ is_accessible = true;
|
||||
return true;
|
||||
}
|
||||
if (native_index <= 0 && !text->chunkNativeStart) {
|
||||
text->chunkOffset = 0;
|
||||
- is_accessible = FALSE;
|
||||
+ is_accessible = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -347,7 +347,7 @@
|
||||
int64_t native_index,
|
||||
UBool forward) {
|
||||
if (!text->context)
|
||||
- return FALSE;
|
||||
+ return false;
|
||||
int64_t native_length = TextNativeLength(text);
|
||||
UBool is_accessible;
|
||||
if (TextInChunkOrOutOfRange(text, native_index, native_length, forward,
|
||||
@@ -371,7 +371,7 @@
|
||||
DCHECK_EQ(new_context, kPriorContext);
|
||||
TextLatin1SwitchToPriorContext(text, native_index, native_length, forward);
|
||||
}
|
||||
- return TRUE;
|
||||
+ return true;
|
||||
}
|
||||
|
||||
static const struct UTextFuncs kTextLatin1Funcs = {
|
||||
@@ -511,7 +511,7 @@
|
||||
|
||||
static UBool TextUTF16Access(UText* text, int64_t native_index, UBool forward) {
|
||||
if (!text->context)
|
||||
- return FALSE;
|
||||
+ return false;
|
||||
int64_t native_length = TextNativeLength(text);
|
||||
UBool is_accessible;
|
||||
if (TextInChunkOrOutOfRange(text, native_index, native_length, forward,
|
||||
@@ -533,7 +533,7 @@
|
||||
DCHECK_EQ(new_context, kPriorContext);
|
||||
TextUTF16SwitchToPriorContext(text, native_index, native_length, forward);
|
||||
}
|
||||
- return TRUE;
|
||||
+ return true;
|
||||
}
|
||||
|
||||
static const struct UTextFuncs kTextUTF16Funcs = {
|
||||
diff --git a/third_party/blink/renderer/platform/text/unicode_utilities.cc b/third_party/blink/renderer/platform/text/unicode_utilities.cc
|
||||
index 2cefd53..b8c4515 100644
|
||||
--- a/third_party/blink/renderer/platform/text/unicode_utilities.cc
|
||||
+++ b/third_party/blink/renderer/platform/text/unicode_utilities.cc
|
||||
@@ -300,7 +300,7 @@
|
||||
DCHECK(U_SUCCESS(status));
|
||||
int32_t input_length = static_cast<int32_t>(length);
|
||||
// copy-on-write.
|
||||
- icu::UnicodeString normalized(FALSE, characters, input_length);
|
||||
+ icu::UnicodeString normalized(false, characters, input_length);
|
||||
// In the vast majority of cases, input is already NFC. Run a quick check
|
||||
// to avoid normalizing the entire input unnecessarily.
|
||||
int32_t normalized_prefix_length =
|
||||
diff --git a/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc b/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
|
||||
index b625735..fb8ab05 100644
|
||||
--- a/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
|
||||
+++ b/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
|
||||
@@ -327,7 +327,7 @@
|
||||
DLOG_IF(ERROR, err == U_AMBIGUOUS_ALIAS_WARNING)
|
||||
<< "ICU ambiguous alias warning for encoding: " << encoding_.GetName();
|
||||
if (converter_icu_)
|
||||
- ucnv_setFallback(converter_icu_, TRUE);
|
||||
+ ucnv_setFallback(converter_icu_, true);
|
||||
}
|
||||
|
||||
int TextCodecICU::DecodeToBuffer(UChar* target,
|
||||
diff --git a/ui/base/l10n/formatter.cc b/ui/base/l10n/formatter.cc
|
||||
index e4446d4..684ead8 100644
|
||||
--- a/ui/base/l10n/formatter.cc
|
||||
+++ b/ui/base/l10n/formatter.cc
|
||||
@@ -234,7 +234,7 @@
|
||||
int value,
|
||||
icu::UnicodeString* formatted_string) const {
|
||||
DCHECK(simple_format_[unit]);
|
||||
- DCHECK(formatted_string->isEmpty() == TRUE);
|
||||
+ DCHECK(formatted_string->isEmpty());
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
FormatNumberInPlural(*simple_format_[unit],
|
||||
value, formatted_string, &error);
|
||||
@@ -250,7 +250,7 @@
|
||||
<< "Detailed() not implemented for your (format, length) combination!";
|
||||
DCHECK(detailed_format_[units][1])
|
||||
<< "Detailed() not implemented for your (format, length) combination!";
|
||||
- DCHECK(formatted_string->isEmpty() == TRUE);
|
||||
+ DCHECK(formatted_string->isEmpty());
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
FormatNumberInPlural(*detailed_format_[units][0], value_1,
|
||||
formatted_string, &error);
|
||||
@@ -283,7 +283,7 @@
|
||||
base::string16 pattern = l10n_util::GetStringUTF16(pluralities.id);
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
std::unique_ptr<icu::MessageFormat> format(new icu::MessageFormat(
|
||||
- icu::UnicodeString(FALSE, pattern.data(), pattern.length()), error));
|
||||
+ icu::UnicodeString(false, pattern.data(), pattern.length()), error));
|
||||
DCHECK(U_SUCCESS(error));
|
||||
if (format.get())
|
||||
return format;
|
||||
@@ -1,15 +0,0 @@
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
index 3f89c70..0df6490 100644
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -5056,7 +5056,9 @@ static_library("browser") {
|
||||
"chrome_browser_main_extra_parts_ozone.cc",
|
||||
"chrome_browser_main_extra_parts_ozone.h",
|
||||
]
|
||||
- deps += [ "//ui/ozone" ]
|
||||
+ if (use_ozone) {
|
||||
+ deps += [ "//ui/ozone" ]
|
||||
+ }
|
||||
}
|
||||
|
||||
if (enable_background_mode) {
|
||||
@@ -1,192 +0,0 @@
|
||||
From b0a7f5691113534c2cf771f2dd3cece5e93bc7d4 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Tang <ftang@chromium.org>
|
||||
Date: Tue, 03 Nov 2020 23:20:37 -0800
|
||||
Subject: [PATCH] Update to ICU68-1
|
||||
|
||||
ICU68-1 change the output skeleton format. So we need to change
|
||||
resolvedOptions code for 68 migration.
|
||||
|
||||
Chromium roll
|
||||
https://chromium-review.googlesource.com/c/chromium/src/+/2474093
|
||||
|
||||
Bug: v8:10945
|
||||
Change-Id: I3b2c7fbe8abb22df8fa51287c498ca3245b8c55b
|
||||
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2477431
|
||||
Commit-Queue: Frank Tang <ftang@chromium.org>
|
||||
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
|
||||
Reviewed-by: Shu-yu Guo <syg@chromium.org>
|
||||
Cr-Commit-Position: refs/heads/master@{#70972}
|
||||
|
||||
(ported to work with <ICU-68.1 and rebased chromium)
|
||||
---
|
||||
|
||||
diff --git a/v8/src/objects/js-number-format.cc b/v8/src/objects/js-number-format.cc
|
||||
index 45b0eab..d18b133 100644
|
||||
--- a/v8/src/objects/js-number-format.cc
|
||||
+++ b/v8/src/objects/js-number-format.cc
|
||||
@@ -389,17 +389,20 @@ Handle<String> CurrencySignString(Isolate* isolate,
|
||||
Handle<String> UnitDisplayString(Isolate* isolate,
|
||||
const icu::UnicodeString& skeleton) {
|
||||
// Ex: skeleton as
|
||||
- // "measure-unit/length-meter .### rounding-mode-half-up unit-width-full-name"
|
||||
+ // <ICU-68.1: "measure-unit/length-meter .### rounding-mode-half-up unit-width-full-name".
|
||||
+ // >=ICU-68.1: "unit/length-meter .### rounding-mode-half-up unit-width-full-name"
|
||||
if (skeleton.indexOf("unit-width-full-name") >= 0) {
|
||||
return ReadOnlyRoots(isolate).long_string_handle();
|
||||
}
|
||||
// Ex: skeleton as
|
||||
- // "measure-unit/length-meter .### rounding-mode-half-up unit-width-narrow".
|
||||
+ // <ICU-68.1: "measure-unit/length-meter .### rounding-mode-half-up unit-width-narrow".
|
||||
+ // >=ICU-68.1: "unit/length-meter .### rounding-mode-half-up unit-width-narrow".
|
||||
if (skeleton.indexOf("unit-width-narrow") >= 0) {
|
||||
return ReadOnlyRoots(isolate).narrow_string_handle();
|
||||
}
|
||||
// Ex: skeleton as
|
||||
- // "measure-unit/length-foot .### rounding-mode-half-up"
|
||||
+ // <ICU-68.1: "measure-unit/length-foot .### rounding-mode-half-up"
|
||||
+ // >=ICU-68.1: "unit/length-foot .### rounding-mode-half-up"
|
||||
return ReadOnlyRoots(isolate).short_string_handle();
|
||||
}
|
||||
|
||||
@@ -422,7 +425,8 @@ Notation NotationFromSkeleton(const icu::UnicodeString& skeleton) {
|
||||
return Notation::COMPACT;
|
||||
}
|
||||
// Ex: skeleton as
|
||||
- // "measure-unit/length-foot .### rounding-mode-half-up"
|
||||
+ // <ICU-68.1: "measure-unit/length-foot .### rounding-mode-half-up"
|
||||
+ // >=ICU-68.1: "unit/length-foot .### rounding-mode-half-up"
|
||||
return Notation::STANDARD;
|
||||
}
|
||||
|
||||
@@ -562,14 +566,23 @@ namespace {
|
||||
|
||||
// Ex: percent .### rounding-mode-half-up
|
||||
// Special case for "percent"
|
||||
-// Ex: "measure-unit/length-kilometer per-measure-unit/duration-hour .###
|
||||
-// rounding-mode-half-up" should return "kilometer-per-unit".
|
||||
-// Ex: "measure-unit/duration-year .### rounding-mode-half-up" should return
|
||||
-// "year".
|
||||
+// <ICU-68.1:
|
||||
+// Ex: "measure-unit/length-kilometer per-measure-unit/duration-hour .###
|
||||
+// rounding-mode-half-up" should return "kilometer-per-unit".
|
||||
+// Ex: "measure-unit/duration-year .### rounding-mode-half-up" should return
|
||||
+// >=ICU-68.1:
|
||||
+// Ex: "unit/milliliter-per-acre .### rounding-mode-half-up"
|
||||
+// should return "milliliter-per-acre".
|
||||
+// Ex: "unit/year .### rounding-mode-half-up" should return
|
||||
+// "year".
|
||||
std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) {
|
||||
std::string str;
|
||||
str = skeleton.toUTF8String<std::string>(str);
|
||||
+#if U_ICU_VERSION_MAJOR_NUM < 68
|
||||
std::string search("measure-unit/");
|
||||
+#else
|
||||
+ std::string search("unit/");
|
||||
+#endif
|
||||
size_t begin = str.find(search);
|
||||
if (begin == str.npos) {
|
||||
// Special case for "percent".
|
||||
@@ -578,20 +591,41 @@ std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
+#if U_ICU_VERSION_MAJOR_NUM < 68
|
||||
// Skip the type (ex: "length").
|
||||
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
|
||||
// b
|
||||
begin = str.find("-", begin + search.size());
|
||||
+#else
|
||||
+ // Ex:
|
||||
+ // "unit/acre .### rounding-mode-half-up"
|
||||
+ // b
|
||||
+ // Ex:
|
||||
+ // "unit/milliliter-per-acre .### rounding-mode-half-up"
|
||||
+ // b
|
||||
+ begin += search.size();
|
||||
+#endif
|
||||
if (begin == str.npos) {
|
||||
return "";
|
||||
}
|
||||
+#if U_ICU_VERSION_MAJOR_NUM < 68
|
||||
begin++; // Skip the '-'.
|
||||
+#endif
|
||||
// Find the end of the subtype.
|
||||
size_t end = str.find(" ", begin);
|
||||
- // "measure-unit/length-kilometer per-measure-unit/duration-hour"
|
||||
- // b e
|
||||
+ // <ICU-68.1:
|
||||
+ // "measure-unit/length-kilometer per-measure-unit/duration-hour"
|
||||
+ // b e
|
||||
+ // >=ICU-68.1:
|
||||
+ // Ex:
|
||||
+ // "unit/acre .### rounding-mode-half-up"
|
||||
+ // b e
|
||||
+ // Ex:
|
||||
+ // "unit/milliliter-per-acre .### rounding-mode-half-up"
|
||||
+ // b e
|
||||
if (end == str.npos) {
|
||||
end = str.size();
|
||||
+#if U_ICU_VERSION_MAJOR_NUM < 68
|
||||
return str.substr(begin, end - begin);
|
||||
}
|
||||
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
|
||||
@@ -625,17 +659,36 @@ std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) {
|
||||
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
|
||||
// [result ] b e
|
||||
return result + "-per-" + str.substr(begin, end - begin);
|
||||
+#else
|
||||
+ }
|
||||
+ return str.substr(begin, end - begin);
|
||||
+#endif
|
||||
}
|
||||
|
||||
Style StyleFromSkeleton(const icu::UnicodeString& skeleton) {
|
||||
if (skeleton.indexOf("currency/") >= 0) {
|
||||
return Style::CURRENCY;
|
||||
}
|
||||
+#if U_ICU_VERSION_MAJOR_NUM < 68
|
||||
if (skeleton.indexOf("measure-unit/") >= 0) {
|
||||
if (skeleton.indexOf("scale/100") >= 0 &&
|
||||
skeleton.indexOf("measure-unit/concentr-percent") >= 0) {
|
||||
+#else
|
||||
+ if (skeleton.indexOf("percent") >= 0) {
|
||||
+ // percent precision-integer rounding-mode-half-up scale/100
|
||||
+ if (skeleton.indexOf("scale/100") >= 0) {
|
||||
+#endif
|
||||
return Style::PERCENT;
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 68
|
||||
+ } else {
|
||||
+ return Style::UNIT;
|
||||
+#endif
|
||||
}
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 68
|
||||
+ }
|
||||
+ // Before ICU68: "measure-unit/", since ICU68 "unit/"
|
||||
+ if (skeleton.indexOf("unit/") >= 0) {
|
||||
+#endif
|
||||
return Style::UNIT;
|
||||
}
|
||||
return Style::DECIMAL;
|
||||
diff --git a/v8/src/objects/js-relative-time-format.cc b/v8/src/objects/js-relative-time-format.cc
|
||||
index 267343aaae..64d56a1c12 100644
|
||||
--- a/v8/src/objects/js-relative-time-format.cc
|
||||
+++ b/v8/src/objects/js-relative-time-format.cc
|
||||
@@ -195,9 +195,18 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New(
|
||||
}
|
||||
}
|
||||
|
||||
+#if U_ICU_VERSION_MAJOR_NUM < 68
|
||||
icu::DecimalFormat* decimal_format =
|
||||
static_cast<icu::DecimalFormat*>(number_format);
|
||||
decimal_format->setMinimumGroupingDigits(-2);
|
||||
+#else
|
||||
+ if (number_format->getDynamicClassID() ==
|
||||
+ icu::DecimalFormat::getStaticClassID()) {
|
||||
+ icu::DecimalFormat* decimal_format =
|
||||
+ static_cast<icu::DecimalFormat*>(number_format);
|
||||
+ decimal_format->setMinimumGroupingDigits(-2);
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
// Change UDISPCTX_CAPITALIZATION_NONE to other values if
|
||||
// ECMA402 later include option to change capitalization.
|
||||
Reference in New Issue
Block a user