commit: 7678265315c669b4ccd20e8c0072a4817da1d0ee Author: Matt Jolly <kangie <AT> gentoo <DOT> org> AuthorDate: Fri Feb 27 10:16:21 2026 +0000 Commit: Matt Jolly <kangie <AT> gentoo <DOT> org> CommitDate: Sat Feb 28 22:31:44 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76782653
www-client/chromium-common: new package, add 1 This package contains common files that will be shared between www-client/chromium slots (channels) Signed-off-by: Matt Jolly <kangie <AT> gentoo.org> .../chromium-common/chromium-common-1.ebuild | 37 +++++++++++ .../chromium-common/files/chromium-launcher.sh | 72 ++++++++++++++++++++++ www-client/chromium-common/files/chromium.default | 5 ++ www-client/chromium-common/metadata.xml | 13 ++++ 4 files changed, 127 insertions(+) diff --git a/www-client/chromium-common/chromium-common-1.ebuild b/www-client/chromium-common/chromium-common-1.ebuild new file mode 100644 index 000000000000..ec0ae6e2198e --- /dev/null +++ b/www-client/chromium-common/chromium-common-1.ebuild @@ -0,0 +1,37 @@ +# Copyright 2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Common configuration files for Chromium slots" +HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Chromium/" +S="${WORKDIR}" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~arm64" +RESTRICT="test" # There is no code, only Zuul. + +# Non-slotted Chromium will conflict +RDEPEND="!www-client/chromium:0" + +src_unpack() { + : +} + +src_configure() { + : +} + +src_compile() { + sed -e "s:/usr/lib/:/usr/$(get_libdir)/:g" "${FILESDIR}/chromium-launcher.sh" \ + > chromium-launcher.sh || die +} + +src_install() { + exeinto /usr/libexec/chromium + doexe chromium-launcher.sh + + insinto /etc/chromium + newins "${FILESDIR}/chromium.default" default +} diff --git a/www-client/chromium-common/files/chromium-launcher.sh b/www-client/chromium-common/files/chromium-launcher.sh new file mode 100644 index 000000000000..e70bc4c3130a --- /dev/null +++ b/www-client/chromium-common/files/chromium-launcher.sh @@ -0,0 +1,72 @@ +#!/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 + # Skip backup files and hidden files #546394 + case "${f}" in + *~|*.bak|*.old|*.swp|*.tmp|*/.*) continue ;; + esac + [[ -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"} + +# We rely on the slotted stub to provide PROGDIR. +if [[ -z "${PROGDIR}" ]]; then + echo "ERROR: PROGDIR is not set. The Chromium launcher stub is misconfigured." >&2 + exit 1 +fi + +export CHROME_WRAPPER="${PROGDIR}/${CHROME_EXEC_NAME:-chromium-browser}" + +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. + echo "Refusing to run as root is a safety feature. Running as root disables the sandbox." >&2 + CHROMIUM_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/chromium + ${CHROMIUM_FLAGS}" +fi + +# Select session type and platform; var comes from the stub launcher.sh generated by the ebuild +if [[ ${OZONE_AUTO_SESSION} == true ]]; then + platform= + if [[ ${XDG_SESSION_TYPE} == x11 ]]; then + platform=x11 + elif [[ ${XDG_SESSION_TYPE} == wayland ]]; then + platform=wayland + else + if [[ -n ${WAYLAND_DISPLAY} ]]; then + platform=wayland + else + platform=x11 + fi + fi + if ${DISABLE_OZONE_PLATFORM:-false}; then + platform=x11 + fi + CHROMIUM_FLAGS="--ozone-platform=${platform} ${CHROMIUM_FLAGS}" +fi + +# Sanitise std{in,out,err} because they'll be shared with untrusted child +# processes (http://crbug.com/376567). +exec < /dev/null +exec > >(exec cat) +exec 2> >(exec cat >&2) + +exec -a "/usr/bin/${CHROME_EXEC_NAME:-chromium-browser}" "$PROGDIR/chrome" --extra-plugin-dir=/usr/lib/nsbrowser/plugins ${CHROMIUM_FLAGS} "$@" diff --git a/www-client/chromium-common/files/chromium.default b/www-client/chromium-common/files/chromium.default new file mode 100644 index 000000000000..c140cdeb5666 --- /dev/null +++ b/www-client/chromium-common/files/chromium.default @@ -0,0 +1,5 @@ +# Default settings for chromium. This file is sourced by /bin/bash from +# the chromium launcher. + +# Options to pass to chromium. +#CHROMIUM_FLAGS="" diff --git a/www-client/chromium-common/metadata.xml b/www-client/chromium-common/metadata.xml new file mode 100644 index 000000000000..2d09c6eed081 --- /dev/null +++ b/www-client/chromium-common/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>[email protected]</email> + <name>Chromium in Gentoo Project</name> + </maintainer> + <maintainer type="person"> + <email>[email protected]</email> + <name>Matt Jolly</name> + </maintainer> + <stabilize-allarches/> +</pkgmetadata>
