# Copyright 2009-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# PACKAGING NOTES
# Upstream roll their bundled Clang every two weeks, and the bundled Rust
# is rolled regularly and depends on that. While we do our best to build
# with system Clang, we may eventually hit the point where we need to use
# the bundled Clang due to the use of prerelease features.
# USE=bundled-toolchain is intended for users who want to use the same toolchain
# as the upstream releases. It's also a good fallback in case we fall behind
# and need to get a release out quickly (less likely with `dev` in-tree).
# Since m133 we are using CI-generated tarballs from
# https://github.com/chromium-linux-tarballs/chromium-tarballs/
# These are bit-for-bit identical to the official releases, but are built
# using an external CI system that we have some control over, in case
# issues pop up again with official tarball generation.
GN_MIN_VER=0.2235
# chromium-tools/get-chromium-toolchain-strings.py
TEST_FONT=a28b222b79851716f8358d2800157d9ffe117b3545031ae51f69b7e1e1b9a969
BUNDLED_CLANG_VER=llvmorg-21-init-11777-gfd3fecfc-1
BUNDLED_RUST_VER=4a0969e06dbeaaa43914d2d00b2e843d49aa3886-1
RUST_SHORT_HASH=${BUNDLED_RUST_VER:0:10}-${BUNDLED_RUST_VER##*-}
NODE_VER=22.11.0
VIRTUALX_REQUIRED="pgo"
CHROMIUM_LANGS="af 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 ur vi zh-CN zh-TW"
LLVM_COMPAT=( 19 20 )
PYTHON_COMPAT=( python3_{11..13} )
PYTHON_REQ_USE="xml(+)"
RUST_MAX_VER=1.88.0 # M140 fails to build with 1.89+
RUST_MIN_VER=1.78.0
RUST_NEEDS_LLVM="yes please"
RUST_OPTIONAL="yes" # Not actually optional, but we don't need system Rust (or LLVM) with USE=bundled-toolchain
inherit check-reqs chromium-2 desktop flag-o-matic llvm-r1 multiprocessing ninja-utils pax-utils
inherit python-any-r1 readme.gentoo-r1 rust systemd toolchain-funcs virtualx xdg-utils
DESCRIPTION="Open-source version of Google Chrome web browser"
HOMEPAGE="https://www.chromium.org/"
PPC64_HASH="e1538a223437603b214fdcb1a6adfb91e98f769a"
PATCH_V="${PV%%\.*}-1"
SRC_URI="https://github.com/chromium-linux-tarballs/chromium-tarballs/releases/download/${PV}/chromium-${PV}-linux.tar.xz
!bundled-toolchain? (
https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${PATCH_V}/chromium-patches-${PATCH_V}.tar.bz2
)
bundled-toolchain? (
https://gsdview.appspot.com/chromium-browser-clang/Linux_x64/clang-${BUNDLED_CLANG_VER}.tar.xz
-> chromium-clang-${BUNDLED_CLANG_VER}.tar.xz
https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/rust-toolchain-${BUNDLED_RUST_VER}-${BUNDLED_CLANG_VER%-*}.tar.xz
-> chromium-rust-toolchain-${RUST_SHORT_HASH}-${BUNDLED_CLANG_VER%-*}.tar.xz
)
test? (
https://github.com/chromium-linux-tarballs/chromium-tarballs/releases/download/${PV}/chromium-${PV}-linux-testdata.tar.xz
https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz
)
ppc64? (
https://gitlab.raptorengineering.com/raptor-engineering-public/chromium/openpower-patches/-/archive/${PPC64_HASH}/openpower-patches-${PPC64_HASH}.tar.bz2 -> chromium-openpower-${PPC64_HASH:0:10}.tar.bz2
)
pgo? ( https://github.com/elkablo/chromium-profiler/releases/download/v0.2/chromium-profiler-0.2.tar )"
# https://gitweb.gentoo.org/proj/chromium-tools.git/tree/get-chromium-licences.py
LICENSE="BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 Base64 Boost-1.0 CC-BY-3.0 CC-BY-4.0 Clear-BSD"
LICENSE+=" FFT2D FTL IJG ISC LGPL-2 LGPL-2.1 libpng libpng2 MIT MPL-1.1 MPL-2.0 Ms-PL openssl PSF-2"
LICENSE+=" SGI-B-2.0 SSLeay SunSoft Unicode-3.0 Unicode-DFS-2015 Unlicense UoI-NCSA X11-Lucent"
LICENSE+=" rar? ( unRAR )"
SLOT="0/stable"
# Dev exists mostly to give devs some breathing room for beta/stable releases;
# it shouldn't be keyworded but adventurous users can select it.
if [[ ${SLOT} != "0/dev" ]]; then
KEYWORDS="amd64 arm64 ~ppc64"
fi
IUSE_SYSTEM_LIBS="+system-harfbuzz +system-icu +system-png +system-zstd"
IUSE="+X ${IUSE_SYSTEM_LIBS} bindist bundled-toolchain cups debug ffmpeg-chromium gtk4 +hangouts headless kerberos +official pax-kernel pgo"
IUSE+=" +proprietary-codecs pulseaudio qt6 +rar +screencast selinux test +vaapi +wayland +widevine cpu_flags_ppc_vsx3"
RESTRICT="
!bindist? ( bindist )
!test? ( test )
"
REQUIRED_USE="
!headless? ( || ( X wayland ) )
pgo? ( X !wayland )
screencast? ( wayland )
ffmpeg-chromium? ( bindist proprietary-codecs )
"
COMMON_X_DEPEND="
x11-libs/libXcomposite:=
x11-libs/libXcursor:=
x11-libs/libXdamage:=
x11-libs/libXfixes:=
>=x11-libs/libXi-1.6.0:=
x11-libs/libXrandr:=
x11-libs/libXrender:=
x11-libs/libXtst:=
x11-libs/libxshmfence:=
"
COMMON_SNAPSHOT_DEPEND="
system-icu? ( >=dev-libs/icu-73.0:= )
>=dev-libs/libxml2-2.12.4:=[icu]
dev-libs/nspr:=
>=dev-libs/nss-3.26:=
dev-libs/libxslt:=
media-libs/fontconfig:=
>=media-libs/freetype-2.11.0-r1:=
system-harfbuzz? ( >=media-libs/harfbuzz-3:0=[icu(-)] )
media-libs/libjpeg-turbo:=
system-png? ( media-libs/libpng:=[-apng(-)] )
system-zstd? ( >=app-arch/zstd-1.5.5:= )
>=media-libs/libwebp-0.4.0:=
media-libs/mesa:=[gbm(+)]
>=media-libs/openh264-1.6.0:=
virtual/zlib:=
!headless? (
dev-libs/glib:2
>=media-libs/alsa-lib-1.0.19:=
pulseaudio? ( media-libs/libpulse:= )
sys-apps/pciutils:=
kerberos? ( virtual/krb5 )
vaapi? ( >=media-libs/libva-2.7:=[X?,wayland?] )
X? (
x11-base/xorg-proto:=
x11-libs/libX11:=
x11-libs/libxcb:=
x11-libs/libXext:=
)
x11-libs/libxkbcommon:=
wayland? (
dev-libs/libffi:=
dev-libs/wayland:=
screencast? ( media-video/pipewire:= )
)
)
"
COMMON_DEPEND="
${COMMON_SNAPSHOT_DEPEND}
app-arch/bzip2:=
dev-libs/expat:=
net-misc/curl[ssl]
sys-apps/dbus:=
media-libs/flac:=
virtual/minizip:=
!headless? (
>=app-accessibility/at-spi2-core-2.46.0:2
media-libs/mesa:=[X?,wayland?]
virtual/udev
x11-libs/cairo:=
x11-libs/gdk-pixbuf:2
x11-libs/pango:=
cups? ( >=net-print/cups-1.3.11:= )
qt6? ( dev-qt/qtbase:6[gui,widgets] )
X? ( ${COMMON_X_DEPEND} )
)
"
RDEPEND="${COMMON_DEPEND}
!headless? (
|| (
x11-libs/gtk+:3[X?,wayland?]
gui-libs/gtk:4[X?,wayland?]
)
qt6? ( dev-qt/qtbase:6[X?,wayland?] )
)
virtual/ttf-fonts
selinux? ( sec-policy/selinux-chromium )
bindist? (
!ffmpeg-chromium? ( >=media-video/ffmpeg-6.1-r1:0/58.60.60[chromium] )
ffmpeg-chromium? ( media-video/ffmpeg-chromium:${PV%%\.*} )
)
"
DEPEND="${COMMON_DEPEND}
!headless? (
gtk4? ( gui-libs/gtk:4[X?,wayland?] )
!gtk4? ( x11-libs/gtk+:3[X?,way
|