Added ungoogled-chromium

This commit is contained in:
Suwako Moriya 2019-04-20 23:19:31 +02:00
parent df696c21d3
commit 7afc35b5a7
15 changed files with 2166 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE default-apps SYSTEM "gnome-da-list.dtd">
<default-apps>
<web-browsers>
<web-browser>
<name>Chromium</name>
<executable>chromium-browser</executable>
<command>chromium-browser %s</command>
<icon-name>chromium-browser</icon-name>
<run-in-terminal>false</run-in-terminal>
</web-browser>
</web-browsers>
</default-apps>

View File

@ -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} "$@"

View File

@ -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=""

View File

@ -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
}

View File

@ -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

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE default-apps SYSTEM "gnome-da-list.dtd">
<default-apps>
<web-browsers>
<web-browser>
<name>Chromium</name>
<executable>chromium-browser</executable>
<command>chromium-browser %s</command>
<icon-name>chromium-browser</icon-name>
<run-in-terminal>false</run-in-terminal>
</web-browser>
</web-browsers>
</default-apps>

View File

@ -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
}
}
}

View File

@ -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) {

View File

@ -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} "$@"

View File

@ -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) {

View File

@ -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',

View File

@ -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=""

View File

@ -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 '<media-video/ffmpeg-4.0.0'; then
sed -i '/jpeg.patch/i debian_buster/system/ffmpeg34.patch' \
"${ugc_rooted_dir}/patch_order.list" || die
fi
if ! use system-icu; then
sed -i '/icudtl.dat/d' "${ugc_rooted_dir}/pruning.list" || die
fi
if use system-openjpeg; then
sed -i '/jpeg.patch/a debian_buster/system/openjpeg.patch' \
"${ugc_rooted_dir}/patch_order.list" || die
fi
if use vaapi && has_version '<x11-libs/libva-2.0.0'; then
sed -i "/build.patch/i ${PN}/linux/fix-libva1-compatibility.patch" \
"${ugc_rooted_dir}/patch_order.list" || die
fi
ebegin "Pruning binaries"
"${ugc_cli}" prune -b "${ugc_config}" ./
eend $? || die
ebegin "Applying ungoogled-chromium patches"
"${ugc_cli}" patches apply -b "${ugc_config}" ./
eend $? || die
ebegin "Applying domain substitution"
"${ugc_cli}" domains apply -b "${ugc_config}" -c domainsubcache.tar.gz ./
eend $? || die
local keeplibs=(
base/third_party/dmg_fp
base/third_party/dynamic_annotations
base/third_party/icu
base/third_party/superfasthash
base/third_party/symbolize
base/third_party/valgrind
base/third_party/xdg_mime
base/third_party/xdg_user_dirs
chrome/third_party/mozilla_security_manager
courgette/third_party
net/third_party/http2
net/third_party/mozilla_security_manager
net/third_party/nss
net/third_party/quic
net/third_party/spdy
net/third_party/uri_template
third_party/abseil-cpp
third_party/adobe
third_party/angle
third_party/angle/src/common/third_party/base
third_party/angle/src/common/third_party/smhasher
third_party/angle/src/common/third_party/xxhash
third_party/angle/src/third_party/compiler
third_party/angle/src/third_party/libXNVCtrl
third_party/angle/src/third_party/trace_event
third_party/angle/third_party/glslang
third_party/angle/third_party/spirv-headers
third_party/angle/third_party/spirv-tools
third_party/angle/third_party/vulkan-headers
third_party/angle/third_party/vulkan-loader
third_party/angle/third_party/vulkan-tools
third_party/angle/third_party/vulkan-validation-layers
third_party/apple_apsl
third_party/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/beautifulsoup4
third_party/catapult/third_party/html5lib-python
third_party/catapult/third_party/polymer
third_party/catapult/third_party/six
third_party/catapult/tracing/third_party/d3
third_party/catapult/tracing/third_party/gl-matrix
third_party/catapult/tracing/third_party/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/crashpad
third_party/crashpad/crashpad/third_party/zlib
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/glslang
third_party/google_input_tools
third_party/google_input_tools/third_party/closure_library
third_party/google_input_tools/third_party/closure_library/third_party/closure
third_party/googletest
third_party/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/vector
third_party/libaom/source/libaom/third_party/x86inc
third_party/libjingle
third_party/libphonenumber
third_party/libsecret
third_party/libsrtp
third_party/libsync
third_party/libudev
third_party/libusb
third_party/libwebm
third_party/libxml/chromium
third_party/libyuv
third_party/lss
third_party/markupsafe
third_party/mesa
third_party/metrics_proto
third_party/modp_b64
third_party/nasm
third_party/openmax_dl
third_party/ots
third_party/ply
third_party/polymer
third_party/protobuf
third_party/protobuf/third_party/six
third_party/pyjson5
third_party/qcms
third_party/rnnoise
third_party/s2cellid
third_party/sfntly
third_party/simplejson
third_party/skia
third_party/skia/third_party/gif
third_party/skia/third_party/skcms
third_party/skia/third_party/vulkan
third_party/smhasher
third_party/speech-dispatcher
third_party/spirv-headers
third_party/SPIRV-Tools
third_party/sqlite
third_party/ungoogled
third_party/usb_ids
third_party/usrsctp
third_party/vulkan
third_party/web-animations-js
third_party/webdriver
third_party/webrtc
third_party/webrtc/common_audio/third_party/fft4g
third_party/webrtc/common_audio/third_party/spl_sqrt_floor
third_party/webrtc/modules/third_party/fft
third_party/webrtc/modules/third_party/g711
third_party/webrtc/modules/third_party/g722
third_party/webrtc/rtc_base/third_party/base64
third_party/webrtc/rtc_base/third_party/sigslot
third_party/widevine
third_party/woff2
third_party/xdg-utils
third_party/yasm/run_yasm.py
third_party/zlib/google
url/third_party/mozilla
v8/src/third_party/valgrind
v8/src/third_party/utf8-decoder
v8/third_party/v8
)
use closure-compile && keeplibs+=( third_party/closure_compiler )
use optimize-webui && keeplibs+=(
third_party/node
third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2
)
use pdf && keeplibs+=(
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/libtiff
third_party/pdfium/third_party/skia_shared
)
use system-openjpeg || keeplibs+=(
third_party/pdfium/third_party/libopenjpeg20
)
use system-ffmpeg || keeplibs+=( third_party/ffmpeg third_party/opus )
use system-harfbuzz || keeplibs+=(
third_party/freetype
third_party/harfbuzz-ng
)
use system-icu || keeplibs+=( third_party/icu )
use system-jsoncpp || keeplibs+=( third_party/jsoncpp )
use system-libevent || keeplibs+=( base/third_party/libevent )
use system-libvpx || keeplibs+=(
third_party/libvpx
third_party/libvpx/source/libvpx/third_party/x86inc
)
use system-openh264 || keeplibs+=( third_party/openh264 )
use tcmalloc && keeplibs+=( third_party/tcmalloc )
# Remove most bundled libraries, some are still needed
python_setup 'python2*'
build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
}
# Handle all CFLAGS/CXXFLAGS/etc... munging here.
setup_compile_flags() {
# Avoid CFLAGS problems (Bug #352457, #390147)
if ! use custom-cflags; then
replace-flags "-Os" "-O2"
strip-flags
# Filter common/redundant flags. See build/config/compiler/BUILD.gn
filter-flags -fomit-frame-pointer -fno-omit-frame-pointer \
-fstack-protector* -fno-stack-protector* -fuse-ld=* -g* -Wl,*
# Prevent libvpx build failures (Bug #530248, #544702, #546984)
filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 -mno-avx -mno-avx2
fi
if use libcxx; then
append-cxxflags "-stdlib=libc++"
append-ldflags "-stdlib=libc++ -Wl,-lc++abi"
else
if has_version 'sys-devel/clang[default-libcxx]'; then
append-cxxflags "-stdlib=libstdc++"
append-ldflags "-stdlib=libstdc++"
fi
fi
# 'gcc_s' is still required if 'compiler-rt' is Clang's default rtlib
has_version 'sys-devel/clang[default-compiler-rt]' && \
append-ldflags "-Wl,-lgcc_s"
if use thinlto; then
# We need to change the default value of import-instr-limit in
# LLVM to limit the text size increase. The default value is
# 100, and we change it to 30 to reduce the text size increase
# from 25% to 10%. The performance number of page_cycler is the
# same on two of the thinLTO configurations, we got 1% slowdown
# on speedometer when changing import-instr-limit from 100 to 30.
local thinlto_ldflag=( "-Wl,-plugin-opt,-import-instr-limit=30" )
use gold && thinlto_ldflag+=(
"-Wl,-plugin-opt=thinlto"
"-Wl,-plugin-opt,jobs=$(makeopts_jobs)"
)
use lld && thinlto_ldflag+=( "-Wl,--thinlto-jobs=$(makeopts_jobs)" )
append-ldflags "${thinlto_ldflag[*]}"
else
use gold && append-ldflags "-Wl,--threads -Wl,--thread-count=$(makeopts_jobs)"
fi
# Don't complain if Chromium uses a diagnostic option that is not yet
# implemented in the compiler version used by the user. This is only
# supported by Clang.
append-flags -Wno-unknown-warning-option
# Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
append-cflags -Wno-builtin-macro-redefined
append-cxxflags -Wno-builtin-macro-redefined
append-cppflags "-D__DATE__= -D__TIME__= -D__TIMESTAMP__="
local flags
einfo "Building with the compiler settings:"
for flags in {C,CXX,CPP,LD}FLAGS; do
einfo " ${flags} = ${!flags}"
done
}
src_configure() {
# Calling this here supports resumption via FEATURES=keepwork
python_setup 'python2*'
# Make sure the build system will use the right tools (Bug #340795)
tc-export AR CC CXX NM
# Force clang
CC=${CHOST}-clang
CXX=${CHOST}-clang++
AR=llvm-ar
NM=llvm-nm
strip-unsupported-flags
local gn_system_libraries=(
flac
fontconfig
libdrm
libjpeg
libpng
libusb
libwebp
libxml
libxslt
re2
snappy
yasm
zlib
)
use system-ffmpeg && gn_system_libraries+=( ffmpeg opus )
use system-harfbuzz && gn_system_libraries+=( freetype harfbuzz-ng )
use system-icu && gn_system_libraries+=( icu )
use system-libevent && gn_system_libraries+=( libevent )
use system-libvpx && gn_system_libraries+=( libvpx )
use system-openh264 && gn_system_libraries+=( openh264 )
build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
local myconf_gn=(
# Clang features
"is_cfi=$(usetf cfi)" # Implies use_cfi_icall=true
"is_clang=true"
"clang_use_chrome_plugins=false"
"thin_lto_enable_optimizations=$(usetf optimize-thinlto)"
"use_lld=$(usetf lld)"
"use_thin_lto=$(usetf thinlto)"
# UGC's "common" GN flags (config_bundles/common/gn_flags.map)
"blink_symbol_level=0"
"closure_compile=$(usetf closure-compile)"
"enable_ac3_eac3_audio_demuxing=true"
"enable_hangout_services_extension=false"
"enable_hevc_demuxing=true"
"enable_iterator_debugging=false"
"enable_mdns=false"
"enable_mse_mpeg2ts_stream_parser=true"
"enable_nacl=false"
"enable_nacl_nonsfi=false"
"enable_one_click_signin=false"
"enable_reading_list=false"
"enable_remoting=false"
"enable_reporting=false"
"enable_service_discovery=false"
"enable_swiftshader=false"
"enable_widevine=$(usetf widevine)"
"exclude_unwind_tables=true"
"fatal_linker_warnings=false"
"ffmpeg_branding=\"$(usex proprietary-codecs Chrome Chromium)\""
"fieldtrial_testing_like_official_build=true"
"google_api_key=\"\""
"google_default_client_id=\"\""
"google_default_client_secret=\"\""
"is_debug=false"
"is_official_build=true"
"optimize_webui=$(usetf optimize-webui)"
"proprietary_codecs=$(usetf proprietary-codecs)"
"safe_browsing_mode=0"
"symbol_level=0"
"treat_warnings_as_errors=false"
"use_gnome_keyring=false" # Deprecated by libsecret
"use_jumbo_build=$(usetf jumbo-build)"
"use_official_google_api_keys=false"
"use_ozone=false"
"use_sysroot=false"
"use_unofficial_version_number=false"
# UGC's "linux_rooted" GN flags (config_bundles/linux_rooted/gn_flags.map)
"custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
"gold_path=\"\""
"goma_dir=\"\""
"host_toolchain=\"//build/toolchain/linux/unbundle:default\""
"link_pulseaudio=$(usetf pulseaudio)"
"linux_use_bundled_binutils=false"
"use_allocator=\"$(usex tcmalloc tcmalloc none)\""
"use_cups=$(usetf cups)"
"use_custom_libcxx=false"
"use_gio=$(usetf gnome)"
"use_kerberos=$(usetf kerberos)"
# If enabled, it will build the bundled OpenH264 for encoding,
# hence the restriction: !system-openh264? ( bindist )
"use_openh264=$(usetf !system-openh264)"
"use_pulseaudio=$(usetf pulseaudio)"
# HarfBuzz and FreeType need to be built together in a specific way
# to get FreeType autohinting to work properly. Chromium bundles
# FreeType and HarfBuzz to meet that need. (https://crbug.com/694137)
"use_system_freetype=$(usetf system-harfbuzz)"
"use_system_harfbuzz=$(usetf system-harfbuzz)"
"use_system_lcms2=$(usetf pdf)"
"use_system_libjpeg=true"
"use_system_zlib=true"
"use_vaapi=$(usetf vaapi)"
# Additional flags
"enable_desktop_in_product_help=false"
"enable_pdf=$(usetf pdf)"
"enable_print_preview=$(usetf pdf)"
"rtc_build_examples=false"
"use_icf=true"
# Enables the soon-to-be default tcmalloc (https://crbug.com/724399)
# It is relevant only when use_allocator == "tcmalloc"
"use_new_tcmalloc=$(usetf new-tcmalloc)"
)
# use_cfi_icall only works with LLD
use cfi && myconf_gn+=( "use_cfi_icall=$(usetf lld)" )
setup_compile_flags
# Bug #491582
export TMPDIR="${WORKDIR}/temp"
# shellcheck disable=SC2174
mkdir -p -m 755 "${TMPDIR}" || die
# Bug #654216
addpredict /dev/dri/ #nowarn
einfo "Configuring Chromium..."
set -- gn gen --args="${myconf_gn[*]} ${EXTRA_GN}" out/Release
echo "$@"
"$@" || die
}
src_compile() {
# Final link uses lots of file descriptors
ulimit -n 4096
# Calling this here supports resumption via FEATURES=keepwork
python_setup 'python2*'
# shellcheck disable=SC2086
# Avoid falling back to preprocessor mode when sources contain time macros
has ccache ${FEATURES} && \
export CCACHE_SLOPPINESS="${CCACHE_SLOPPINESS:-time_macros}"
# Build mksnapshot and pax-mark it
local x
for x in mksnapshot v8_context_snapshot_generator; do
eninja -C out/Release "${x}"
pax-mark m "out/Release/${x}"
done
# Work around broken deps
eninja -C out/Release gen/ui/accessibility/ax_enums.mojom{,-shared}.h
# 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 # SC2155
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
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 out/Release/locales > /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
}

