From 56d0c8205c9fe7b4cff71030722e1a553aac006d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 20 Apr 2018 19:27:12 +0100 Subject: "www-client/chromium : add-missing-blink-tools, see : https://groups.google.com/a/chromium.org/forum/#!msg/chromium-packagers/So-ojMYOQdI/K66hndtdCAAJ" --- .../chromium/chromium-66.0.3359.117-r1.ebuild | 698 ------------- .../chromium/chromium-66.0.3359.117-r2.ebuild | 699 +++++++++++++ .../chromium/files/add-missing-blink-tools.patch | 1071 ++++++++++++++++++++ 3 files changed, 1770 insertions(+), 698 deletions(-) delete mode 100644 www-client/chromium/chromium-66.0.3359.117-r1.ebuild create mode 100644 www-client/chromium/chromium-66.0.3359.117-r2.ebuild create mode 100644 www-client/chromium/files/add-missing-blink-tools.patch (limited to 'www-client') diff --git a/www-client/chromium/chromium-66.0.3359.117-r1.ebuild b/www-client/chromium/chromium-66.0.3359.117-r1.ebuild deleted file mode 100644 index 7894a2e8..00000000 --- a/www-client/chromium/chromium-66.0.3359.117-r1.ebuild +++ /dev/null @@ -1,698 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI="6" -PYTHON_COMPAT=( python2_7 ) - -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 eutils gnome2-utils flag-o-matic multilib ninja-utils pax-utils portability python-any-r1 readme.gentoo-r1 toolchain-funcs versionator xdg-utils - -DESCRIPTION="Open-source version of Google Chrome web browser" -HOMEPAGE="http://chromium.org/" -SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz" - -LICENSE="BSD" -SLOT="0" -KEYWORDS="amd64" -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" -RESTRICT="!system-ffmpeg? ( proprietary-codecs? ( bindist ) )" - -COMMON_DEPEND=" - app-accessibility/at-spi2-atk:2 - app-arch/bzip2:= - cups? ( >=net-print/cups-1.3.11:= ) - dev-libs/atk - dev-libs/expat:= - dev-libs/glib:2 - system-icu? ( >=dev-libs/icu-59:= ) - >=dev-libs/libxml2-2.9.4-r3:=[icu] - dev-libs/libxslt:= - dev-libs/nspr:= - >=dev-libs/nss-3.26:= - gnome-keyring? ( >=gnome-base/libgnome-keyring-3.12:= ) - >=media-libs/alsa-lib-1.0.19:= - media-libs/fontconfig:= - media-libs/freetype:= - >=media-libs/harfbuzz-1.6.0:=[icu(-)] - media-libs/libjpeg-turbo:= - media-libs/libpng:= - system-libvpx? ( media-libs/libvpx:=[postproc,svc] ) - >=media-libs/openh264-1.6.0:= - pulseaudio? ( media-sound/pulseaudio:= ) - system-ffmpeg? ( - >=media-video/ffmpeg-3:= - || ( - media-video/ffmpeg[-samba] - >=net-fs/samba-4.5.10-r1[-debug(-)] - ) - !=net-fs/samba-4.5.12 - media-libs/opus:= - ) - sys-apps/dbus:= - sys-apps/pciutils:= - virtual/udev - x11-libs/cairo:= - x11-libs/gdk-pixbuf:2 - x11-libs/gtk+:3[X] - 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/libXScrnSaver:= - x11-libs/libXtst:= - x11-libs/pango:= - app-arch/snappy:= - media-libs/flac:= - >=media-libs/libwebp-0.4.0:= - sys-libs/zlib:=[minizip] - kerberos? ( virtual/krb5 ) -" -# For nvidia-drivers blocker, see bug #413637 . -RDEPEND="${COMMON_DEPEND} - !=www-client/chromium-9999 - !=dev-python/beautifulsoup-4.3.2:4[${PYTHON_USEDEP}]" && - has_version --host-root "dev-python/html5lib[${PYTHON_USEDEP}]" && - has_version --host-root "dev-python/simplejson[${PYTHON_USEDEP}]" -} - -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/bitstream-cyberbit -- 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. -" - -PATCHES=( - "${FILESDIR}/chromium-widevine-r1.patch" - "${FILESDIR}/chromium-FORTIFY_SOURCE-r2.patch" - "${FILESDIR}/chromium-webrtc-r0.patch" - "${FILESDIR}/chromium-memcpy-r0.patch" - "${FILESDIR}/chromium-clang-r2.patch" - "${FILESDIR}/chromium-math.h-r0.patch" - "${FILESDIR}/chromium-stdint.patch" - "${FILESDIR}/chromium-clang-r4.patch" - "${FILESDIR}/chromium-ffmpeg-r1.patch" - "${FILESDIR}/chromium-ffmpeg-clang.patch" -) - -pre_build_checks() { - #if [[ ${MERGE_TYPE} != binary ]]; then - # local -x CPP="$(tc-getCXX) -E" - # if tc-is-clang && ! version_is_at_least "3.9.1" "$(clang-fullversion)"; then - # # bugs: #601654 - # die "At least clang 3.9.1 is required" - # fi - # if tc-is-gcc && ! version_is_at_least 5.0 "$(gcc-version)"; then - # # bugs: #535730, #525374, #518668, #600288, #627356 - # die "At least gcc 5.0 is required" - # fi - #fi - - # Check build requirements, bug #541816 and bug #471810 . - CHECKREQS_MEMORY="3G" - CHECKREQS_DISK_BUILD="5G" - eshopts_push -s extglob - if is-flagq '-g?(gdb)?([1-9])'; then - CHECKREQS_DISK_BUILD="25G" - if ! use component-build; then - CHECKREQS_MEMORY="16G" - fi - fi - eshopts_pop - check-reqs_pkg_setup -} - -pkg_pretend() { - pre_build_checks -} - -pkg_setup() { - pre_build_checks - - chromium_suid_sandbox_check_kernel_config -} - -src_prepare() { - # Calling this here supports resumption via FEATURES=keepwork - python_setup - - 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/dmg_fp - 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 - third_party/WebKit - third_party/analytics - third_party/angle - third_party/angle/src/common/third_party/base - third_party/angle/src/common/third_party/smhasher - 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/third_party/glslang - third_party/angle/third_party/spirv-headers - third_party/angle/third_party/spirv-tools - third_party/angle/third_party/vulkan-validation-layers - 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/cacheinvalidation - 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/polymer - third_party/catapult/tracing/third_party/d3 - third_party/catapult/tracing/third_party/gl-matrix - 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/crc32c - third_party/cros_system_api - third_party/devscripts - third_party/dom_distiller_js - third_party/fips181 - third_party/flatbuffers - third_party/flot - third_party/freetype - third_party/glslang-angle - 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/hunspell - third_party/iccjpeg - third_party/inspector_protocol - third_party/jinja2 - 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/x86inc - third_party/libjingle - third_party/libphonenumber - third_party/libsecret - third_party/libsrtp - third_party/libudev - third_party/libwebm - third_party/libxml/chromium - third_party/libyuv - third_party/llvm - third_party/lss - third_party/lzma_sdk - third_party/markupsafe - third_party/mesa - third_party/metrics_proto - third_party/modp_b64 - third_party/node - third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2 - third_party/openmax_dl - 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/ply - third_party/polymer - third_party/protobuf - third_party/protobuf/third_party/six - third_party/qcms - third_party/re2 - third_party/s2cellid - third_party/sfntly - third_party/skia - third_party/skia/third_party/gif - third_party/skia/third_party/vulkan - third_party/smhasher - third_party/spirv-headers - third_party/spirv-tools-angle - third_party/sqlite - third_party/swiftshader - third_party/swiftshader/third_party/llvm-subzero - third_party/swiftshader/third_party/subzero - third_party/unrar - third_party/usrsctp - third_party/vulkan - third_party/vulkan-validation-layers - third_party/web-animations-js - third_party/webdriver - third_party/webrtc - third_party/widevine - third_party/woff2 - third_party/zlib/google - url/third_party/mozilla - v8/src/third_party/valgrind - v8/src/third_party/utf8-decoder - v8/third_party/inspector_protocol - - # gyp -> gn leftovers - base/third_party/libevent - third_party/adobe - third_party/speech-dispatcher - third_party/usb_ids - third_party/xdg-utils - third_party/yasm/run_yasm.py - ) - 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 system-libvpx; then - keeplibs+=( third_party/libvpx ) - keeplibs+=( third_party/libvpx/source/libvpx/third_party/x86inc ) - fi - if use tcmalloc; then - keeplibs+=( third_party/tcmalloc ) - fi - - # Remove most bundled libraries. Some are still needed. - build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die -} - -bootstrap_gn() { - if tc-is-cross-compiler; then - local -x AR=${BUILD_AR} - local -x CC=${BUILD_CC} - local -x CXX=${BUILD_CXX} - local -x NM=${BUILD_NM} - local -x CFLAGS=${BUILD_CFLAGS} - local -x CXXFLAGS=${BUILD_CXXFLAGS} - local -x LDFLAGS=${BUILD_LDFLAGS} - fi - einfo "Building GN..." - set -- tools/gn/bootstrap/bootstrap.py -s -v --no-clean - echo "$@" - "$@" || 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 ! 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 - 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)" - - # https://chromium.googlesource.com/chromium/src/+/lkcr/docs/jumbo.md - myconf_gn+=" use_jumbo_build=$(usex jumbo-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 - libxml - libxslt - openh264 - snappy - yasm - zlib - ) - if use system-ffmpeg; then - gn_system_libraries+=( ffmpeg opus ) - fi - if use system-icu; then - gn_system_libraries+=( icu ) - fi - if use system-libvpx; then - gn_system_libraries+=( libvpx ) - 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" - - # Optional dependencies. - 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_gnome_keyring=$(usex gnome-keyring true false)" - myconf_gn+=" use_kerberos=$(usex kerberos true false)" - myconf_gn+=" use_pulseaudio=$(usex pulseaudio 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 linux_use_bundled_binutils=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)" - 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 - 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 neon arm-neon arm) - 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" - - # Avoid CFLAGS problems, bug #352457, bug #390147. - if ! use custom-cflags; then - replace-flags "-Os" "-O2" - strip-flags - - # Prevent linker from running out of address space, bug #471810 . - if 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 - fi - fi - - # https://bugs.gentoo.org/588596 - #append-cxxflags $(test-flags-CXX -fno-delete-null-pointer-checks) - - # Bug 491582. - export TMPDIR="${WORKDIR}/temp" - mkdir -p -m 755 "${TMPDIR}" || die - - if ! use system-ffmpeg; 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 - - bootstrap_gn - - einfo "Configuring Chromium..." - set -- out/Release/gn gen --args="${myconf_gn} ${EXTRA_GN}" out/Release - echo "$@" - "$@" || die -} - -src_compile() { - # Calling this here supports resumption via FEATURES=keepwork - python_setup - - #"${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 -} - -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" ) - sed "${sedargs[@]}" "${FILESDIR}/chromium-launcher-r3.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 - - if use widevine; then - # These will be provided by chrome-binary-plugins - rm out/Release/libwidevinecdm*.so || die - fi - - insinto "${CHROMIUM_HOME}" - doins out/Release/*.bin - doins out/Release/*.pak - doins out/Release/*.so - - 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 and desktop entry. - local branding size - for size in 16 22 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 - - local mime_types="text/html;text/xml;application/xhtml+xml;" - mime_types+="x-scheme-handler/http;x-scheme-handler/https;" # bug #360797 - mime_types+="x-scheme-handler/ftp;" # bug #412185 - mime_types+="x-scheme-handler/mailto;x-scheme-handler/webcal;" # bug #416393 - make_desktop_entry \ - chromium-browser \ - "Chromium" \ - chromium-browser \ - "Network;WebBrowser" \ - "MimeType=${mime_types}\nStartupWMClass=chromium-browser" - sed -e "/^Exec/s/$/ %U/" -i "${ED}"/usr/share/applications/*.desktop || die - - # Install GNOME default application entry (bug #303100). - insinto /usr/share/gnome-control-center/default-apps - newins "${FILESDIR}"/chromium-browser.xml chromium-browser.xml - - readme.gentoo_create_doc -} - -pkg_preinst() { - gnome2_icon_savelist -} - -pkg_postrm() { - gnome2_icon_cache_update - xdg_desktop_database_update -} - -pkg_postinst() { - gnome2_icon_cache_update - xdg_desktop_database_update - readme.gentoo_print_elog -} diff --git a/www-client/chromium/chromium-66.0.3359.117-r2.ebuild b/www-client/chromium/chromium-66.0.3359.117-r2.ebuild new file mode 100644 index 00000000..8fb24994 --- /dev/null +++ b/www-client/chromium/chromium-66.0.3359.117-r2.ebuild @@ -0,0 +1,699 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" +PYTHON_COMPAT=( python2_7 ) + +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 eutils gnome2-utils flag-o-matic multilib ninja-utils pax-utils portability python-any-r1 readme.gentoo-r1 toolchain-funcs versionator xdg-utils + +DESCRIPTION="Open-source version of Google Chrome web browser" +HOMEPAGE="http://chromium.org/" +SRC_URI="https://commondatastorage.googleapis.com/chromium-browser-official/${P}.tar.xz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64" +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" +RESTRICT="!system-ffmpeg? ( proprietary-codecs? ( bindist ) )" + +COMMON_DEPEND=" + app-accessibility/at-spi2-atk:2 + app-arch/bzip2:= + cups? ( >=net-print/cups-1.3.11:= ) + dev-libs/atk + dev-libs/expat:= + dev-libs/glib:2 + system-icu? ( >=dev-libs/icu-59:= ) + >=dev-libs/libxml2-2.9.4-r3:=[icu] + dev-libs/libxslt:= + dev-libs/nspr:= + >=dev-libs/nss-3.26:= + gnome-keyring? ( >=gnome-base/libgnome-keyring-3.12:= ) + >=media-libs/alsa-lib-1.0.19:= + media-libs/fontconfig:= + media-libs/freetype:= + >=media-libs/harfbuzz-1.6.0:=[icu(-)] + media-libs/libjpeg-turbo:= + media-libs/libpng:= + system-libvpx? ( media-libs/libvpx:=[postproc,svc] ) + >=media-libs/openh264-1.6.0:= + pulseaudio? ( media-sound/pulseaudio:= ) + system-ffmpeg? ( + >=media-video/ffmpeg-3:= + || ( + media-video/ffmpeg[-samba] + >=net-fs/samba-4.5.10-r1[-debug(-)] + ) + !=net-fs/samba-4.5.12 + media-libs/opus:= + ) + sys-apps/dbus:= + sys-apps/pciutils:= + virtual/udev + x11-libs/cairo:= + x11-libs/gdk-pixbuf:2 + x11-libs/gtk+:3[X] + 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/libXScrnSaver:= + x11-libs/libXtst:= + x11-libs/pango:= + app-arch/snappy:= + media-libs/flac:= + >=media-libs/libwebp-0.4.0:= + sys-libs/zlib:=[minizip] + kerberos? ( virtual/krb5 ) +" +# For nvidia-drivers blocker, see bug #413637 . +RDEPEND="${COMMON_DEPEND} + !=www-client/chromium-9999 + !=dev-python/beautifulsoup-4.3.2:4[${PYTHON_USEDEP}]" && + has_version --host-root "dev-python/html5lib[${PYTHON_USEDEP}]" && + has_version --host-root "dev-python/simplejson[${PYTHON_USEDEP}]" +} + +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/bitstream-cyberbit +- 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. +" + +PATCHES=( + "${FILESDIR}/chromium-widevine-r1.patch" + "${FILESDIR}/chromium-FORTIFY_SOURCE-r2.patch" + "${FILESDIR}/chromium-webrtc-r0.patch" + "${FILESDIR}/chromium-memcpy-r0.patch" + "${FILESDIR}/chromium-clang-r2.patch" + "${FILESDIR}/chromium-math.h-r0.patch" + "${FILESDIR}/chromium-stdint.patch" + "${FILESDIR}/chromium-clang-r4.patch" + "${FILESDIR}/chromium-ffmpeg-r1.patch" + "${FILESDIR}/chromium-ffmpeg-clang.patch" + "${FILESDIR}/add-missing-blink-tools.patch" +) + +pre_build_checks() { + #if [[ ${MERGE_TYPE} != binary ]]; then + # local -x CPP="$(tc-getCXX) -E" + # if tc-is-clang && ! version_is_at_least "3.9.1" "$(clang-fullversion)"; then + # # bugs: #601654 + # die "At least clang 3.9.1 is required" + # fi + # if tc-is-gcc && ! version_is_at_least 5.0 "$(gcc-version)"; then + # # bugs: #535730, #525374, #518668, #600288, #627356 + # die "At least gcc 5.0 is required" + # fi + #fi + + # Check build requirements, bug #541816 and bug #471810 . + CHECKREQS_MEMORY="3G" + CHECKREQS_DISK_BUILD="5G" + eshopts_push -s extglob + if is-flagq '-g?(gdb)?([1-9])'; then + CHECKREQS_DISK_BUILD="25G" + if ! use component-build; then + CHECKREQS_MEMORY="16G" + fi + fi + eshopts_pop + check-reqs_pkg_setup +} + +pkg_pretend() { + pre_build_checks +} + +pkg_setup() { + pre_build_checks + + chromium_suid_sandbox_check_kernel_config +} + +src_prepare() { + # Calling this here supports resumption via FEATURES=keepwork + python_setup + + 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/dmg_fp + 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 + third_party/WebKit + third_party/analytics + third_party/angle + third_party/angle/src/common/third_party/base + third_party/angle/src/common/third_party/smhasher + 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/third_party/glslang + third_party/angle/third_party/spirv-headers + third_party/angle/third_party/spirv-tools + third_party/angle/third_party/vulkan-validation-layers + 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/cacheinvalidation + 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/polymer + third_party/catapult/tracing/third_party/d3 + third_party/catapult/tracing/third_party/gl-matrix + 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/crc32c + third_party/cros_system_api + third_party/devscripts + third_party/dom_distiller_js + third_party/fips181 + third_party/flatbuffers + third_party/flot + third_party/freetype + third_party/glslang-angle + 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/hunspell + third_party/iccjpeg + third_party/inspector_protocol + third_party/jinja2 + 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/x86inc + third_party/libjingle + third_party/libphonenumber + third_party/libsecret + third_party/libsrtp + third_party/libudev + third_party/libwebm + third_party/libxml/chromium + third_party/libyuv + third_party/llvm + third_party/lss + third_party/lzma_sdk + third_party/markupsafe + third_party/mesa + third_party/metrics_proto + third_party/modp_b64 + third_party/node + third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2 + third_party/openmax_dl + 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/ply + third_party/polymer + third_party/protobuf + third_party/protobuf/third_party/six + third_party/qcms + third_party/re2 + third_party/s2cellid + third_party/sfntly + third_party/skia + third_party/skia/third_party/gif + third_party/skia/third_party/vulkan + third_party/smhasher + third_party/spirv-headers + third_party/spirv-tools-angle + third_party/sqlite + third_party/swiftshader + third_party/swiftshader/third_party/llvm-subzero + third_party/swiftshader/third_party/subzero + third_party/unrar + third_party/usrsctp + third_party/vulkan + third_party/vulkan-validation-layers + third_party/web-animations-js + third_party/webdriver + third_party/webrtc + third_party/widevine + third_party/woff2 + third_party/zlib/google + url/third_party/mozilla + v8/src/third_party/valgrind + v8/src/third_party/utf8-decoder + v8/third_party/inspector_protocol + + # gyp -> gn leftovers + base/third_party/libevent + third_party/adobe + third_party/speech-dispatcher + third_party/usb_ids + third_party/xdg-utils + third_party/yasm/run_yasm.py + ) + 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 system-libvpx; then + keeplibs+=( third_party/libvpx ) + keeplibs+=( third_party/libvpx/source/libvpx/third_party/x86inc ) + fi + if use tcmalloc; then + keeplibs+=( third_party/tcmalloc ) + fi + + # Remove most bundled libraries. Some are still needed. + build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die +} + +bootstrap_gn() { + if tc-is-cross-compiler; then + local -x AR=${BUILD_AR} + local -x CC=${BUILD_CC} + local -x CXX=${BUILD_CXX} + local -x NM=${BUILD_NM} + local -x CFLAGS=${BUILD_CFLAGS} + local -x CXXFLAGS=${BUILD_CXXFLAGS} + local -x LDFLAGS=${BUILD_LDFLAGS} + fi + einfo "Building GN..." + set -- tools/gn/bootstrap/bootstrap.py -s -v --no-clean + echo "$@" + "$@" || 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 ! 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 + 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)" + + # https://chromium.googlesource.com/chromium/src/+/lkcr/docs/jumbo.md + myconf_gn+=" use_jumbo_build=$(usex jumbo-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 + libxml + libxslt + openh264 + snappy + yasm + zlib + ) + if use system-ffmpeg; then + gn_system_libraries+=( ffmpeg opus ) + fi + if use system-icu; then + gn_system_libraries+=( icu ) + fi + if use system-libvpx; then + gn_system_libraries+=( libvpx ) + 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" + + # Optional dependencies. + 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_gnome_keyring=$(usex gnome-keyring true false)" + myconf_gn+=" use_kerberos=$(usex kerberos true false)" + myconf_gn+=" use_pulseaudio=$(usex pulseaudio 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 linux_use_bundled_binutils=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)" + 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 + 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 neon arm-neon arm) + 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" + + # Avoid CFLAGS problems, bug #352457, bug #390147. + if ! use custom-cflags; then + replace-flags "-Os" "-O2" + strip-flags + + # Prevent linker from running out of address space, bug #471810 . + if 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 + fi + fi + + # https://bugs.gentoo.org/588596 + #append-cxxflags $(test-flags-CXX -fno-delete-null-pointer-checks) + + # Bug 491582. + export TMPDIR="${WORKDIR}/temp" + mkdir -p -m 755 "${TMPDIR}" || die + + if ! use system-ffmpeg; 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 + + bootstrap_gn + + einfo "Configuring Chromium..." + set -- out/Release/gn gen --args="${myconf_gn} ${EXTRA_GN}" out/Release + echo "$@" + "$@" || die +} + +src_compile() { + # Calling this here supports resumption via FEATURES=keepwork + python_setup + + #"${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 +} + +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" ) + sed "${sedargs[@]}" "${FILESDIR}/chromium-launcher-r3.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 + + if use widevine; then + # These will be provided by chrome-binary-plugins + rm out/Release/libwidevinecdm*.so || die + fi + + insinto "${CHROMIUM_HOME}" + doins out/Release/*.bin + doins out/Release/*.pak + doins out/Release/*.so + + 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 and desktop entry. + local branding size + for size in 16 22 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 + + local mime_types="text/html;text/xml;application/xhtml+xml;" + mime_types+="x-scheme-handler/http;x-scheme-handler/https;" # bug #360797 + mime_types+="x-scheme-handler/ftp;" # bug #412185 + mime_types+="x-scheme-handler/mailto;x-scheme-handler/webcal;" # bug #416393 + make_desktop_entry \ + chromium-browser \ + "Chromium" \ + chromium-browser \ + "Network;WebBrowser" \ + "MimeType=${mime_types}\nStartupWMClass=chromium-browser" + sed -e "/^Exec/s/$/ %U/" -i "${ED}"/usr/share/applications/*.desktop || die + + # Install GNOME default application entry (bug #303100). + insinto /usr/share/gnome-control-center/default-apps + newins "${FILESDIR}"/chromium-browser.xml chromium-browser.xml + + readme.gentoo_create_doc +} + +pkg_preinst() { + gnome2_icon_savelist +} + +pkg_postrm() { + gnome2_icon_cache_update + xdg_desktop_database_update +} + +pkg_postinst() { + gnome2_icon_cache_update + xdg_desktop_database_update + readme.gentoo_print_elog +} diff --git a/www-client/chromium/files/add-missing-blink-tools.patch b/www-client/chromium/files/add-missing-blink-tools.patch new file mode 100644 index 00000000..4eddd8c7 --- /dev/null +++ b/www-client/chromium/files/add-missing-blink-tools.patch @@ -0,0 +1,1071 @@ +Description: add back contents of third-party/blink/tools that went missing in the source tarball for 66.0.3359.106 +Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=832283 + +--- /dev/null ++++ b/third_party/blink/tools/OWNERS +@@ -0,0 +1 @@ ++file://third_party/WebKit/Tools/OWNERS +--- /dev/null ++++ b/third_party/blink/tools/blinkpy/__init__.py +@@ -0,0 +1,3 @@ ++# Copyright 2017 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. +--- /dev/null ++++ b/third_party/blink/tools/blinkpy/common/__init__.py +@@ -0,0 +1,3 @@ ++# Copyright 2017 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. +--- /dev/null ++++ b/third_party/blink/tools/blinkpy/common/name_style_converter.py +@@ -0,0 +1,128 @@ ++# Copyright 2017 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++# pylint: disable=import-error,print-statement,relative-import ++ ++import re ++ ++SPECIAL_TOKENS = [ ++ # This list should be sorted by length. ++ 'CString', ++ 'Float32', ++ 'Float64', ++ 'Base64', ++ 'IFrame', ++ 'Latin1', ++ 'PlugIn', ++ 'SQLite', ++ 'Uint16', ++ 'Uint32', ++ 'WebGL2', ++ 'ASCII', ++ 'CType', ++ 'DList', ++ 'Int16', ++ 'Int32', ++ 'MPath', ++ 'OList', ++ 'TSpan', ++ 'UList', ++ 'UTF16', ++ 'Uint8', ++ 'WebGL', ++ 'XPath', ++ 'ETC1', ++ 'HTML', ++ 'Int8', ++ 'S3TC', ++ 'SPv2', ++ 'UTF8', ++ 'API', ++ 'CSS', ++ 'DOM', ++ 'EXT', ++ 'RTC', ++ 'SVG', ++ '2D', ++ 'AX', ++ 'V0', ++ 'V8', ++] ++ ++MATCHING_EXPRESSION = '((?:[A-Z][a-z]+)|[0-9]D?$)' ++ ++ ++class SmartTokenizer(object): ++ """Detects special cases that are not easily discernible without additional ++ knowledge, such as recognizing that in SVGSVGElement, the first two SVGs ++ are separate tokens, but WebGL is one token.""" ++ ++ def __init__(self, name): ++ self.remaining = name ++ ++ def tokenize(self): ++ name = self.remaining ++ tokens = [] ++ while len(name) > 0: ++ matched_token = None ++ for token in SPECIAL_TOKENS: ++ if name.startswith(token): ++ matched_token = token ++ break ++ if not matched_token: ++ match = re.search(MATCHING_EXPRESSION, name) ++ if not match: ++ matched_token = name ++ elif match.start(0) != 0: ++ matched_token = name[:match.start(0)] ++ else: ++ matched_token = match.group(0) ++ tokens.append(name[:len(matched_token)]) ++ name = name[len(matched_token):] ++ return tokens ++ ++ ++class NameStyleConverter(object): ++ """Converts names from camelCase to various other styles. ++ """ ++ ++ def __init__(self, name): ++ self.tokens = self.tokenize(name) ++ ++ def tokenize(self, name): ++ tokenizer = SmartTokenizer(name) ++ return tokenizer.tokenize() ++ ++ def to_snake_case(self): ++ """Snake case is the file and variable name style per Google C++ Style ++ Guide: ++ https://google.github.io/styleguide/cppguide.html#Variable_Names ++ ++ Also known as the hacker case. ++ https://en.wikipedia.org/wiki/Snake_case ++ """ ++ return '_'.join([token.lower() for token in self.tokens]) ++ ++ def to_upper_camel_case(self): ++ """Upper-camel case is the class and function name style per ++ Google C++ Style Guide: ++ https://google.github.io/styleguide/cppguide.html#Function_Names ++ ++ Also known as the PascalCase. ++ https://en.wikipedia.org/wiki/Camel_case. ++ """ ++ return ''.join([token[0].upper() + token[1:] for token in self.tokens]) ++ ++ def to_macro_case(self): ++ """Macro case is the macro name style per Google C++ Style Guide: ++ https://google.github.io/styleguide/cppguide.html#Macro_Names ++ """ ++ return '_'.join([token.upper() for token in self.tokens]) ++ ++ def to_all_cases(self): ++ return { ++ 'snake_case': self.to_snake_case(), ++ 'upper_camel_case': self.to_upper_camel_case(), ++ 'macro_case': self.to_macro_case(), ++ } +--- /dev/null ++++ b/third_party/blink/tools/blinkpy/common/name_style_converter_test.py +@@ -0,0 +1,178 @@ ++# Copyright 2017 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++# pylint: disable=import-error,print-statement,relative-import,protected-access ++ ++"""Unit tests for name_style_converter.py.""" ++ ++import unittest ++ ++from name_style_converter import NameStyleConverter ++from name_style_converter import SmartTokenizer ++ ++ ++class SmartTokenizerTest(unittest.TestCase): ++ def test_simple_cases(self): ++ tokenizer = SmartTokenizer('foo') ++ self.assertEqual(tokenizer.tokenize(), ['foo']) ++ ++ tokenizer = SmartTokenizer('fooBar') ++ self.assertEqual(tokenizer.tokenize(), ['foo', 'Bar']) ++ ++ tokenizer = SmartTokenizer('fooBarBaz') ++ self.assertEqual(tokenizer.tokenize(), ['foo', 'Bar', 'Baz']) ++ ++ tokenizer = SmartTokenizer('Baz') ++ self.assertEqual(tokenizer.tokenize(), ['Baz']) ++ ++ tokenizer = SmartTokenizer('') ++ self.assertEqual(tokenizer.tokenize(), []) ++ ++ tokenizer = SmartTokenizer('FOO') ++ self.assertEqual(tokenizer.tokenize(), ['FOO']) ++ ++ tokenizer = SmartTokenizer('foo2') ++ self.assertEqual(tokenizer.tokenize(), ['foo', '2']) ++ ++ def test_tricky_cases(self): ++ tokenizer = SmartTokenizer('XMLHttpRequest') ++ self.assertEqual(tokenizer.tokenize(), ['XML', 'Http', 'Request']) ++ ++ tokenizer = SmartTokenizer('HTMLElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Element']) ++ ++ tokenizer = SmartTokenizer('WebGLRenderingContext') ++ self.assertEqual(tokenizer.tokenize(), ++ ['WebGL', 'Rendering', 'Context']) ++ ++ tokenizer = SmartTokenizer('CanvasRenderingContext2D') ++ self.assertEqual(tokenizer.tokenize(), ++ ['Canvas', 'Rendering', 'Context', '2D']) ++ tokenizer = SmartTokenizer('CanvasRenderingContext2DAPITest') ++ self.assertEqual(tokenizer.tokenize(), ++ ['Canvas', 'Rendering', 'Context', '2D', 'API', 'Test']) ++ ++ tokenizer = SmartTokenizer('SVGSVGElement') ++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'SVG', 'Element']) ++ ++ tokenizer = SmartTokenizer('CanvasRenderingContext2D') ++ self.assertEqual(tokenizer.tokenize(), ['Canvas', 'Rendering', 'Context', '2D']) ++ ++ tokenizer = SmartTokenizer('CSSURLImageValue') ++ self.assertEqual(tokenizer.tokenize(), ['CSS', 'URL', 'Image', 'Value']) ++ tokenizer = SmartTokenizer('CSSPropertyAPID') ++ self.assertEqual(tokenizer.tokenize(), ['CSS', 'Property', 'API', 'D']) ++ tokenizer = SmartTokenizer('AXARIAGridCell') ++ self.assertEqual(tokenizer.tokenize(), ['AX', 'ARIA', 'Grid', 'Cell']) ++ ++ tokenizer = SmartTokenizer('CDATASection') ++ self.assertEqual(tokenizer.tokenize(), ['CDATA', 'Section']) ++ ++ tokenizer = SmartTokenizer('ASCIICType') ++ self.assertEqual(tokenizer.tokenize(), ['ASCII', 'CType']) ++ tokenizer = SmartTokenizer('CString') ++ self.assertEqual(tokenizer.tokenize(), ['CString']) ++ ++ tokenizer = SmartTokenizer('HTMLDListElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'DList', 'Element']) ++ tokenizer = SmartTokenizer('HTMLOListElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'OList', 'Element']) ++ tokenizer = SmartTokenizer('HTMLIFrameElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'IFrame', 'Element']) ++ tokenizer = SmartTokenizer('HTMLPlugInElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'PlugIn', 'Element']) ++ ++ # No special handling for OptGroup, FieldSet, and TextArea. ++ tokenizer = SmartTokenizer('HTMLOptGroupElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Opt', 'Group', 'Element']) ++ tokenizer = SmartTokenizer('HTMLFieldSetElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Field', 'Set', 'Element']) ++ tokenizer = SmartTokenizer('HTMLTextAreaElement') ++ self.assertEqual(tokenizer.tokenize(), ['HTML', 'Text', 'Area', 'Element']) ++ ++ tokenizer = SmartTokenizer('Path2D') ++ self.assertEqual(tokenizer.tokenize(), ['Path', '2D']) ++ tokenizer = SmartTokenizer('Point2D') ++ self.assertEqual(tokenizer.tokenize(), ['Point', '2D']) ++ tokenizer = SmartTokenizer('CanvasRenderingContext2DState') ++ self.assertEqual(tokenizer.tokenize(), ['Canvas', 'Rendering', 'Context', '2D', 'State']) ++ ++ tokenizer = SmartTokenizer('RTCDTMFSender') ++ self.assertEqual(tokenizer.tokenize(), ['RTC', 'DTMF', 'Sender']) ++ ++ tokenizer = SmartTokenizer('WebGLCompressedTextureS3TCsRGB') ++ self.assertEqual(tokenizer.tokenize(), ['WebGL', 'Compressed', 'Texture', 'S3TC', 'sRGB']) ++ tokenizer = SmartTokenizer('WebGL2CompressedTextureETC1') ++ self.assertEqual(tokenizer.tokenize(), ['WebGL2', 'Compressed', 'Texture', 'ETC1']) ++ tokenizer = SmartTokenizer('EXTsRGB') ++ self.assertEqual(tokenizer.tokenize(), ['EXT', 'sRGB']) ++ ++ tokenizer = SmartTokenizer('SVGFEBlendElement') ++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'FE', 'Blend', 'Element']) ++ tokenizer = SmartTokenizer('SVGMPathElement') ++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'MPath', 'Element']) ++ tokenizer = SmartTokenizer('SVGTSpanElement') ++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'TSpan', 'Element']) ++ tokenizer = SmartTokenizer('SVGURIReference') ++ self.assertEqual(tokenizer.tokenize(), ['SVG', 'URI', 'Reference']) ++ ++ tokenizer = SmartTokenizer('UTF16TextIterator') ++ self.assertEqual(tokenizer.tokenize(), ['UTF16', 'Text', 'Iterator']) ++ tokenizer = SmartTokenizer('UTF8Decoder') ++ self.assertEqual(tokenizer.tokenize(), ['UTF8', 'Decoder']) ++ tokenizer = SmartTokenizer('Uint8Array') ++ self.assertEqual(tokenizer.tokenize(), ['Uint8', 'Array']) ++ tokenizer = SmartTokenizer('DOMWindowBase64') ++ self.assertEqual(tokenizer.tokenize(), ['DOM', 'Window', 'Base64']) ++ tokenizer = SmartTokenizer('TextCodecLatin1') ++ self.assertEqual(tokenizer.tokenize(), ['Text', 'Codec', 'Latin1']) ++ tokenizer = SmartTokenizer('V8BindingForCore') ++ self.assertEqual(tokenizer.tokenize(), ['V8', 'Binding', 'For', 'Core']) ++ tokenizer = SmartTokenizer('V8DOMRect') ++ self.assertEqual(tokenizer.tokenize(), ['V8', 'DOM', 'Rect']) ++ ++ tokenizer = SmartTokenizer('V0InsertionPoint') ++ self.assertEqual(tokenizer.tokenize(), ['V0', 'Insertion', 'Point']) ++ tokenizer = SmartTokenizer('ShadowDOMV0Test') ++ self.assertEqual(tokenizer.tokenize(), ['Shadow', 'DOM', 'V0', 'Test']) ++ tokenizer = SmartTokenizer('ElementShadowV0') ++ self.assertEqual(tokenizer.tokenize(), ['Element', 'Shadow', 'V0']) ++ tokenizer = SmartTokenizer('StubChromeClientForSPv2') ++ self.assertEqual(tokenizer.tokenize(), ['Stub', 'Chrome', 'Client', 'For', 'SPv2']) ++ ++ tokenizer = SmartTokenizer('SQLiteAuthorizer') ++ self.assertEqual(tokenizer.tokenize(), ['SQLite', 'Authorizer']) ++ tokenizer = SmartTokenizer('XPathEvaluator') ++ self.assertEqual(tokenizer.tokenize(), ['XPath', 'Evaluator']) ++ ++ tokenizer = SmartTokenizer('IsXHTMLDocument') ++ self.assertEqual(tokenizer.tokenize(), ['Is', 'XHTML', 'Document']) ++ ++ tokenizer = SmartTokenizer('Animation.idl') ++ self.assertEqual(tokenizer.tokenize(), ['Animation', '.idl']) ++ ++ ++class NameStyleConverterTest(unittest.TestCase): ++ def test_snake_case(self): ++ converter = NameStyleConverter('HTMLElement') ++ self.assertEqual(converter.to_snake_case(), 'html_element') ++ ++ def test_upper_camel_case(self): ++ converter = NameStyleConverter('someSuperThing') ++ self.assertEqual(converter.to_upper_camel_case(), 'SomeSuperThing') ++ ++ converter = NameStyleConverter('SVGElement') ++ self.assertEqual(converter.to_upper_camel_case(), 'SVGElement') ++ ++ def test_macro_case(self): ++ converter = NameStyleConverter('WebGLBaz2D') ++ self.assertEqual(converter.to_macro_case(), 'WEBGL_BAZ_2D') ++ ++ def test_all_cases(self): ++ converter = NameStyleConverter('SVGScriptElement') ++ self.assertEqual(converter.to_all_cases(), { ++ 'snake_case': 'svg_script_element', ++ 'upper_camel_case': 'SVGScriptElement', ++ 'macro_case': 'SVG_SCRIPT_ELEMENT', ++ }) +--- /dev/null ++++ b/third_party/blink/tools/compile_devtools_frontend.py +@@ -0,0 +1,20 @@ ++#!/usr/bin/env vpython ++# Copyright 2017 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++"""Compile DevTools frontend code with Closure compiler. ++ ++This script wraps devtools/scripts/compile_frontend.py. ++DevTools bot kicks this script. ++""" ++ ++import os ++import sys ++ ++sys.path.append(os.path.join( ++ os.path.dirname(__file__), '..', '..', 'WebKit', 'Source', 'devtools', 'scripts')) ++import compile_frontend ++ ++if __name__ == '__main__': ++ sys.exit(compile_frontend.main()) +--- /dev/null ++++ b/third_party/blink/tools/move_blink_source.py +@@ -0,0 +1,615 @@ ++#!/usr/bin/env vpython ++# Copyright 2017 The Chromium Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++"""Tool to move Blink source from third_party/WebKit to third_party/blink. ++ ++See https://docs.google.com/document/d/1l3aPv1Wx__SpRkdOhvJz8ciEGigNT3wFKv78XiuW0Tw/edit?usp=sharing#heading=h.o225wrxp242h ++for the details. ++""" ++ ++import argparse ++import logging ++import os ++import re ++import sys ++from functools import partial ++ ++# Without abspath(), PathFinder can't find chromium_base correctly. ++sys.path.append(os.path.abspath( ++ os.path.join(os.path.dirname(__file__), '..', '..', '..', ++ 'third_party', 'WebKit', 'Tools', 'Scripts'))) ++from blinkpy.common.name_style_converter import NameStyleConverter ++from plan_blink_move import plan_blink_move ++from plan_blink_move import relative_dest ++from webkitpy.common.checkout.git import Git ++from webkitpy.common.path_finder import get_chromium_src_dir ++from webkitpy.common.path_finder import get_scripts_dir ++from webkitpy.common.system.executive import Executive ++from webkitpy.common.system.executive import ScriptError ++from webkitpy.common.system.filesystem import FileSystem ++ ++_log = logging.getLogger('move_blink_source') ++ ++ ++class FileType(object): ++ NONE = 0 ++ BUILD = 1 ++ BLINK_BUILD = 2 ++ OWNERS = 3 ++ DEPS = 4 ++ MOJOM = 5 ++ TYPEMAP = 6 ++ BLINK_BUILD_PY = 7 ++ LAYOUT_TESTS_WITH_MOJOM = 8 ++ ++ @staticmethod ++ def detect(path): ++ slash_dir, basename = os.path.split(path) ++ slash_dir = slash_dir.replace(os.path.sep, '/') ++ if basename == 'DEPS': ++ return FileType.DEPS ++ if basename == 'OWNERS': ++ return FileType.OWNERS ++ if basename.endswith('.mojom'): ++ return FileType.MOJOM ++ if basename.endswith('.typemap'): ++ return FileType.TYPEMAP ++ if basename.endswith('.py') and 'third_party/WebKit/Source/build' in slash_dir: ++ return FileType.BLINK_BUILD_PY ++ if basename.endswith(('.gn', '.gni')): ++ if 'third_party/WebKit' in path or 'third_party/blink' in slash_dir: ++ return FileType.BLINK_BUILD ++ if 'third_party' in slash_dir: ++ return FileType.NONE ++ return FileType.BUILD ++ if basename.endswith('.html') and re.search( ++ r'third_party/WebKit/LayoutTests/(geolocation-api|installedapp|' + ++ r'media/mediasession|payments|presentation|webshare)', slash_dir): ++ return FileType.LAYOUT_TESTS_WITH_MOJOM ++ return FileType.NONE ++ ++ ++class MoveBlinkSource(object): ++ ++ def __init__(self, fs, options, repo_root): ++ self._fs = fs ++ self._options = options ++ _log.debug(options) ++ self._repo_root = repo_root ++ ++ # The following fields are initialized in _create_basename_maps. ++ self._basename_map = None ++ self._basename_re = None ++ self._idl_generated_impl_headers = None ++ # _checked_in_header_re is used to distinguish checked-in header files ++ # and generated header files. ++ self._checked_in_header_re = None ++ ++ self._updated_files = [] ++ ++ def update(self, apply_only=None): ++ """Updates contents of files affected by Blink source move. ++ ++ Args: ++ apply_only: If it's None, updates all affected files. Otherwise, ++ it should be a set of file paths and this function updates ++ only the files in |apply_only|. ++ """ ++ _log.info('Planning renaming ...') ++ file_pairs = plan_blink_move(self._fs, []) ++ _log.info('Will move %d files', len(file_pairs)) ++ ++ self._create_basename_maps(file_pairs) ++ dirs = self._update_file_content(apply_only) ++ ++ # Updates #includes in files in directories with updated DEPS + ++ # third_party/WebKit/{Source,common,public}. ++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'third_party', 'WebKit', 'Source')) ++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'third_party', 'WebKit', 'common')) ++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'third_party', 'WebKit', 'public')) ++ self._append_unless_upper_dir_exists(dirs, self._fs.join(self._repo_root, 'mojo', 'public', 'tools', ++ 'bindings', 'generators', 'cpp_templates')) ++ self._update_cpp_includes_in_directories(dirs, apply_only) ++ ++ # Content update for individual files. ++ # The following is a list of tuples. ++ # Tuple: (, [replacement commands]) ++ # Command: a callable object, or ++ # a tuple of (, ). ++ file_replacement_list = [ ++ ('DEPS', ++ [('src/third_party/WebKit/Source/devtools', ++ 'src/third_party/blink/renderer/devtools')]), ++ ('WATCHLISTS', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer'), ++ ('third_party/WebKit/public', 'third_party/blink/renderer/public')]), ++ ('build/check_gn_headers_whitelist.txt', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer'), ++ ('third_party/WebKit/public', 'third_party/blink/renderer/public'), ++ self._update_basename]), ++ ('testing/buildbot/gn_isolate_map.pyl', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]), ++ ('third_party/WebKit/Source/BUILD.gn', ++ [('$root_gen_dir/third_party/WebKit', ++ '$root_gen_dir/third_party/blink/renderer')]), ++ ('third_party/WebKit/Source/config.gni', ++ [('snake_case_source_files = false', ++ 'snake_case_source_files = true')]), ++ ('third_party/WebKit/Source/core/css/CSSProperties.json5', ++ [self._update_basename]), ++ ('third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5', ++ [self._update_basename]), ++ ('third_party/WebKit/Source/core/css/ComputedStyleFieldAliases.json5', ++ [self._update_basename]), ++ ('third_party/WebKit/Source/core/html/parser/create-html-entity-table', ++ [self._update_basename]), ++ ('third_party/WebKit/Source/core/inspector/inspector_protocol_config.json', ++ [self._update_basename]), ++ ('third_party/WebKit/Source/core/probe/CoreProbes.json5', ++ [self._update_basename]), ++ ('third_party/WebKit/Source/core/testing/InternalSettings.h', ++ [('InternalSettingsGenerated.h', 'internal_settings_generated.h')]), ++ ('third_party/WebKit/Source/core/testing/Internals.cpp', ++ [('InternalRuntimeFlags.h', 'internal_runtime_flags.h')]), ++ ('third_party/WebKit/Source/platform/probe/PlatformProbes.json5', ++ [self._update_basename]), ++ ('third_party/WebKit/public/BUILD.gn', ++ [('$root_gen_dir/third_party/WebKit', ++ '$root_gen_dir/third_party/blink/renderer')]), ++ ('third_party/WebKit/public/blink_resources.grd', ++ [('../Source/', '../')]), ++ ('tools/android/eclipse/.classpath', ++ [('third_party/WebKit/public', 'third_party/blink/renderer/public')]), ++ ('tools/android/loading/cloud/backend/deploy.sh', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]), ++ ('tools/android/loading/emulation_unittest.py', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]), ++ ('tools/android/loading/options.py', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]), ++ ('tools/android/loading/request_track.py', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]), ++ ('tools/gritsettings/resource_ids', ++ [('third_party/WebKit/public', 'third_party/blink/renderer/public'), ++ ('third_party/WebKit/Source', 'third_party/blink/renderer')]), ++ ('tools/metrics/actions/extract_actions.py', ++ [('third_party/WebKit/Source', 'third_party/blink/renderer')]), ++ ('tools/metrics/histograms/update_editor_commands.py', ++ [('third_party/WebKit/Source/core/editing/EditorCommand.cpp', ++ 'third_party/blink/renderer/core/editing/editor_command.cc')]), ++ ('tools/metrics/histograms/update_use_counter_css.py', ++ [('third_party/WebKit/Source/core/frame/UseCounter.cpp', ++ 'third_party/blink/renderer/core/frame/use_counter.cc')]), ++ ('tools/metrics/histograms/update_use_counter_feature_enum.py', ++ [('third_party/WebKit/public', 'third_party/blink/renderer/public')]), ++ ] ++ for file_path, replacement_list in file_replacement_list: ++ if not apply_only or file_path in apply_only: ++ self._update_single_file_content(file_path, replacement_list, should_write=self._options.run) ++ ++ if self._options.run: ++ _log.info('Formatting updated %d files ...', len(self._updated_files)) ++ git = Git(cwd=self._repo_root) ++ # |git cl format| can't handle too many files at once. ++ while len(self._updated_files) > 0: ++ end_index = 100 ++ if end_index > len(self._updated_files): ++ end_index = len(self._updated_files) ++ git.run(['cl', 'format'] + self._updated_files[:end_index]) ++ self._updated_files = self._updated_files[end_index:] ++ ++ if not apply_only: ++ _log.info('Make a local commit ...') ++ git.commit_locally_with_message("""The Great Blink mv for source files, part 1. ++ ++Update file contents without moving files. ++ ++NOAUTOREVERT=true ++Bug: 768828 ++""") ++ ++ def move(self, apply_only=None): ++ """Move Blink source files. ++ ++ Args: ++ apply_only: If it's None, move all affected files. Otherwise, ++ it should be a set of file paths and this function moves ++ only the files in |apply_only|. ++ """ ++ _log.info('Planning renaming ...') ++ file_pairs = plan_blink_move(self._fs, []) ++ ++ if apply_only: ++ file_pairs = [(src, dest) for (src, dest) in file_pairs ++ if 'third_party/WebKit/' + src.replace('\\', '/') in apply_only] ++ print 'Update file_pairs = ', file_pairs ++ _log.info('Will move %d files', len(file_pairs)) ++ ++ git = Git(cwd=self._repo_root) ++ files_set = self._get_checked_in_files(git) ++ for i, (src, dest) in enumerate(file_pairs): ++ src_from_repo = self._fs.join('third_party', 'WebKit', src) ++ if src_from_repo.replace('\\', '/') not in files_set: ++ _log.info('%s is not in the repository', src) ++ continue ++ dest_from_repo = self._fs.join('third_party', 'blink', dest) ++ self._fs.maybe_make_directory(self._repo_root, 'third_party', 'blink', self._fs.dirname(dest)) ++ if self._options.run_git: ++ git.move(src_from_repo, dest_from_repo) ++ _log.info('[%d/%d] Git moved %s', i + 1, len(file_pairs), src) ++ else: ++ self._fs.move(self._fs.join(self._repo_root, src_from_repo), ++ self._fs.join(self._repo_root, dest_from_repo)) ++ _log.info('[%d/%d] Moved %s', i + 1, len(file_pairs), src) ++ if apply_only: ++ return ++ ++ self._update_single_file_content( ++ 'build/get_landmines.py', ++ [('\ndef main', ' print \'The Great Blink mv for source files (crbug.com/768828)\'\n\ndef main')]) ++ ++ _log.info('Run run-bindings-tests ...') ++ Executive().run_command(['python', ++ self._fs.join(get_scripts_dir(), 'run-bindings-tests'), ++ '--reset-results'], ++ cwd=self._repo_root) ++ ++ if self._options.run_git: ++ _log.info('Make a local commit ...') ++ git.commit_locally_with_message("""The Great Blink mv for source files, part 2. ++ ++Move and rename files. ++ ++NOAUTOREVERT=true ++Bug: 768828 ++""") ++ ++ def fix_branch(self): ++ git = Git(cwd=self._repo_root) ++ status = self._get_local_change_status(git) ++ if len(status) == 0: ++ _log.info('No local changes.') ++ return ++ modified_files = {f for (s, f) in status if s != 'D'} ++ deleted_files = {f for (s, f) in status if s == 'D'} ++ ++ self.update(apply_only=modified_files) ++ self.move(apply_only=modified_files) ++ try: ++ git.commit_locally_with_message('This commit should be squashed.') ++ except ScriptError: ++ _log.info('move_blink_source.py modified nothing.') ++ ++ # TODO(tkent): Show a message about deleted_files. ++ ++ def _get_local_change_status(self, git): ++ """Returns a list of tuples representing local change summary. ++ ++ Each tuple contains two strings. The first one is file change status ++ such as "M", "D". See --diff-filter section of git-diff manual page. ++ The second one is file name relative to the repository top. ++ """ ++ ++ base_commit = git.run(['show-branch', '--merge-base', 'master', 'HEAD']).strip() ++ # Note that file names in the following command result are always ++ # slash-separated, even on Windows. ++ status_lines = git.run(['diff', '--name-status', '--no-renames', base_commit]).split('\n') ++ status_tuple_list = [] ++ for l in status_lines: ++ items = l.split('\t') ++ if len(items) == 2: ++ status_tuple_list.append(tuple(items)) ++ elif len(l) > 0: ++ _log.warning('Unrecognized diff output: "%s"', l) ++ return status_tuple_list ++ ++ def _get_checked_in_files(self, git): ++ files_text = git.run(['ls-files', ++ 'third_party/WebKit/Source', ++ 'third_party/WebKit/common', ++ 'third_party/WebKit/public']) ++ return set(files_text.split('\n')) ++ ++ def _create_basename_maps(self, file_pairs): ++ basename_map = {} ++ # Generated inspector/protocol/* contains a lot of names duplicated with ++ # checked-in core files. We don't want to rename them, and don't want to ++ # replace them in BUILD.gn and #include accidentally. ++ pattern = r'(? => ' ++ for pair in file_pairs: ++ print '%s\t=>\t%s' % pair ++ ++ ++if __name__ == '__main__': ++ main() -- cgit v1.2.3