diff options
| author | Matt Jolly <kangie@gentoo.org> | 2026-09-15 19:16:54 +1000 |
|---|---|---|
| committer | Matt Jolly <kangie@gentoo.org> | 2026-09-15 21:27:18 +1000 |
| commit | 92aa7db43fb21a9ee27aa40cdc913d23ea294104 (patch) | |
| tree | 1ff88e333ce1d9023a6e9bbff40001f156d80c57 /www-client | |
| parent | bfaf5ad46bf9dc2fdb5b3f8a2ce4045c95ef4dc7 (diff) | |
www-client/microsoft-edge*: USE gtk3/4, MSEDGE_FLAGS
Since we're revbumping anyway I took the opportunity to review the
dependencies for MS Edge; like all Chromium-based browsers, if support
for gtk3 and gtk4 is built-in the browser will select a codepath at
runtime - there's no reason to require both.
Instead we'll set up REQUIRED_USE to ensure that at least one GUI lib is
available and just pretend that the other doesn't exist, even though it
might be preferred at runtime if found.
As MS Edge doesn't provide a convenient way to globally set flags like
"I want you to use this GTK version", we've injected some logic based on
chromium-common to the shipped edge wrapper during src_install to enable
the use of `/etc/msedge/foo` to set `MSEDGE_FLAGS` and pass that through
to the main binary.
Note that the Qt shim in Chromium is mostly used for native file picker
dialogs and isn't a full-blown GUI - at least one gtk dependency is
required.
We're defaulting to +gtk4 to avoid papercuts (and because it's 2026),
users who don't have gui-libs/gtk installed from some other package on a
desktop system (and who care enough about it) should be few and far
between: the USE flag is there to be toggled.
Signed-off-by: Matt Jolly <kangie@gentoo.org>
Diffstat (limited to 'www-client')
6 files changed, 157 insertions, 8 deletions
diff --git a/www-client/microsoft-edge-beta/metadata.xml b/www-client/microsoft-edge-beta/metadata.xml index a7689ec3a837..d1094f5e4f12 100644 --- a/www-client/microsoft-edge-beta/metadata.xml +++ b/www-client/microsoft-edge-beta/metadata.xml @@ -10,6 +10,8 @@ sophisticated technology to make the web faster, safer, and easier. </longdescription> <use> + <flag name="gtk3">Pull in <pkg>x11-libs/gtk+</pkg> for the user interface.</flag> + <flag name="gtk4">Pull in <pkg>gui-libs/gtk</pkg> for the user interface.</flag> <flag name="mip">Install Microsoft Information Protection plugin.</flag> </use> </pkgmetadata> diff --git a/www-client/microsoft-edge-beta/microsoft-edge-beta-154.0.4258.18-r1.ebuild b/www-client/microsoft-edge-beta/microsoft-edge-beta-154.0.4258.18-r1.ebuild index 9ed54da5340e..9cc3c50f8821 100644 --- a/www-client/microsoft-edge-beta/microsoft-edge-beta-154.0.4258.18-r1.ebuild +++ b/www-client/microsoft-edge-beta/microsoft-edge-beta-154.0.4258.18-r1.ebuild @@ -20,10 +20,11 @@ S=${WORKDIR} LICENSE="microsoft-edge" SLOT="0" -KEYWORDS="-* ~amd64" +KEYWORDS="-* amd64" -IUSE="qt6" +IUSE="gtk3 +gtk4 qt6" RESTRICT="bindist mirror strip" +REQUIRED_USE="|| ( gtk3 gtk4 )" RDEPEND=" >=app-accessibility/at-spi2-core-2.46.0:2 @@ -43,7 +44,6 @@ RDEPEND=" sys-libs/glibc x11-libs/cairo x11-libs/gdk-pixbuf:2 - x11-libs/gtk+:3[X] x11-libs/libdrm x11-libs/libX11 x11-libs/libXcomposite @@ -56,6 +56,8 @@ RDEPEND=" x11-libs/libxshmfence x11-libs/pango x11-misc/xdg-utils + gtk3? ( x11-libs/gtk+:3[X] ) + gtk4? ( gui-libs/gtk:4[X] ) qt6? ( dev-qt/qtbase:6[gui,widgets] ) " @@ -115,4 +117,49 @@ src_install() { fi pax-mark m "${EDGE_HOME}/msedge" + + # MS Edge includes channel information in the wrapper script, so rather than replace it like with Chromium, + # We'll inject additional logic to look for and use user-defined flags in /etc/msedge/*. + local wrapper="${ED}/${EDGE_HOME}/${PN}" + local inject="${T}/msedge-wrapper-flags.inc" + local wrapper_tmp="${T}/msedge-wrapper.new" + + cat > "${inject}" <<'EOF' + +# Allow the user to override command-line flags, bug #357629. +for f in /etc/msedge/*; do + case "${f}" in + *~|*.bak|*.old|*.swp|*.tmp|*/.*) continue ;; + esac + [[ -f "${f}" ]] && source "${f}" +done + +# Prefer MSEDGE_USER_FLAGS from environment over MSEDGE_FLAGS from /etc/msedge/default. +MSEDGE_FLAGS=${MSEDGE_USER_FLAGS:-"$MSEDGE_FLAGS"} + +EOF + + { + # shebang and copyright notice; hasn't changed in 15 years. + head -n 5 "${wrapper}" || die + cat "${inject}" || die + tail -n +7 "${wrapper}" | \ + sed 's|^exec -a "\$0" "\$HERE/msedge" "\$@"$|exec -a "$0" "$HERE/msedge" ${MSEDGE_FLAGS} "$@"|' || die + } > "${wrapper_tmp}" || die "Failed to build wrapper with injected logic" + + cat "${wrapper_tmp}" > "${wrapper}" || die "Failed to update wrapper logic" + rm -f "${wrapper_tmp}" || die "Failed to clean temporary wrapper" + + grep -q 'exec -a "\$0" "\$HERE/msedge" ${MSEDGE_FLAGS} "\$@"' "${wrapper}" || + die "Failed to update wrapper exec flags" +} + +pkg_postinst() { + if use gtk4 && has_version x11-libs/gtk+; then + einfo "GTK4 has been selected, however x11-libs/gtk+ is also installed." + einfo "MS Edge will prefer GTK3 at runtime as a result; if you prefer GTK4," + einfo "please create \`/etc/msedge/default\` and set \`MSEDGE_FLAGS=\"--gtk-version=4\"\`" + fi + xdg_desktop_database_update + xdg_icon_cache_update } diff --git a/www-client/microsoft-edge-dev/metadata.xml b/www-client/microsoft-edge-dev/metadata.xml index a7689ec3a837..d1094f5e4f12 100644 --- a/www-client/microsoft-edge-dev/metadata.xml +++ b/www-client/microsoft-edge-dev/metadata.xml @@ -10,6 +10,8 @@ sophisticated technology to make the web faster, safer, and easier. </longdescription> <use> + <flag name="gtk3">Pull in <pkg>x11-libs/gtk+</pkg> for the user interface.</flag> + <flag name="gtk4">Pull in <pkg>gui-libs/gtk</pkg> for the user interface.</flag> <flag name="mip">Install Microsoft Information Protection plugin.</flag> </use> </pkgmetadata> diff --git a/www-client/microsoft-edge-dev/microsoft-edge-dev-155.0.4268.0-r1.ebuild b/www-client/microsoft-edge-dev/microsoft-edge-dev-155.0.4268.0-r1.ebuild index 9ed54da5340e..801a663b7ab4 100644 --- a/www-client/microsoft-edge-dev/microsoft-edge-dev-155.0.4268.0-r1.ebuild +++ b/www-client/microsoft-edge-dev/microsoft-edge-dev-155.0.4268.0-r1.ebuild @@ -20,10 +20,11 @@ S=${WORKDIR} LICENSE="microsoft-edge" SLOT="0" -KEYWORDS="-* ~amd64" +KEYWORDS="-* amd64" -IUSE="qt6" +IUSE="gtk3 +gtk4 qt6" RESTRICT="bindist mirror strip" +REQUIRED_USE="|| ( gtk3 gtk4 )" RDEPEND=" >=app-accessibility/at-spi2-core-2.46.0:2 @@ -43,7 +44,6 @@ RDEPEND=" sys-libs/glibc x11-libs/cairo x11-libs/gdk-pixbuf:2 - x11-libs/gtk+:3[X] x11-libs/libdrm x11-libs/libX11 x11-libs/libXcomposite @@ -56,6 +56,8 @@ RDEPEND=" x11-libs/libxshmfence x11-libs/pango x11-misc/xdg-utils + gtk3? ( x11-libs/gtk+:3[X] ) + gtk4? ( gui-libs/gtk:4[X] ) qt6? ( dev-qt/qtbase:6[gui,widgets] ) " @@ -115,4 +117,49 @@ src_install() { fi pax-mark m "${EDGE_HOME}/msedge" + + # MS Edge includes channel information in the wrapper script, so rather than replace it like with Chromium, + # We'll inject additional logic to look for and use user-defined flags in /etc/msedge/*. + local wrapper="${ED}/${EDGE_HOME}/${PN}" + local inject="${T}/msedge-wrapper-flags.inc" + local wrapper_tmp="${T}/msedge-wrapper.new" + + cat > "${inject}" <<'EOF' + +# Allow the user to override command-line flags, bug #357629. +for f in /etc/msedge/*; do + case "${f}" in + *~|*.bak|*.old|*.swp|*.tmp|*/.*) continue ;; + esac + [[ -f "${f}" ]] && source "${f}" +done + +# Prefer user-defined MSEDGE_USER_FLAGS over MSEDGE_FLAGS from /etc/msedge/default. +MSEDGE_FLAGS=${MSEDGE_USER_FLAGS:-"$MSEDGE_FLAGS"} + +EOF + + { + # shebang and copyright notice; hasn't changed in 15 years. + head -n 5 "${wrapper}" || die + cat "${inject}" || die + tail -n +7 "${wrapper}" | \ + sed 's|^exec -a "\$0" "\$HERE/msedge" "\$@"$|exec -a "$0" "$HERE/msedge" ${MSEDGE_FLAGS} "$@"|' || die + } > "${wrapper_tmp}" || die "Failed to build wrapper with injected logic" + + cat "${wrapper_tmp}" > "${wrapper}" || die "Failed to update wrapper logic" + rm -f "${wrapper_tmp}" || die "Failed to clean temporary wrapper" + + grep -q 'exec -a "\$0" "\$HERE/msedge" ${MSEDGE_FLAGS} "\$@"' "${wrapper}" || + die "Failed to update wrapper exec flags" +} + +pkg_postinst() { + if use gtk4 && has_version x11-libs/gtk+; then + einfo "GTK4 has been selected, however x11-libs/gtk+ is also installed." + einfo "MS Edge will prefer GTK3 at runtime as a result; if you prefer GTK4," + einfo "please create \`/etc/msedge/default\` and set \`MSEDGE_FLAGS=\"--gtk-version=4\"\`" + fi + xdg_desktop_database_update + xdg_icon_cache_update } diff --git a/www-client/microsoft-edge/metadata.xml b/www-client/microsoft-edge/metadata.xml index c4f491930d33..bea07958aaa7 100644 --- a/www-client/microsoft-edge/metadata.xml +++ b/www-client/microsoft-edge/metadata.xml @@ -9,4 +9,8 @@ Microsoft Edge is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier. </longdescription> + <use> + <flag name="gtk3">Pull in <pkg>x11-libs/gtk+</pkg> for the user interface.</flag> + <flag name="gtk4">Pull in <pkg>gui-libs/gtk</pkg> for the user interface.</flag> + </use> </pkgmetadata> diff --git a/www-client/microsoft-edge/microsoft-edge-153.0.4234.32-r1.ebuild b/www-client/microsoft-edge/microsoft-edge-153.0.4234.32-r1.ebuild index 93f2298a62d0..9cc3c50f8821 100644 --- a/www-client/microsoft-edge/microsoft-edge-153.0.4234.32-r1.ebuild +++ b/www-client/microsoft-edge/microsoft-edge-153.0.4234.32-r1.ebuild @@ -22,8 +22,9 @@ LICENSE="microsoft-edge" SLOT="0" KEYWORDS="-* amd64" -IUSE="qt6" +IUSE="gtk3 +gtk4 qt6" RESTRICT="bindist mirror strip" +REQUIRED_USE="|| ( gtk3 gtk4 )" RDEPEND=" >=app-accessibility/at-spi2-core-2.46.0:2 @@ -43,7 +44,6 @@ RDEPEND=" sys-libs/glibc x11-libs/cairo x11-libs/gdk-pixbuf:2 - x11-libs/gtk+:3[X] x11-libs/libdrm x11-libs/libX11 x11-libs/libXcomposite @@ -56,6 +56,8 @@ RDEPEND=" x11-libs/libxshmfence x11-libs/pango x11-misc/xdg-utils + gtk3? ( x11-libs/gtk+:3[X] ) + gtk4? ( gui-libs/gtk:4[X] ) qt6? ( dev-qt/qtbase:6[gui,widgets] ) " @@ -115,4 +117,49 @@ src_install() { fi pax-mark m "${EDGE_HOME}/msedge" + + # MS Edge includes channel information in the wrapper script, so rather than replace it like with Chromium, + # We'll inject additional logic to look for and use user-defined flags in /etc/msedge/*. + local wrapper="${ED}/${EDGE_HOME}/${PN}" + local inject="${T}/msedge-wrapper-flags.inc" + local wrapper_tmp="${T}/msedge-wrapper.new" + + cat > "${inject}" <<'EOF' + +# Allow the user to override command-line flags, bug #357629. +for f in /etc/msedge/*; do + case "${f}" in + *~|*.bak|*.old|*.swp|*.tmp|*/.*) continue ;; + esac + [[ -f "${f}" ]] && source "${f}" +done + +# Prefer MSEDGE_USER_FLAGS from environment over MSEDGE_FLAGS from /etc/msedge/default. +MSEDGE_FLAGS=${MSEDGE_USER_FLAGS:-"$MSEDGE_FLAGS"} + +EOF + + { + # shebang and copyright notice; hasn't changed in 15 years. + head -n 5 "${wrapper}" || die + cat "${inject}" || die + tail -n +7 "${wrapper}" | \ + sed 's|^exec -a "\$0" "\$HERE/msedge" "\$@"$|exec -a "$0" "$HERE/msedge" ${MSEDGE_FLAGS} "$@"|' || die + } > "${wrapper_tmp}" || die "Failed to build wrapper with injected logic" + + cat "${wrapper_tmp}" > "${wrapper}" || die "Failed to update wrapper logic" + rm -f "${wrapper_tmp}" || die "Failed to clean temporary wrapper" + + grep -q 'exec -a "\$0" "\$HERE/msedge" ${MSEDGE_FLAGS} "\$@"' "${wrapper}" || + die "Failed to update wrapper exec flags" +} + +pkg_postinst() { + if use gtk4 && has_version x11-libs/gtk+; then + einfo "GTK4 has been selected, however x11-libs/gtk+ is also installed." + einfo "MS Edge will prefer GTK3 at runtime as a result; if you prefer GTK4," + einfo "please create \`/etc/msedge/default\` and set \`MSEDGE_FLAGS=\"--gtk-version=4\"\`" + fi + xdg_desktop_database_update + xdg_icon_cache_update } |
