commit:     07dd2bd52d9a752cfad41d95efc2386c253371fa
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 30 12:17:39 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 30 12:18:40 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07dd2bd5

www-client/firefox: use wrapper

Backport of commit de3255e329bf23cd3e8247e475e75b374e53aec9.

Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 www-client/firefox/firefox-68.6.0-r2.ebuild | 62 +++++++++++++++++++++++++----
 1 file changed, 55 insertions(+), 7 deletions(-)

diff --git a/www-client/firefox/firefox-68.6.0-r2.ebuild 
b/www-client/firefox/firefox-68.6.0-r2.ebuild
index 8aedb7bf41c..a10f2faf8a7 100644
--- a/www-client/firefox/firefox-68.6.0-r2.ebuild
+++ b/www-client/firefox/firefox-68.6.0-r2.ebuild
@@ -738,7 +738,6 @@ PROFILE_EOF
        done
        # Install a 48x48 icon into /usr/share/pixmaps for legacy DEs
        newicon "${icon_path}/default48.png" "${icon}.png"
-       newmenu "${FILESDIR}/icon/${PN}-r1.desktop" "${PN}.desktop"
 
        # Add StartupNotify=true bug 237317
        local startup_notify="false"
@@ -746,12 +745,61 @@ PROFILE_EOF
                startup_notify="true"
        fi
 
-       sed -i \
-               -e "s:@NAME@:${name}:" \
-               -e "s:@EXEC@:firefox:" \
-               -e "s:@ICON@:${icon}:" \
-               -e "s:@STARTUP_NOTIFY@:${startup_notify}:" \
-               "${ED%/}/usr/share/applications/${PN}.desktop" || die
+       local display_protocols="auto X11" use_wayland="false"
+       if use wayland ; then
+               display_protocols+=" Wayland"
+               use_wayland="true"
+       fi
+
+       local app_name desktop_filename display_protocol exec_command
+       for display_protocol in ${display_protocols} ; do
+               app_name="${name} on ${display_protocol}"
+               desktop_filename="${PN}-${display_protocol,,}.desktop"
+
+               case ${display_protocol} in
+                       Wayland)
+                               exec_command='firefox-wayland --name 
firefox-wayland'
+                               newbin "${FILESDIR}"/firefox-wayland.sh 
firefox-wayland
+                               ;;
+                       X11)
+                               exec_command='firefox-x11 --name firefox-x11'
+                               if use wayland ; then
+                                       # Only needed when there's actually a 
choice
+                                       newbin "${FILESDIR}"/firefox-x11.sh 
firefox-x11
+                               fi
+                               ;;
+                       *)
+                               app_name="${name}"
+                               desktop_filename="${PN}.desktop"
+                               exec_command='firefox'
+                               ;;
+               esac
+
+               newmenu "${FILESDIR}/icon/${PN}-r1.desktop" 
"${desktop_filename}"
+               sed -i \
+                       -e "s:@NAME@:${app_name}:" \
+                       -e "s:@EXEC@:${exec_command}:" \
+                       -e "s:@ICON@:${icon}:" \
+                       -e "s:@STARTUP_NOTIFY@:${startup_notify}:" \
+                       "${ED%/}/usr/share/applications/${desktop_filename}" || 
die
+       done
+
+       rm "${ED%/}"/usr/bin/firefox || die
+       newbin "${FILESDIR}"/firefox.sh firefox
+
+       local wrapper
+       for wrapper in \
+               "${ED%/}"/usr/bin/firefox \
+               "${ED%/}"/usr/bin/firefox-x11 \
+               "${ED%/}"/usr/bin/firefox-wayland \
+       ; do
+               [[ ! -f "${wrapper}" ]] && continue
+
+               sed -i \
+                       -e "s:@PREFIX@:${EPREFIX%/}/usr:" \
+                       -e "s:@DEFAULT_WAYLAND@:${use_wayland}:" \
+                       "${wrapper}" || die
+       done
 
        # Don't install llvm-symbolizer from sys-devel/llvm package
        [[ -f "${ED%/}${MOZILLA_FIVE_HOME}/llvm-symbolizer" ]] && \

Reply via email to