View File

@ -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 '<media-video/ffmpeg-4.0.0'; then
sed -i '/jpeg.patch/i debian_buster/system/ffmpeg34.patch' \
"${ugc_rooted_dir}/patch_order.list" || die
fi
if ! use system-icu; then
sed -i '/icudtl.dat/d' "${ugc_rooted_dir}/pruning.list" || die
fi
if use system-openjpeg; then
sed -i '/jpeg.patch/a debian_buster/system/openjpeg.patch' \
"${ugc_rooted_dir}/patch_order.list" || die
fi
if use vaapi && has_version '<x11-libs/libva-2.0.0'; then
sed -i "/build.patch/i ${PN}/linux/fix-libva1-compatibility.patch" \
"${ugc_rooted_dir}/patch_order.list" || die
fi
ebegin "Pruning binaries"
"${ugc_cli}" prune -b "${ugc_config}" ./
eend $? || die
ebegin "Applying ungoogled-chromium patches"
"${ugc_cli}" patches apply -b "${ugc_config}" ./
eend $? || die
ebegin "Applying domain substitution"
"${ugc_cli}" domains apply -b "${ugc_config}" -c domainsubcache.tar.gz ./
eend $? || die
local keeplibs=(
base/third_party/dmg_fp
base/third_party/dynamic_annotations
base/third_party/icu
base/third_party/superfasthash
base/third_party/symbolize
base/third_party/valgrind
base/third_party/xdg_mime
base/third_party/xdg_user_dirs
chrome/third_party/mozilla_security_manager
courgette/third_party
net/third_party/http2
net/third_party/mozilla_security_manager
net/third_party/nss
net/third_party/quic
net/third_party/spdy
net/third_party/uri_template
third_party/abseil-cpp
third_party/adobe
third_party/angle
third_party/angle/src/common/third_party/base
third_party/angle/src/common/third_party/smhasher
third_party/angle/src/common/third_party/xxhash
third_party/angle/src/third_party/compiler
third_party/angle/src/third_party/libXNVCtrl
third_party/angle/src/third_party/trace_event
third_party/angle/third_party/glslang
third_party/angle/third_party/spirv-headers
third_party/angle/third_party/spirv-tools
third_party/angle/third_party/vulkan-headers
third_party/angle/third_party/vulkan-loader
third_party/angle/third_party/vulkan-tools
third_party/angle/third_party/vulkan-validation-layers
third_party/apple_apsl
third_party/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/beautifulsoup4
third_party/catapult/third_party/html5lib-python
third_party/catapult/third_party/polymer
third_party/catapult/third_party/six
third_party/catapult/tracing/third_party/d3
third_party/catapult/tracing/third_party/gl-matrix
third_party/catapult/tracing/third_party/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/crashpad
third_party/crashpad/crashpad/third_party/zlib
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/glslang
third_party/google_input_tools
third_party/google_input_tools/third_party/closure_library
third_party/google_input_tools/third_party/closure_library/third_party/closure
third_party/googletest
third_party/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/vector
third_party/libaom/source/libaom/third_party/x86inc
third_party/libjingle
third_party/libphonenumber
third_party/libsecret
third_party/libsrtp
third_party/libsync
third_party/libudev
third_party/libusb
third_party/libwebm
third_party/libxml/chromium
third_party/libyuv
third_party/lss
third_party/markupsafe
third_party/mesa
third_party/metrics_proto
third_party/modp_b64
third_party/nasm
third_party/openmax_dl
third_party/ots
third_party/ply
third_party/polymer
third_party/protobuf
third_party/protobuf/third_party/six
third_party/pyjson5
third_party/qcms
third_party/rnnoise
third_party/s2cellid
third_party/sfntly
third_party/simplejson
third_party/skia
third_party/skia/third_party/gif
third_party/skia/third_party/skcms
third_party/skia/third_party/vulkan
third_party/smhasher
third_party/speech-dispatcher
third_party/spirv-headers
third_party/SPIRV-Tools
third_party/sqlite
third_party/ungoogled
third_party/usb_ids
third_party/usrsctp
third_party/vulkan
third_party/web-animations-js
third_party/webdriver
third_party/webrtc
third_party/webrtc/common_audio/third_party/fft4g
third_party/webrtc/common_audio/third_party/spl_sqrt_floor
third_party/webrtc/modules/third_party/fft
third_party/webrtc/modules/third_party/g711
third_party/webrtc/modules/third_party/g722
third_party/webrtc/rtc_base/third_party/base64
third_party/webrtc/rtc_base/third_party/sigslot
third_party/widevine
third_party/woff2
third_party/xdg-utils
third_party/yasm/run_yasm.py
third_party/zlib/google
url/third_party/mozilla
v8/src/third_party/valgrind
v8/src/third_party/utf8-decoder
v8/third_party/v8
)
use closure-compile && keeplibs+=( third_party/closure_compiler )
use optimize-webui && keeplibs+=(
third_party/node
third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2
)
use pdf && keeplibs+=(
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/libtiff
third_party/pdfium/third_party/skia_shared
)
use system-openjpeg || keeplibs+=(
third_party/pdfium/third_party/libopenjpeg20
)
use system-ffmpeg || keeplibs+=( third_party/ffmpeg third_party/opus )
use system-harfbuzz || keeplibs+=(
third_party/freetype
third_party/harfbuzz-ng
)
use system-icu || keeplibs+=( third_party/icu )
use system-jsoncpp || keeplibs+=( third_party/jsoncpp )
use system-libevent || keeplibs+=( base/third_party/libevent )
use system-libvpx || keeplibs+=(
third_party/libvpx
third_party/libvpx/source/libvpx/third_party/x86inc
)
use system-openh264 || keeplibs+=( third_party/openh264 )
use tcmalloc && keeplibs+=( third_party/tcmalloc )
# Remove most bundled libraries, some are still needed
python_setup 'python2*'
build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die
}
# Handle all CFLAGS/CXXFLAGS/etc... munging here.
setup_compile_flags() {
# Avoid CFLAGS problems (Bug #352457, #390147)
if ! use custom-cflags; then
replace-flags "-Os" "-O2"
strip-flags
# Filter common/redundant flags. See build/config/compiler/BUILD.gn
filter-flags -fomit-frame-pointer -fno-omit-frame-pointer \
-fstack-protector* -fno-stack-protector* -fuse-ld=* -g* -Wl,*
# Prevent libvpx build failures (Bug #530248, #544702, #546984)
filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 -mno-avx -mno-avx2
fi
if use libcxx; then
append-cxxflags "-stdlib=libc++"
append-ldflags "-stdlib=libc++ -Wl,-lc++abi"
else
if has_version 'sys-devel/clang[default-libcxx]'; then
append-cxxflags "-stdlib=libstdc++"
append-ldflags "-stdlib=libstdc++"
fi
fi
# 'gcc_s' is still required if 'compiler-rt' is Clang's default rtlib
has_version 'sys-devel/clang[default-compiler-rt]' && \
append-ldflags "-Wl,-lgcc_s"
if use thinlto; then
# We need to change the default value of import-instr-limit in
# LLVM to limit the text size increase. The default value is
# 100, and we change it to 30 to reduce the text size increase
# from 25% to 10%. The performance number of page_cycler is the
# same on two of the thinLTO configurations, we got 1% slowdown
# on speedometer when changing import-instr-limit from 100 to 30.
local thinlto_ldflag=( "-Wl,-plugin-opt,-import-instr-limit=30" )
use gold && thinlto_ldflag+=(
"-Wl,-plugin-opt=thinlto"
"-Wl,-plugin-opt,jobs=$(makeopts_jobs)"
)
use lld && thinlto_ldflag+=( "-Wl,--thinlto-jobs=$(makeopts_jobs)" )
append-ldflags "${thinlto_ldflag[*]}"
else
use gold && append-ldflags "-Wl,--threads -Wl,--thread-count=$(makeopts_jobs)"
fi
# Don't complain if Chromium uses a diagnostic option that is not yet
# implemented in the compiler version used by the user. This is only
# supported by Clang.
append-flags -Wno-unknown-warning-option
# Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
append-cflags -Wno-builtin-macro-redefined
append-cxxflags -Wno-builtin-macro-redefined
append-cppflags "-D__DATE__= -D__TIME__= -D__TIMESTAMP__="
local flags
einfo "Building with the compiler settings:"
for flags in {C,CXX,CPP,LD}FLAGS; do
einfo " ${flags} = ${!flags}"
done
}
src_configure() {
# Calling this here supports resumption via FEATURES=keepwork
python_setup 'python2*'
# Make sure the build system will use the right tools (Bug #340795)
tc-export AR CC CXX NM
# Force clang
CC=${CHOST}-clang
CXX=${CHOST}-clang++
AR=llvm-ar
NM=llvm-nm
strip-unsupported-flags
local gn_system_libraries=(
flac
fontconfig
libdrm
libjpeg
libpng
libusb
libwebp
libxml
libxslt
re2
snappy
yasm
zlib
)
use system-ffmpeg && gn_system_libraries+=( ffmpeg opus )
use system-harfbuzz && gn_system_libraries+=( freetype harfbuzz-ng )
use system-icu && gn_system_libraries+=( icu )
use system-libevent && gn_system_libraries+=( libevent )
use system-libvpx && gn_system_libraries+=( libvpx )
use system-openh264 && gn_system_libraries+=( openh264 )
build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die
local myconf_gn=(
# Clang features
"is_cfi=$(usetf cfi)" # Implies use_cfi_icall=true
"is_clang=true"
"clang_use_chrome_plugins=false"
"thin_lto_enable_optimizations=$(usetf optimize-thinlto)"
"use_lld=$(usetf lld)"
"use_thin_lto=$(usetf thinlto)"
# UGC's "common" GN flags (config_bundles/common/gn_flags.map)
"blink_symbol_level=0"
"closure_compile=$(usetf closure-compile)"
"enable_ac3_eac3_audio_demuxing=true"
"enable_hangout_services_extension=false"
"enable_hevc_demuxing=true"
"enable_iterator_debugging=false"
"enable_mdns=false"
"enable_mse_mpeg2ts_stream_parser=true"
"enable_nacl=false"
"enable_nacl_nonsfi=false"
"enable_one_click_signin=false"
"enable_reading_list=false"
"enable_remoting=false"
"enable_reporting=false"
"enable_service_discovery=false"
"enable_swiftshader=false"
"enable_widevine=$(usetf widevine)"
"exclude_unwind_tables=true"
"fatal_linker_warnings=false"
"ffmpeg_branding=\"$(usex proprietary-codecs Chrome Chromium)\""
"fieldtrial_testing_like_official_build=true"
"google_api_key=\"\""
"google_default_client_id=\"\""
"google_default_client_secret=\"\""
"is_debug=false"
"is_official_build=true"
"optimize_webui=$(usetf optimize-webui)"
"proprietary_codecs=$(usetf proprietary-codecs)"
"safe_browsing_mode=0"
"symbol_level=0"
"treat_warnings_as_errors=false"
"use_gnome_keyring=false" # Deprecated by libsecret
"use_jumbo_build=$(usetf jumbo-build)"
"use_official_google_api_keys=false"
"use_ozone=false"
"use_sysroot=false"
"use_unofficial_version_number=false"
# UGC's "linux_rooted" GN flags (config_bundles/linux_rooted/gn_flags.map)
"custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
"gold_path=\"\""
"goma_dir=\"\""
"host_toolchain=\"//build/toolchain/linux/unbundle:default\""
"link_pulseaudio=$(usetf pulseaudio)"
"linux_use_bundled_binutils=false"
"use_allocator=\"$(usex tcmalloc tcmalloc none)\""
"use_cups=$(usetf cups)"
"use_custom_libcxx=false"
"use_gio=$(usetf gnome)"
"use_kerberos=$(usetf kerberos)"
# If enabled, it will build the bundled OpenH264 for encoding,
# hence the restriction: !system-openh264? ( bindist )
"use_openh264=$(usetf !system-openh264)"
"use_pulseaudio=$(usetf pulseaudio)"
# HarfBuzz and FreeType need to be built together in a specific way
# to get FreeType autohinting to work properly. Chromium bundles
# FreeType and HarfBuzz to meet that need. (https://crbug.com/694137)
"use_system_freetype=$(usetf system-harfbuzz)"
"use_system_harfbuzz=$(usetf system-harfbuzz)"
"use_system_lcms2=$(usetf pdf)"
"use_system_libjpeg=true"
"use_system_zlib=true"
"use_vaapi=$(usetf vaapi)"
# Additional flags
"enable_desktop_in_product_help=false"
"enable_pdf=$(usetf pdf)"
"enable_print_preview=$(usetf pdf)"
"rtc_build_examples=false"
"use_icf=true"
# Enables the soon-to-be default tcmalloc (https://crbug.com/724399)
# It is relevant only when use_allocator == "tcmalloc"
"use_new_tcmalloc=$(usetf new-tcmalloc)"
)
# use_cfi_icall only works with LLD
use cfi && myconf_gn+=( "use_cfi_icall=$(usetf lld)" )
setup_compile_flags
# Bug #491582
export TMPDIR="${WORKDIR}/temp"
# shellcheck disable=SC2174
mkdir -p -m 755 "${TMPDIR}" || die
# Bug #654216
addpredict /dev/dri/ #nowarn
einfo "Configuring Chromium..."
set -- gn gen --args="${myconf_gn[*]} ${EXTRA_GN}" out/Release
echo "$@"
"$@" || die
}
src_compile() {
# Final link uses lots of file descriptors
ulimit -n 4096
# Calling this here supports resumption via FEATURES=keepwork
python_setup 'python2*'
# shellcheck disable=SC2086
# Avoid falling back to preprocessor mode when sources contain time macros
has ccache ${FEATURES} && \
export CCACHE_SLOPPINESS="${CCACHE_SLOPPINESS:-time_macros}"
# Build mksnapshot and pax-mark it
local x
for x in mksnapshot v8_context_snapshot_generator; do
eninja -C out/Release "${x}"
pax-mark m "out/Release/${x}"
done
# Work around broken deps
eninja -C out/Release gen/ui/accessibility/ax_enums.mojom{,-shared}.h
# 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 # SC2155
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
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 out/Release/locales > /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
}