From 7afc35b5a72a247a9b4108ee00dfd0322f7b0b34 Mon Sep 17 00:00:00 2001 From: Suwako Moriya Date: Sat, 20 Apr 2019 23:19:31 +0200 Subject: [PATCH] Added ungoogled-chromium --- www-client/ungoogled-chromium-bin/Manifest | 5 + .../files/chromium-browser.xml | 13 + .../ungoogled-chromium-bin-launcher-r3.sh | 39 + .../files/ungoogled-chromium-bin.default | 10 + ...oogled-chromium-bin-71.0.3578.98_p2.ebuild | 185 ++++ www-client/ungoogled-chromium/Manifest | 14 + .../files/chromium-browser.xml | 13 + .../ungoogled-chromium-compiler-r5.patch | 54 ++ .../files/ungoogled-chromium-gold-r2.patch | 60 ++ .../files/ungoogled-chromium-launcher-r3.sh | 39 + ...um-libusb-interrupt-event-handler-r0.patch | 15 + .../ungoogled-chromium-system-libusb-r0.patch | 41 + .../files/ungoogled-chromium.default | 10 + ...ngoogled-chromium-72.0.3626.121_pre.ebuild | 834 ++++++++++++++++++ ...ungoogled-chromium-72.0.3626.122_p1.ebuild | 834 ++++++++++++++++++ 15 files changed, 2166 insertions(+) create mode 100644 www-client/ungoogled-chromium-bin/Manifest create mode 100644 www-client/ungoogled-chromium-bin/files/chromium-browser.xml create mode 100644 www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin-launcher-r3.sh create mode 100644 www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin.default create mode 100644 www-client/ungoogled-chromium-bin/ungoogled-chromium-bin-71.0.3578.98_p2.ebuild create mode 100644 www-client/ungoogled-chromium/Manifest create mode 100644 www-client/ungoogled-chromium/files/chromium-browser.xml create mode 100644 www-client/ungoogled-chromium/files/ungoogled-chromium-compiler-r5.patch create mode 100644 www-client/ungoogled-chromium/files/ungoogled-chromium-gold-r2.patch create mode 100644 www-client/ungoogled-chromium/files/ungoogled-chromium-launcher-r3.sh create mode 100644 www-client/ungoogled-chromium/files/ungoogled-chromium-libusb-interrupt-event-handler-r0.patch create mode 100644 www-client/ungoogled-chromium/files/ungoogled-chromium-system-libusb-r0.patch create mode 100644 www-client/ungoogled-chromium/files/ungoogled-chromium.default create mode 100644 www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.121_pre.ebuild create mode 100644 www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.122_p1.ebuild diff --git a/www-client/ungoogled-chromium-bin/Manifest b/www-client/ungoogled-chromium-bin/Manifest new file mode 100644 index 0000000..1b04ceb --- /dev/null +++ b/www-client/ungoogled-chromium-bin/Manifest @@ -0,0 +1,5 @@ +AUX chromium-browser.xml 407 BLAKE2B 168d78b0855546ca559cfb51aff0bc85d5e6ae974c25eb76e4a02f6d11659489c6e40397a0b2f7bc1fda336fd2c6dd8c863fccc3340719210b41c7fef51927f4 SHA512 b767fb4fd1925029d95560fc14cb7ab12ae43b2fe923e92d75e733b9723cbe1dcdf6df041a2b62554e98b79b47ef3f6028c773e72e6fd53166a021d49657aeca +AUX ungoogled-chromium-bin-launcher-r3.sh 1213 BLAKE2B de8f705f8dba957fb39acd79ecc525bee9759f55bb82bf8f9f65333da3f017633662cd0e7286431e790d7affda5711d794c2b77cbcd0a17554e63b07c534ddf3 SHA512 4281692e282a4bd2396aff3f8683c2159478ec1a33805547c2e3723eff3fb77b6cbe5162fae9e01e2d2de4ca0a3397f22d08964ae95198a1a9a30965724306a4 +AUX ungoogled-chromium-bin.default 333 BLAKE2B 896d53b121d85827ca039da8138239bb4f82435fdfe8b1a93bb32e828dc66e6df6d41da761dd5237df96a3d54227dc3bd5016377e8040dc6aec3a27547cb1bc7 SHA512 7d53e55b14d323062cdaca1148af6aaf7697855aeb2edb4f6eaaa984b0be402397cde1f3a75ab20b4948ef6f9024927ff0baae49a5cb3bb037d917efafd8334b +DIST ungoogled-chromium-bin-71.0.3578.98-2.tar.xz 67085136 BLAKE2B 473bba24c2c158770169cef633b53118645ba9201102e38347ca83392107b3f5203ea66ab6d40fd07578731a89895fe1f839ec57ffa95944a371997eb75726a5 SHA512 d64b1e43aab8834b8a2aa6b59232de462f970a1c14f258e5a534498f08e502eb39de668730d160889ed7a99544c0f77130f5efe6634c75dee4f6a4b0e3240a63 +EBUILD ungoogled-chromium-bin-71.0.3578.98_p2.ebuild 4773 BLAKE2B f7362639f06c489c9acfcbdae7dc10cb78c6c71f2aed400517ad4426ee045627bdd34cd16822ec31e6fde4e7b231305c33f3f86db12676391c7ce5ab7ec3b1e7 SHA512 bce99b7b7bd48d5cdab4e6aad639430decf8eb1173e2f2594f8bd45947a14088c2a3a9d2769b558c52e0800dc82dd42ae10b9693e428eb2105c9c909a81e5836 diff --git a/www-client/ungoogled-chromium-bin/files/chromium-browser.xml b/www-client/ungoogled-chromium-bin/files/chromium-browser.xml new file mode 100644 index 0000000..2c95a55 --- /dev/null +++ b/www-client/ungoogled-chromium-bin/files/chromium-browser.xml @@ -0,0 +1,13 @@ + + + + + + Chromium + chromium-browser + chromium-browser %s + chromium-browser + false + + + diff --git a/www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin-launcher-r3.sh b/www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin-launcher-r3.sh new file mode 100644 index 0000000..40d8c3a --- /dev/null +++ b/www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin-launcher-r3.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Allow the user to override command-line flags, bug #357629. +# This is based on Debian's chromium-browser package, and is intended +# to be consistent with Debian. +for f in /etc/chromium/*; do + [[ -f ${f} ]] && source "${f}" +done + +# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system +# default CHROMIUM_FLAGS (from /etc/chromium/default). +CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"} + +# Let the wrapped binary know that it has been run through the wrapper +export CHROME_WRAPPER=$(readlink -f "$0") + +PROGDIR=${CHROME_WRAPPER%/*} + +case ":$PATH:" in + *:$PROGDIR:*) + # $PATH already contains $PROGDIR + ;; + *) + # Append $PROGDIR to $PATH + export PATH="$PATH:$PROGDIR" + ;; +esac + +if [[ ${EUID} == 0 && -O ${XDG_CONFIG_HOME:-${HOME}} ]]; then + # Running as root with HOME owned by root. + # Pass --user-data-dir to work around upstream failsafe. + CHROMIUM_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/chromium + ${CHROMIUM_FLAGS}" +fi + +# Set the .desktop file name +export CHROME_DESKTOP="chromium-browser-ungoogled-chromium-bin.desktop" + +exec -a "chromium-browser" "$PROGDIR/chrome" --extra-plugin-dir=/usr/lib/nsbrowser/plugins ${CHROMIUM_FLAGS} "$@" diff --git a/www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin.default b/www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin.default new file mode 100644 index 0000000..32a1d58 --- /dev/null +++ b/www-client/ungoogled-chromium-bin/files/ungoogled-chromium-bin.default @@ -0,0 +1,10 @@ +# Default settings for ungoogled-chromium. This file is sourced by /bin/bash +# from the chromium launcher. + +# Uncomment this to spoof timezone to UTC +#export TZ='Etc/UTC' + +# Options to pass to ungoogled-chromium. +# See https://github.com/Eloston/ungoogled-chromium#features for additional +# command-line switches. +#CHROMIUM_FLAGS="" diff --git a/www-client/ungoogled-chromium-bin/ungoogled-chromium-bin-71.0.3578.98_p2.ebuild b/www-client/ungoogled-chromium-bin/ungoogled-chromium-bin-71.0.3578.98_p2.ebuild new file mode 100644 index 0000000..0beef8b --- /dev/null +++ b/www-client/ungoogled-chromium-bin/ungoogled-chromium-bin-71.0.3578.98_p2.ebuild @@ -0,0 +1,185 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +CHROMIUM_LANGS=" + am ar bg bn ca cs da de el en-GB en-US es-419 es 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 chromium-2 desktop readme.gentoo-r1 xdg-utils + +MY_PV="${PV/_p/-}" +MY_PN="${PN/-bin}" +MY_P="${MY_PN}_${MY_PV}_linux" + +DESCRIPTION="Modifications to Chromium for removing Google integration and enhancing privacy" +HOMEPAGE="https://github.com/Eloston/ungoogled-chromium" +SRC_URI="https://github.com/intika/uc-arch-binaries/releases/download/${MY_PV}/${MY_P}.tar.xz -> ${PN}-${MY_PV}.tar.xz" +RESTRICT="mirror" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="-* ~amd64" +IUSE="+suid widevine" + +RDEPEND=" + app-accessibility/at-spi2-atk:2 + app-arch/bzip2 + >=net-print/cups-1.3.11 + dev-libs/atk + dev-libs/expat + dev-libs/glib:2 + dev-libs/nspr + >=dev-libs/nss-3.26 + >=media-libs/alsa-lib-1.0.19 + media-libs/fontconfig + media-libs/freetype + >=media-libs/harfbuzz-1.6.0 + media-libs/libpng + sys-apps/dbus + sys-apps/pciutils + virtual/opengl + virtual/ttf-fonts + 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 + x11-misc/xdg-utils + widevine? ( www-plugins/chrome-binary-plugins[widevine(-)] ) + !www-client/chromium + !www-client/ungoogled-chromium +" + +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/noto-emoji +- 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. +" + +QA_PREBUILT="*" +S="${WORKDIR}/${MY_P}" + +pkg_pretend() { + # Protect against people using autounmask overzealously + use amd64 || die "${PN} only works on amd64" +} + +pkg_setup() { + chromium_suid_sandbox_check_kernel_config +} + +src_install() { + local CHROMIUM_HOME="/opt/chromium-browser" + exeinto "${CHROMIUM_HOME}" + doexe chrome + + if use suid; then + newexe chrome_sandbox chrome-sandbox + fperms 4755 "${CHROMIUM_HOME}/chrome-sandbox" + fi + + if use widevine; then + dosym "../../usr/$(get_libdir)/chromium/libwidevinecdm.so" \ + "${CHROMIUM_HOME}/libwidevinecdm.so" + fi + + doexe chromedriver + + newexe "${FILESDIR}/${PN}-launcher-r3.sh" chromium-launcher.sh + sed -i "s:/usr/lib/:/usr/$(get_libdir)/:g" \ + "${ED}${CHROMIUM_HOME}/chromium-launcher.sh" || die + + # 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}/${PN}.default" "default" + + pushd locales > /dev/null || die + chromium_remove_language_paks + popd > /dev/null || die + + insinto "${CHROMIUM_HOME}" + doins ./*.bin + doins ./*.pak + doins ./*.so + doins icudtl.dat + + doins -r locales + doins -r resources + + # Install icons and desktop entry + newicon -s 48 "product_logo_48.png" chromium-browser.png + + 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 + # shellcheck disable=SC1117 + make_desktop_entry \ + chromium-browser \ + "Chromium" \ + chromium-browser \ + "Network;WebBrowser" \ + "MimeType=${mime_types}\nStartupWMClass=chromium-browser" + sed -i "/^Exec/s/$/ %U/" "${ED}"/usr/share/applications/*.desktop || die + + # Install GNOME default application entry (bug #303100) + insinto /usr/share/gnome-control-center/default-apps + doins "${FILESDIR}/chromium-browser.xml" + + readme.gentoo_create_doc +} + +update_caches() { + if type gtk-update-icon-cache &>/dev/null; then + ebegin "Updating GTK icon cache" + gtk-update-icon-cache "${EROOT}/usr/share/icons/hicolor" + eend $? || die + fi + xdg_desktop_database_update +} + +pkg_postrm() { + update_caches +} + +pkg_postinst() { + update_caches + readme.gentoo_print_elog +} diff --git a/www-client/ungoogled-chromium/Manifest b/www-client/ungoogled-chromium/Manifest new file mode 100644 index 0000000..c4b7cb7 --- /dev/null +++ b/www-client/ungoogled-chromium/Manifest @@ -0,0 +1,14 @@ +AUX chromium-browser.xml 407 BLAKE2B 168d78b0855546ca559cfb51aff0bc85d5e6ae974c25eb76e4a02f6d11659489c6e40397a0b2f7bc1fda336fd2c6dd8c863fccc3340719210b41c7fef51927f4 SHA512 b767fb4fd1925029d95560fc14cb7ab12ae43b2fe923e92d75e733b9723cbe1dcdf6df041a2b62554e98b79b47ef3f6028c773e72e6fd53166a021d49657aeca +AUX ungoogled-chromium-compiler-r5.patch 1552 BLAKE2B 346207850df315556b99198d7e418cdedee788cee6846d40d563ea785675657de6c644d1c2cac0b68613b183d9b7673f909d6c41d4cb88270913cd95946fb1d2 SHA512 52c80ada46c3f3ec95289011fe9881c90703ecaa5e63156f0157fa5816333ebf745ededb6af17be36b287caa8fed76a620964563c99dea0dcded7bd55d335011 +AUX ungoogled-chromium-gold-r2.patch 2416 BLAKE2B 05711c221571b3ffd11de196a0d41ff4b1c6481f1550fa9ca2bdcf225b9c5759ab690e4efbc475a9e0264389304176af0a0621f6ad81f80f89927b55beb07a11 SHA512 7c6ae91f343fbd8dbba78f48c872656da2f05006dfa5436c16b054aeefcb2353f5fa00e55e9b932497d5a28844e4f0149a2e80a69a33fd96b3f423393f977f57 +AUX ungoogled-chromium-launcher-r3.sh 1209 BLAKE2B 788893ccd7564ce96f1b67d6240c5e384ab824d6cba7dca6dfc8e72b7fe5a1c377d2154691503a08e40a072b100f6d6bf021fa752f093d210c217b613bb77438 SHA512 34434668f03ae4b019f8602f9a4b9f515f175e04a4370bfb36b3e68df026d58102c2f0f6ef76e08da549021de197cc8f6655b8350b164a47528155cb7bea9a15 +AUX ungoogled-chromium-libusb-interrupt-event-handler-r0.patch 690 BLAKE2B 592fd48f1904ec1b6e840978e429573e6ea3cb555993b223582a440a6923241d14005123f2c42454beeda13226d21e98288524a6de98c37cee9d41bd81057959 SHA512 3b3be94f3edf1173bffea48a01541c2f3de8511f687ab4cc19a5ff52db15f4125034674bca0bd11a637dca2f4f7b33b9c583183dd1e567bdb66ac230cc052bd8 +AUX ungoogled-chromium-system-libusb-r0.patch 1370 BLAKE2B 5bd104117eef48ee9126a5fcabf03db7e965e044b79090aece8764662a35f83f4da0b5b657932034314c97ba1b5f1b729c37d6754b192e90ea47d32394c1efc5 SHA512 9ee5d381bfc4e2eb49c60ae6cdae16f81521242e20fb3250eeeea5ed0a19d5e219b1706a195b4665323558384e0a7edb6cf29101924834390139ffd69606fc17 +AUX ungoogled-chromium.default 333 BLAKE2B 896d53b121d85827ca039da8138239bb4f82435fdfe8b1a93bb32e828dc66e6df6d41da761dd5237df96a3d54227dc3bd5016377e8040dc6aec3a27547cb1bc7 SHA512 7d53e55b14d323062cdaca1148af6aaf7697855aeb2edb4f6eaaa984b0be402397cde1f3a75ab20b4948ef6f9024927ff0baae49a5cb3bb037d917efafd8334b +DIST chromium-72.0.3626.121.tar.xz 686420260 BLAKE2B a605ba62b2d568df926beba0c4336f2bd844feae2e15def3f434871124fc1fc3f59dd2423cb2adcdeb30fad156a27a8a260818e29829cd71e79361bc7fbd9329 SHA512 0bbeba7fa662d92ad60fdb56b3a73b79fc40ecb1499bb3b9a50b78ab7900b7a4de83f271c1c299e386dc9f72bfb2cbf71f83a388c6e14e288ab42b2b673fce96 +DIST chromium-72.0.3626.122.tar.xz 686442684 BLAKE2B 02ee59aea18c0f08cb60e70e27a7900a47df4017740d2294a8622f694ec39f851c5ee5e7a6ee30e8735a64324e3f731cd8beb464e3738d92a976c9e2e5789fae SHA512 0e2bd5ac5ef90ceaf5cef79051e6bd18e75cf795b9b8d5baef58919234ff90fc2583afc8c5857aa392268d075d54beea649d581a9e2ac7717d50497cadbc7348 +DIST chromium-webrtc-includes-r1.patch.xz 57820 BLAKE2B 8e113680254b4834abda72c335a8f0af7211c5982c91e52372945f9a57c5558bd6772300ffefb475b450c40ffe66cd627aba34d33af101fe402815c2a16fe6c8 SHA512 cd4562ec32a044925afc65d9cba62310acc515db7cab0ee3aa0f3afe11672b3e7046ca937d8739c4feca436af7d9cf0f7860716a397c8aa5d5ae647b5eaf1ac0 +DIST ungoogled-chromium-72.0.3626.109-1.tar.gz 704936 BLAKE2B e6b0e8a1c3c51d1d9545f290d5a478befcec5149468868cf50820b89727aaea2195f1acb8951fabb8d4a14a57b0119846a349437c1bdcdefd303004a8d907d16 SHA512 ec87aa39aa37576885d4d893f3d23b243caca3e2cc1c9372bf441a882d1e66323ff6f19eab778658f81ef9bac4434509189f1500e43c4b6bbaead720f69eb207 +DIST ungoogled-chromium-72.0.3626.122-1.tar.gz 705572 BLAKE2B 29d842d7a6222a80c48d80ba4c66f92ac9c4068c1c01510d2e0f59ec99df1a9b7226b8c799443426136fa63706b08f17de58bce5844097d79617851c2221ffb2 SHA512 e5192da9d66e26ae8440afa3e386288920e67cbddc8343f740ccdbdd809f7403cf288bebc7c7fc710a940daf64e8079637b9e6e858128b4db0fef9bfb25cc0c8 +EBUILD ungoogled-chromium-72.0.3626.121_pre.ebuild 24874 BLAKE2B 9fd62ec2f6412dbcf8073746968b691515220db8fe2182e2a9104e0c28d4174437565655524171ba335c7f54ad276e11f0df76e393f07841627209a6bf748a7a SHA512 903f8580a13099f730e10454ea5902d314237ec6036efb9daf09a668cc86d549e913d7451fbbf4e4828d1eb3169be072f868da4601a98233fc48d2dbab1e608c +EBUILD ungoogled-chromium-72.0.3626.122_p1.ebuild 24867 BLAKE2B b8c4d319ba70526bc3d45916ec5f757750d05e1879a5e6b46b1e4e2a0da1c8aed71e8ff37e2e4795d25fbc3ce707244cf38f6903eb40dd89238a3f9619ad73bd SHA512 a62a3c0b866c949a2c4a7946a1fc01dfa80e5496de20e76babd5489930d317571512b8632da8848e5024934b07fd5d9ed7e1f13508ba50f739162a997b243b07 diff --git a/www-client/ungoogled-chromium/files/chromium-browser.xml b/www-client/ungoogled-chromium/files/chromium-browser.xml new file mode 100644 index 0000000..2c95a55 --- /dev/null +++ b/www-client/ungoogled-chromium/files/chromium-browser.xml @@ -0,0 +1,13 @@ + + + + + + Chromium + chromium-browser + chromium-browser %s + chromium-browser + false + + + diff --git a/www-client/ungoogled-chromium/files/ungoogled-chromium-compiler-r5.patch b/www-client/ungoogled-chromium/files/ungoogled-chromium-compiler-r5.patch new file mode 100644 index 0000000..cd7af4d --- /dev/null +++ b/www-client/ungoogled-chromium/files/ungoogled-chromium-compiler-r5.patch @@ -0,0 +1,54 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -236,7 +236,6 @@ config("compiler") { + + configs += [ + # See the definitions below. +- ":clang_revision", + ":compiler_cpu_abi", + ":compiler_codegen", + ] +@@ -765,7 +764,6 @@ config("compiler_cpu_abi") { + if (current_cpu == "x64") { + cflags += [ + "-m64", +- "-march=x86-64", + ] + ldflags += [ "-m64" ] + } else if (current_cpu == "x86") { +@@ -1959,7 +1957,7 @@ config("optimize") { + cflags = [ "-Os" ] + common_optimize_on_cflags + } + } else { +- cflags = [ "-O2" ] + common_optimize_on_cflags ++ cflags = common_optimize_on_cflags + } + ldflags = common_optimize_on_ldflags + } +@@ -1982,7 +1980,7 @@ config("optimize_no_wpo") { + } else if (optimize_for_fuzzing) { + cflags = [ "-O1" ] + common_optimize_on_cflags + } else { +- cflags = [ "-O2" ] + common_optimize_on_cflags ++ cflags = common_optimize_on_cflags + } + ldflags = common_optimize_on_ldflags + } +@@ -2047,7 +2045,7 @@ config("optimize_max") { + } else if (optimize_for_fuzzing) { + cflags = [ "-O1" ] + common_optimize_on_cflags + } else { +- cflags = [ "-O2" ] + common_optimize_on_cflags ++ cflags = common_optimize_on_cflags + } + } + } +@@ -2092,7 +2090,7 @@ config("optimize_speed") { + } else if (optimize_for_fuzzing) { + cflags = [ "-O1" ] + common_optimize_on_cflags + } else { +- cflags = [ "-O3" ] + common_optimize_on_cflags ++ cflags = common_optimize_on_cflags + } + } + } diff --git a/www-client/ungoogled-chromium/files/ungoogled-chromium-gold-r2.patch b/www-client/ungoogled-chromium/files/ungoogled-chromium-gold-r2.patch new file mode 100644 index 0000000..db1e2a5 --- /dev/null +++ b/www-client/ungoogled-chromium/files/ungoogled-chromium-gold-r2.patch @@ -0,0 +1,60 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -432,7 +432,7 @@ config("compiler") { + # On Android, this isn't needed. gcc in the NDK knows to look next to + # it with -fuse-ld=gold, and clang gets a --gcc-toolchain flag passed + # above. +- ldflags += [ "-B$gold_path" ] ++ #ldflags += [ "-B$gold_path" ] + + if (linux_use_bundled_binutils) { + ldflags += [ +@@ -635,8 +635,8 @@ config("compiler") { + (current_toolchain == default_toolchain || + (is_android && defined(android_secondary_abi_toolchain) && + current_toolchain == android_secondary_abi_toolchain))) { +- assert(use_lld || target_os == "chromeos", +- "gold plugin only supported with ChromeOS") ++ #assert(use_lld || target_os == "chromeos", ++ #"gold plugin only supported with ChromeOS") + + cflags += [ "-flto=thin" ] + +@@ -660,25 +660,24 @@ config("compiler") { + # Limit the parallelism to avoid too aggressive competition between + # linker jobs. This is still suboptimal to a potential dynamic + # resource allocation scheme, but should be good enough. +- if (use_lld) { +- ldflags += [ +- "-Wl,--thinlto-jobs=8", +- ] +- +- # Disable caching on Chrome OS temporarily (crbug.com/889967) +- if (!is_chromeos) { +- # Limit the size of the ThinLTO cache to the lesser of 10% of +- # available disk space, 10GB and 100000 files. +- cache_policy = +- "cache_size=10%:cache_size_bytes=10g:cache_size_files=100000" ++ if (use_lld || use_gold) { ++ # Limit the size of the ThinLTO cache to the lesser of 10% of ++ # available disk space, 10GB and 100000 files. ++ cache_policy = ++ "cache_size=10%:cache_size_bytes=10g:cache_size_files=100000" ++ if (use_lld) { + ldflags += [ + "-Wl,--thinlto-cache-dir=" + + rebase_path("$root_out_dir/thinlto-cache", root_build_dir), + "-Wl,--thinlto-cache-policy,$cache_policy", + ] ++ } else { ++ ldflags += [ ++ "-Wl,-plugin-opt,cache-dir=" + ++ rebase_path("$root_out_dir/thinlto-cache", root_build_dir), ++ "-Wl,-plugin-opt,cache-policy=$cache_policy", ++ ] + } +- } else { +- ldflags += [ "-Wl,-plugin-opt,jobs=8" ] + } + + if (use_lld) { diff --git a/www-client/ungoogled-chromium/files/ungoogled-chromium-launcher-r3.sh b/www-client/ungoogled-chromium/files/ungoogled-chromium-launcher-r3.sh new file mode 100644 index 0000000..9bc3d91 --- /dev/null +++ b/www-client/ungoogled-chromium/files/ungoogled-chromium-launcher-r3.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Allow the user to override command-line flags, bug #357629. +# This is based on Debian's chromium-browser package, and is intended +# to be consistent with Debian. +for f in /etc/chromium/*; do + [[ -f ${f} ]] && source "${f}" +done + +# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system +# default CHROMIUM_FLAGS (from /etc/chromium/default). +CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"} + +# Let the wrapped binary know that it has been run through the wrapper +export CHROME_WRAPPER=$(readlink -f "$0") + +PROGDIR=${CHROME_WRAPPER%/*} + +case ":$PATH:" in + *:$PROGDIR:*) + # $PATH already contains $PROGDIR + ;; + *) + # Append $PROGDIR to $PATH + export PATH="$PATH:$PROGDIR" + ;; +esac + +if [[ ${EUID} == 0 && -O ${XDG_CONFIG_HOME:-${HOME}} ]]; then + # Running as root with HOME owned by root. + # Pass --user-data-dir to work around upstream failsafe. + CHROMIUM_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/chromium + ${CHROMIUM_FLAGS}" +fi + +# Set the .desktop file name +export CHROME_DESKTOP="chromium-browser-ungoogled-chromium.desktop" + +exec -a "chromium-browser" "$PROGDIR/chrome" --extra-plugin-dir=/usr/lib/nsbrowser/plugins ${CHROMIUM_FLAGS} "$@" diff --git a/www-client/ungoogled-chromium/files/ungoogled-chromium-libusb-interrupt-event-handler-r0.patch b/www-client/ungoogled-chromium/files/ungoogled-chromium-libusb-interrupt-event-handler-r0.patch new file mode 100644 index 0000000..d0b2484 --- /dev/null +++ b/www-client/ungoogled-chromium/files/ungoogled-chromium-libusb-interrupt-event-handler-r0.patch @@ -0,0 +1,15 @@ +diff -up chromium-48.0.2564.116/device/usb/usb_context.cc.modern-libusbx chromium-48.0.2564.116/device/usb/usb_context.cc +--- chromium-48.0.2564.116/device/usb/usb_context.cc.modern-libusbx 2016-02-24 10:21:10.534996028 -0500 ++++ chromium-48.0.2564.116/device/usb/usb_context.cc 2016-02-24 10:22:28.270499864 -0500 +@@ -57,7 +57,11 @@ void UsbContext::UsbEventHandler::Run() + + void UsbContext::UsbEventHandler::Stop() { + base::subtle::Release_Store(&running_, 0); ++#ifdef LIBUSB_API_VERSION >= 0x01000105 ++ libusb_interrupt_event_handler(context_); ++#else + libusb_interrupt_handle_event(context_); ++#endif + } + + UsbContext::UsbContext(PlatformUsbContext context) : context_(context) { diff --git a/www-client/ungoogled-chromium/files/ungoogled-chromium-system-libusb-r0.patch b/www-client/ungoogled-chromium/files/ungoogled-chromium-system-libusb-r0.patch new file mode 100644 index 0000000..cf8b994 --- /dev/null +++ b/www-client/ungoogled-chromium/files/ungoogled-chromium-system-libusb-r0.patch @@ -0,0 +1,41 @@ +Index: chromium-70.0.3538.54/build/linux/unbundle/libusb.gn +=================================================================== +--- /dev/null ++++ chromium-70.0.3538.54/build/linux/unbundle/libusb.gn +@@ -0,0 +1,24 @@ ++# Copyright 2016 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. ++ ++import("//build/config/linux/pkg_config.gni") ++import("//build/shim_headers.gni") ++ ++pkg_config("system_libusb") { ++ packages = [ "libusb-1.0" ] ++} ++ ++shim_headers("libusb_shim") { ++ root_path = "src/libusb" ++ headers = [ ++ "libusb.h", ++ ] ++} ++ ++source_set("libusb") { ++ deps = [ ++ ":libusb_shim", ++ ] ++ public_configs = [ ":system_libusb" ] ++} +Index: chromium-70.0.3538.54/build/linux/unbundle/replace_gn_files.py +=================================================================== +--- chromium-70.0.3538.54.orig/build/linux/unbundle/replace_gn_files.py ++++ chromium-70.0.3538.54/build/linux/unbundle/replace_gn_files.py +@@ -27,6 +27,7 @@ REPLACEMENTS = { + 'libevent': 'base/third_party/libevent/BUILD.gn', + 'libjpeg': 'third_party/libjpeg.gni', + 'libpng': 'third_party/libpng/BUILD.gn', ++ 'libusb': 'third_party/libusb/BUILD.gn', + 'libvpx': 'third_party/libvpx/BUILD.gn', + 'libwebp': 'third_party/libwebp/BUILD.gn', + 'libxml': 'third_party/libxml/BUILD.gn', diff --git a/www-client/ungoogled-chromium/files/ungoogled-chromium.default b/www-client/ungoogled-chromium/files/ungoogled-chromium.default new file mode 100644 index 0000000..32a1d58 --- /dev/null +++ b/www-client/ungoogled-chromium/files/ungoogled-chromium.default @@ -0,0 +1,10 @@ +# Default settings for ungoogled-chromium. This file is sourced by /bin/bash +# from the chromium launcher. + +# Uncomment this to spoof timezone to UTC +#export TZ='Etc/UTC' + +# Options to pass to ungoogled-chromium. +# See https://github.com/Eloston/ungoogled-chromium#features for additional +# command-line switches. +#CHROMIUM_FLAGS="" diff --git a/www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.121_pre.ebuild b/www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.121_pre.ebuild new file mode 100644 index 0000000..99c94e4 --- /dev/null +++ b/www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.121_pre.ebuild @@ -0,0 +1,834 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python{2_7,3_{5,6,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 desktop flag-o-matic ninja-utils pax-utils python-r1 readme.gentoo-r1 toolchain-funcs xdg-utils + +UGC_PV="${PV/21_pre/09-1}" +UGC_P="${PN}-${UGC_PV}" +UGC_WD="${WORKDIR}/${UGC_P}" + +DESCRIPTION="Modifications to Chromium for removing Google integration and enhancing privacy" +HOMEPAGE="https://www.chromium.org/Home https://github.com/Eloston/ungoogled-chromium" +SRC_URI=" + https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${PV/_*}.tar.xz + https://github.com/Eloston/${PN}/archive/${UGC_PV}.tar.gz -> ${UGC_P}.tar.gz + https://dev.gentoo.org/~floppym/dist/chromium-webrtc-includes-r1.patch.xz +" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE=" + +cfi closure-compile cups custom-cflags gnome gold jumbo-build kerberos libcxx + +lld new-tcmalloc optimize-thinlto optimize-webui +pdf +proprietary-codecs + pulseaudio selinux +suid +system-ffmpeg system-harfbuzz +system-icu + +system-jsoncpp +system-libevent +system-libvpx +system-openh264 + +system-openjpeg +tcmalloc +thinlto vaapi widevine +" +REQUIRED_USE=" + ^^ ( gold lld ) + || ( $(python_gen_useflags 'python3*') ) + || ( $(python_gen_useflags 'python2*') ) + cfi? ( thinlto ) + libcxx? ( new-tcmalloc ) + new-tcmalloc? ( tcmalloc ) + optimize-thinlto? ( thinlto ) + system-openjpeg? ( pdf ) + x86? ( !lld !thinlto !widevine ) +" +RESTRICT=" + !system-ffmpeg? ( proprietary-codecs? ( bindist ) ) + !system-openh264? ( bindist ) +" + +CDEPEND=" + >=app-accessibility/at-spi2-atk-2.26:2 + app-arch/snappy:= + >=dev-libs/atk-2.26 + dev-libs/expat:= + dev-libs/glib:2 + >=dev-libs/libxml2-2.9.4-r3:=[icu] + dev-libs/libxslt:= + dev-libs/nspr:= + >=dev-libs/nss-3.26:= + >=dev-libs/re2-0.2018.10.01:= + >=media-libs/alsa-lib-1.0.19:= + media-libs/flac:= + media-libs/fontconfig:= + media-libs/libjpeg-turbo:= + media-libs/libpng:= + >=media-libs/libwebp-0.4.0:= + sys-apps/dbus:= + sys-apps/pciutils:= + sys-libs/zlib:=[minizip] + 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:= + closure-compile? ( virtual/jre:* ) + cups? ( >=net-print/cups-1.3.11:= ) + kerberos? ( virtual/krb5 ) + pdf? ( media-libs/lcms:= ) + pulseaudio? ( media-sound/pulseaudio:= ) + system-ffmpeg? ( + >=media-video/ffmpeg-3.4.5:= + || ( + media-video/ffmpeg[-samba] + >=net-fs/samba-4.5.16[-debug(-)] + ) + media-libs/opus:= + ) + system-harfbuzz? ( + media-libs/freetype:= + >=media-libs/harfbuzz-2.0.0:0=[icu(-)] + ) + system-icu? ( >=dev-libs/icu-58.2:= ) + system-jsoncpp? ( dev-libs/jsoncpp ) + system-libevent? ( dev-libs/libevent ) + system-libvpx? ( >=media-libs/libvpx-1.7.0:=[postproc,svc] ) + system-openh264? ( >=media-libs/openh264-1.6.0:= ) + system-openjpeg? ( media-libs/openjpeg:2= ) + vaapi? ( x11-libs/libva:= ) +" +RDEPEND="${CDEPEND} + virtual/opengl + virtual/ttf-fonts + x11-misc/xdg-utils + selinux? ( sec-policy/selinux-chromium ) + widevine? ( !x86? ( www-plugins/chrome-binary-plugins[widevine(-)] ) ) + !www-client/chromium + !www-client/ungoogled-chromium-bin +" +# dev-vcs/git (Bug #593476) +# sys-apps/sandbox - https://crbug.com/586444 +DEPEND="${CDEPEND}" +BDEPEND=" + app-arch/bzip2:= + >=app-arch/gzip-1.7 + dev-lang/perl + dev-lang/yasm + dev-util/gn + >=dev-util/gperf-3.0.3 + >=dev-util/ninja-1.7.2 + dev-vcs/git + sys-apps/hwids[usb(+)] + >=sys-devel/bison-2.4.3 + >=sys-devel/clang-7.0.0 + sys-devel/flex + >=sys-devel/llvm-7.0.0[gold?] + virtual/libusb:1 + virtual/pkgconfig + cfi? ( >=sys-devel/clang-runtime-7.0.0[sanitize] ) + libcxx? ( + sys-libs/libcxx + sys-libs/libcxxabi + ) + lld? ( >=sys-devel/lld-7.0.0 ) + optimize-webui? ( >=net-libs/nodejs-7.6.0[inspector] ) +" + +# shellcheck disable=SC2086 +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/noto-emoji +- 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}/${PN}-compiler-r5.patch" + "${FILESDIR}/${PN}-gold-r2.patch" + # Extra patches taken from openSUSE + "${FILESDIR}/${PN}-libusb-interrupt-event-handler-r0.patch" + "${FILESDIR}/${PN}-system-libusb-r0.patch" +) + +S="${WORKDIR}/chromium-${PV/_*}" + +pre_build_checks() { + # Check build requirements (Bug #541816) + CHECKREQS_MEMORY="3G" + CHECKREQS_DISK_BUILD="5G" + if use custom-cflags && ( shopt -s extglob; is-flagq '-g?(gdb)?([1-9])' ); then + CHECKREQS_DISK_BUILD="25G" + fi + check-reqs_pkg_setup +} + +pkg_pretend() { + if use custom-cflags && [[ "${MERGE_TYPE}" != binary ]]; then + ewarn + ewarn "USE=custom-cflags bypass strip-flags; you are on your own." + ewarn "Expect build failures. Don't file bugs using that unsupported USE flag!" + ewarn + fi + 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 'python3*' + + default + + pushd third_party/webrtc >/dev/null || die + eapply "${WORKDIR}"/chromium-webrtc-includes-r1.patch + popd >/dev/null || die + + if use optimize-webui; then + 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 + fi + + # Hack for libusb stuff (taken from openSUSE) + rm third_party/libusb/src/libusb/libusb.h || die + cp -a "${EPREFIX}/usr/include/libusb-1.0/libusb.h" \ + third_party/libusb/src/libusb/libusb.h || die + + # From here we adapt ungoogled-chromium's patches to our needs + local ugc_cli="${UGC_WD}/run_buildkit_cli.py" + local ugc_config="${UGC_WD}/config_bundles/linux_rooted" + local ugc_common_dir="${UGC_WD}/config_bundles/common" + local ugc_rooted_dir="${UGC_WD}/config_bundles/linux_rooted" + + local ugc_unneeded=( + # ARM related patches + common:crashpad + common:gcc_skcms_ice + common:skia-aarch64-buildfix + # GCC specific fixes/warnings + common:alignof + common:as-needed + common:enum-compare + common:explicit-constructor + common:initialization + common:int-in-bool-context + common:member-assignment + common:multichar + common:null-destination + common:printf + rooted:attribute + # GN bootstrap + common:parallel + rooted:libcxx + ) + + local ugc_use=( + system-icu:convertutf + system-icu:icu + system-jsoncpp:jsoncpp + system-libevent:event + system-libvpx:vpx + vaapi:enable-vaapi + vaapi:chromium-vaapi-relax-the-version-check-for-VA-API + vaapi:chromium-enable-mojo-video-decoders-by-default + vaapi:chromium-vaapi-fix-the-VA_CHECK_VERSION + ) + + local ugc_p ugc_dir + for p in "${ugc_unneeded[@]}"; do + ugc_p="${p#*:}" + ugc_dir="ugc_${p%:*}_dir" + einfo "Removing ${ugc_p}.patch" + sed -i "/${ugc_p}.patch/d" "${!ugc_dir}/patch_order.list" || die + done + + for p in "${ugc_use[@]}"; do + if ! use "${p%:*}"; then + ugc_p="${p#*:}" + einfo "Removing ${ugc_p}.patch" + sed -i "/${ugc_p}.patch/d" "${ugc_rooted_dir}/patch_order.list" || die + fi + done + + if use system-ffmpeg && has_version ' /dev/null || die + chromium_remove_language_paks + popd > /dev/null || die + + insinto "${CHROMIUM_HOME}" + doins out/Release/*.bin + doins out/Release/*.pak + doins out/Release/*.so + + use system-icu || doins out/Release/icudtl.dat + + doins -r out/Release/locales + doins -r out/Release/resources + + # 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 -i "/^Exec/s/$/ %U/" "${ED}"/usr/share/applications/*.desktop || die + + # Install GNOME default application entry (Bug #303100) + insinto /usr/share/gnome-control-center/default-apps + doins "${FILESDIR}/chromium-browser.xml" + + readme.gentoo_create_doc +} + +usetf() { + usex "$1" true false +} + +update_caches() { + if type gtk-update-icon-cache &>/dev/null; then + ebegin "Updating GTK icon cache" + gtk-update-icon-cache "${EROOT}/usr/share/icons/hicolor" + eend $? || die + fi + xdg_desktop_database_update +} + +pkg_postrm() { + update_caches +} + +pkg_postinst() { + update_caches + readme.gentoo_print_elog +} diff --git a/www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.122_p1.ebuild b/www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.122_p1.ebuild new file mode 100644 index 0000000..073490b --- /dev/null +++ b/www-client/ungoogled-chromium/ungoogled-chromium-72.0.3626.122_p1.ebuild @@ -0,0 +1,834 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python{2_7,3_{5,6,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 desktop flag-o-matic ninja-utils pax-utils python-r1 readme.gentoo-r1 toolchain-funcs xdg-utils + +UGC_PV="${PV/_p/-}" +UGC_P="${PN}-${UGC_PV}" +UGC_WD="${WORKDIR}/${UGC_P}" + +DESCRIPTION="Modifications to Chromium for removing Google integration and enhancing privacy" +HOMEPAGE="https://www.chromium.org/Home https://github.com/Eloston/ungoogled-chromium" +SRC_URI=" + https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${PV/_*}.tar.xz + https://github.com/Eloston/${PN}/archive/${UGC_PV}.tar.gz -> ${UGC_P}.tar.gz + https://dev.gentoo.org/~floppym/dist/chromium-webrtc-includes-r1.patch.xz +" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE=" + +cfi closure-compile cups custom-cflags gnome gold jumbo-build kerberos libcxx + +lld new-tcmalloc optimize-thinlto optimize-webui +pdf +proprietary-codecs + pulseaudio selinux +suid +system-ffmpeg system-harfbuzz +system-icu + +system-jsoncpp +system-libevent +system-libvpx +system-openh264 + +system-openjpeg +tcmalloc +thinlto vaapi widevine +" +REQUIRED_USE=" + ^^ ( gold lld ) + || ( $(python_gen_useflags 'python3*') ) + || ( $(python_gen_useflags 'python2*') ) + cfi? ( thinlto ) + libcxx? ( new-tcmalloc ) + new-tcmalloc? ( tcmalloc ) + optimize-thinlto? ( thinlto ) + system-openjpeg? ( pdf ) + x86? ( !lld !thinlto !widevine ) +" +RESTRICT=" + !system-ffmpeg? ( proprietary-codecs? ( bindist ) ) + !system-openh264? ( bindist ) +" + +CDEPEND=" + >=app-accessibility/at-spi2-atk-2.26:2 + app-arch/snappy:= + >=dev-libs/atk-2.26 + dev-libs/expat:= + dev-libs/glib:2 + >=dev-libs/libxml2-2.9.4-r3:=[icu] + dev-libs/libxslt:= + dev-libs/nspr:= + >=dev-libs/nss-3.26:= + >=dev-libs/re2-0.2018.10.01:= + >=media-libs/alsa-lib-1.0.19:= + media-libs/flac:= + media-libs/fontconfig:= + media-libs/libjpeg-turbo:= + media-libs/libpng:= + >=media-libs/libwebp-0.4.0:= + sys-apps/dbus:= + sys-apps/pciutils:= + sys-libs/zlib:=[minizip] + 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:= + closure-compile? ( virtual/jre:* ) + cups? ( >=net-print/cups-1.3.11:= ) + kerberos? ( virtual/krb5 ) + pdf? ( media-libs/lcms:= ) + pulseaudio? ( media-sound/pulseaudio:= ) + system-ffmpeg? ( + >=media-video/ffmpeg-3.4.5:= + || ( + media-video/ffmpeg[-samba] + >=net-fs/samba-4.5.16[-debug(-)] + ) + media-libs/opus:= + ) + system-harfbuzz? ( + media-libs/freetype:= + >=media-libs/harfbuzz-2.0.0:0=[icu(-)] + ) + system-icu? ( >=dev-libs/icu-58.2:= ) + system-jsoncpp? ( dev-libs/jsoncpp ) + system-libevent? ( dev-libs/libevent ) + system-libvpx? ( >=media-libs/libvpx-1.7.0:=[postproc,svc] ) + system-openh264? ( >=media-libs/openh264-1.6.0:= ) + system-openjpeg? ( media-libs/openjpeg:2= ) + vaapi? ( x11-libs/libva:= ) +" +RDEPEND="${CDEPEND} + virtual/opengl + virtual/ttf-fonts + x11-misc/xdg-utils + selinux? ( sec-policy/selinux-chromium ) + widevine? ( !x86? ( www-plugins/chrome-binary-plugins[widevine(-)] ) ) + !www-client/chromium + !www-client/ungoogled-chromium-bin +" +# dev-vcs/git (Bug #593476) +# sys-apps/sandbox - https://crbug.com/586444 +DEPEND="${CDEPEND}" +BDEPEND=" + app-arch/bzip2:= + >=app-arch/gzip-1.7 + dev-lang/perl + dev-lang/yasm + dev-util/gn + >=dev-util/gperf-3.0.3 + >=dev-util/ninja-1.7.2 + dev-vcs/git + sys-apps/hwids[usb(+)] + >=sys-devel/bison-2.4.3 + >=sys-devel/clang-7.0.0 + sys-devel/flex + >=sys-devel/llvm-7.0.0[gold?] + virtual/libusb:1 + virtual/pkgconfig + cfi? ( >=sys-devel/clang-runtime-7.0.0[sanitize] ) + libcxx? ( + sys-libs/libcxx + sys-libs/libcxxabi + ) + lld? ( >=sys-devel/lld-7.0.0 ) + optimize-webui? ( >=net-libs/nodejs-7.6.0[inspector] ) +" + +# shellcheck disable=SC2086 +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/noto-emoji +- 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}/${PN}-compiler-r5.patch" + "${FILESDIR}/${PN}-gold-r2.patch" + # Extra patches taken from openSUSE + "${FILESDIR}/${PN}-libusb-interrupt-event-handler-r0.patch" + "${FILESDIR}/${PN}-system-libusb-r0.patch" +) + +S="${WORKDIR}/chromium-${PV/_*}" + +pre_build_checks() { + # Check build requirements (Bug #541816) + CHECKREQS_MEMORY="3G" + CHECKREQS_DISK_BUILD="5G" + if use custom-cflags && ( shopt -s extglob; is-flagq '-g?(gdb)?([1-9])' ); then + CHECKREQS_DISK_BUILD="25G" + fi + check-reqs_pkg_setup +} + +pkg_pretend() { + if use custom-cflags && [[ "${MERGE_TYPE}" != binary ]]; then + ewarn + ewarn "USE=custom-cflags bypass strip-flags; you are on your own." + ewarn "Expect build failures. Don't file bugs using that unsupported USE flag!" + ewarn + fi + 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 'python3*' + + default + + pushd third_party/webrtc >/dev/null || die + eapply "${WORKDIR}"/chromium-webrtc-includes-r1.patch + popd >/dev/null || die + + if use optimize-webui; then + 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 + fi + + # Hack for libusb stuff (taken from openSUSE) + rm third_party/libusb/src/libusb/libusb.h || die + cp -a "${EPREFIX}/usr/include/libusb-1.0/libusb.h" \ + third_party/libusb/src/libusb/libusb.h || die + + # From here we adapt ungoogled-chromium's patches to our needs + local ugc_cli="${UGC_WD}/run_buildkit_cli.py" + local ugc_config="${UGC_WD}/config_bundles/linux_rooted" + local ugc_common_dir="${UGC_WD}/config_bundles/common" + local ugc_rooted_dir="${UGC_WD}/config_bundles/linux_rooted" + + local ugc_unneeded=( + # ARM related patches + common:crashpad + common:gcc_skcms_ice + common:skia-aarch64-buildfix + # GCC specific fixes/warnings + common:alignof + common:as-needed + common:enum-compare + common:explicit-constructor + common:initialization + common:int-in-bool-context + common:member-assignment + common:multichar + common:null-destination + common:printf + rooted:attribute + # GN bootstrap + common:parallel + rooted:libcxx + ) + + local ugc_use=( + system-icu:convertutf + system-icu:icu + system-jsoncpp:jsoncpp + system-libevent:event + system-libvpx:vpx + vaapi:enable-vaapi + vaapi:chromium-vaapi-relax-the-version-check-for-VA-API + vaapi:chromium-enable-mojo-video-decoders-by-default + vaapi:chromium-vaapi-fix-the-VA_CHECK_VERSION + ) + + local ugc_p ugc_dir + for p in "${ugc_unneeded[@]}"; do + ugc_p="${p#*:}" + ugc_dir="ugc_${p%:*}_dir" + einfo "Removing ${ugc_p}.patch" + sed -i "/${ugc_p}.patch/d" "${!ugc_dir}/patch_order.list" || die + done + + for p in "${ugc_use[@]}"; do + if ! use "${p%:*}"; then + ugc_p="${p#*:}" + einfo "Removing ${ugc_p}.patch" + sed -i "/${ugc_p}.patch/d" "${ugc_rooted_dir}/patch_order.list" || die + fi + done + + if use system-ffmpeg && has_version ' /dev/null || die + chromium_remove_language_paks + popd > /dev/null || die + + insinto "${CHROMIUM_HOME}" + doins out/Release/*.bin + doins out/Release/*.pak + doins out/Release/*.so + + use system-icu || doins out/Release/icudtl.dat + + doins -r out/Release/locales + doins -r out/Release/resources + + # 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 -i "/^Exec/s/$/ %U/" "${ED}"/usr/share/applications/*.desktop || die + + # Install GNOME default application entry (Bug #303100) + insinto /usr/share/gnome-control-center/default-apps + doins "${FILESDIR}/chromium-browser.xml" + + readme.gentoo_create_doc +} + +usetf() { + usex "$1" true false +} + +update_caches() { + if type gtk-update-icon-cache &>/dev/null; then + ebegin "Updating GTK icon cache" + gtk-update-icon-cache "${EROOT}/usr/share/icons/hicolor" + eend $? || die + fi + xdg_desktop_database_update +} + +pkg_postrm() { + update_caches +} + +pkg_postinst() { + update_caches + readme.gentoo_print_elog +}