diff options
Diffstat (limited to 'www-client/firefox')
-rw-r--r-- | www-client/firefox/files/firefox-wayland.sh | 7 | ||||
-rw-r--r-- | www-client/firefox/files/firefox-x11.sh | 7 | ||||
-rw-r--r-- | www-client/firefox/files/firefox.sh | 105 | ||||
-rw-r--r-- | www-client/firefox/firefox-74.0-r2.ebuild | 62 |
4 files changed, 174 insertions, 7 deletions
diff --git a/www-client/firefox/files/firefox-wayland.sh b/www-client/firefox/files/firefox-wayland.sh new file mode 100644 index 000000000000..44280250fb9d --- /dev/null +++ b/www-client/firefox/files/firefox-wayland.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# +# Run Mozilla Firefox under Wayland +# +export MOZ_ENABLE_WAYLAND=1 +exec @PREFIX@/bin/firefox "$@" diff --git a/www-client/firefox/files/firefox-x11.sh b/www-client/firefox/files/firefox-x11.sh new file mode 100644 index 000000000000..756556690cf3 --- /dev/null +++ b/www-client/firefox/files/firefox-x11.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# +# Run Mozilla Firefox on X11 +# +export MOZ_DISABLE_WAYLAND=1 +exec @PREFIX@/bin/firefox "$@" diff --git a/www-client/firefox/files/firefox.sh b/www-client/firefox/files/firefox.sh new file mode 100644 index 000000000000..d942087ffa86 --- /dev/null +++ b/www-client/firefox/files/firefox.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +## +## Usage: +## +## $ firefox +## +## This script is meant to run Mozilla Firefox in Gentoo. + +cmdname=$(basename "$0") + +## +## Variables +## +MOZ_ARCH=$(uname -m) +case ${MOZ_ARCH} in + x86_64|s390x|sparc64) + MOZ_LIB_DIR="@PREFIX@/lib64" + SECONDARY_LIB_DIR="@PREFIX@/lib" + ;; + *) + MOZ_LIB_DIR="@PREFIX@/lib" + SECONDARY_LIB_DIR="@PREFIX@/lib64" + ;; +esac + +MOZ_FIREFOX_FILE="firefox" + +if [[ ! -r ${MOZ_LIB_DIR}/firefox/${MOZ_FIREFOX_FILE} ]]; then + if [[ ! -r ${SECONDARY_LIB_DIR}/firefox/${MOZ_FIREFOX_FILE} ]]; then + echo "Error: ${MOZ_LIB_DIR}/firefox/${MOZ_FIREFOX_FILE} not found" >&2 + if [[ -d $SECONDARY_LIB_DIR ]]; then + echo " ${SECONDARY_LIB_DIR}/firefox/${MOZ_FIREFOX_FILE} not found" >&2 + fi + exit 1 + fi + MOZ_LIB_DIR="$SECONDARY_LIB_DIR" +fi +MOZILLA_FIVE_HOME="${MOZ_LIB_DIR}/firefox" +MOZ_EXTENSIONS_PROFILE_DIR="${HOME}/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" +MOZ_PROGRAM="${MOZILLA_FIVE_HOME}/${MOZ_FIREFOX_FILE}" +DESKTOP_FILE="firefox" + +## +## Enable Wayland backend? +## +if @DEFAULT_WAYLAND@ && [[ -z ${MOZ_DISABLE_WAYLAND} ]]; then + if [[ -n "$WAYLAND_DISPLAY" ]]; then + DESKTOP_FILE="firefox-wayland" + export MOZ_ENABLE_WAYLAND=1 + fi +elif [[ -n ${MOZ_DISABLE_WAYLAND} ]]; then + DESKTOP_FILE="firefox-x11" +fi + +## +## Use D-Bus remote exclusively when there's Wayland display. +## +if [[ -n "${WAYLAND_DISPLAY}" ]]; then + export MOZ_DBUS_REMOTE=1 +fi + +## +## Make sure that we set the plugin path +## +MOZ_PLUGIN_DIR="plugins" + +if [[ -n "${MOZ_PLUGIN_PATH}" ]]; then + MOZ_PLUGIN_PATH=${MOZ_PLUGIN_PATH}:${MOZ_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR} +else + MOZ_PLUGIN_PATH=${MOZ_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR} +fi + +if [[ -d "${SECONDARY_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR}" ]]; then + MOZ_PLUGIN_PATH=${MOZ_PLUGIN_PATH}:${SECONDARY_LIB_DIR}/mozilla/${MOZ_PLUGIN_DIR} +fi + +export MOZ_PLUGIN_PATH + +## +## Set MOZ_APP_LAUNCHER for gnome-session +## +export MOZ_APP_LAUNCHER="@PREFIX@/bin/${cmdname}" + +## +## Disable the GNOME crash dialog, Moz has it's own +## +if [[ "$XDG_CURRENT_DESKTOP" == "GNOME" ]]; then + GNOME_DISABLE_CRASH_DIALOG=1 + export GNOME_DISABLE_CRASH_DIALOG +fi + +# Don't throw "old profile" dialog box. +export MOZ_ALLOW_DOWNGRADE=1 + +## +## Route to the correct .desktop file to get proper +## names and contect menus +## +if [[ $@ != *"--name "* ]]; then + set -- "--name ${DESKTOP_FILE}" "$@" +fi + +# Run the browser +exec ${MOZ_PROGRAM} $@ diff --git a/www-client/firefox/firefox-74.0-r2.ebuild b/www-client/firefox/firefox-74.0-r2.ebuild index f59e1224f9fe..bd04eca22ba0 100644 --- a/www-client/firefox/firefox-74.0-r2.ebuild +++ b/www-client/firefox/firefox-74.0-r2.ebuild @@ -757,7 +757,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" @@ -765,12 +764,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" ]] && \ |