Merge pull request #55119 from andir/firefox-wayland

Firefox add support for native wayland backend
This commit is contained in:
Florian Klink 2019-02-12 00:45:42 +01:00 committed by GitHub
commit c569643f4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -22,6 +22,7 @@
, pulseaudioSupport ? stdenv.isLinux, libpulseaudio
, ffmpegSupport ? true
, gtk3Support ? true, gtk2, gtk3, wrapGAppsHook
, waylandSupport ? true, libxkbcommon
, gssSupport ? true, kerberos
## privacy-related options
@ -74,7 +75,7 @@ let
flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
default-toolkit = if stdenv.isDarwin then "cairo-cocoa"
else "cairo-gtk${if gtk3Support then "3" else "2"}";
else "cairo-gtk${if gtk3Support then "3${lib.optionalString waylandSupport "-wayland"}" else "2"}";
binaryName = if isIceCatLike then "icecat" else "firefox";
binaryNameCapitalized = lib.toUpper (lib.substring 0 1 binaryName) + lib.substring 1 (-1) binaryName;
@ -124,6 +125,7 @@ stdenv.mkDerivation rec {
++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
++ lib.optional gtk3Support gtk3
++ lib.optional gssSupport kerberos
++ lib.optional waylandSupport libxkbcommon
++ lib.optionals stdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos
AVFoundation MediaToolbox CoreLocation
Foundation libobjc AddressBook cups ];

View file

@ -26,8 +26,11 @@ let
, icon ? browserName
, extraPlugins ? []
, extraNativeMessagingHosts ? []
, gdkWayland ? false
}:
assert gdkWayland -> (browser ? gtk3); # Can only use the wayland backend if gtk3 is being used
let
cfg = config.${browserName} or {};
enableAdobeFlash = cfg.enableAdobeFlash or false;
@ -86,7 +89,7 @@ let
exec = "${browserName}${nameSuffix} %U";
inherit icon;
comment = "";
desktopName = "${desktopName}${nameSuffix}";
desktopName = "${desktopName}${nameSuffix}${lib.optionalString gdkWayland " (Wayland)"}";
genericName = "Web Browser";
categories = "Application;Network;WebBrowser;";
mimeType = stdenv.lib.concatStringsSep ";" [
@ -124,7 +127,9 @@ let
--suffix PATH ':' "$out${browser.execdir or "/bin"}" \
--set MOZ_APP_LAUNCHER "${browserName}${nameSuffix}" \
--set MOZ_SYSTEM_DIR "$out/lib/mozilla" \
${lib.optionalString (browser ? gtk3)
${lib.optionalString gdkWayland ''
--set GDK_BACKEND "wayland" \
''}${lib.optionalString (browser ? gtk3)
''--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--suffix XDG_DATA_DIRS : '${gnome3.defaultIconTheme}/share'
''

View file

@ -17240,6 +17240,7 @@ in
icecat-unwrapped = firefoxPackages.icecat;
firefox = wrapFirefox firefox-unwrapped { };
firefox-wayland = wrapFirefox firefox-unwrapped { gdkWayland = true; };
firefox-esr-52 = wrapFirefox firefox-esr-52-unwrapped { };
firefox-esr-60 = wrapFirefox firefox-esr-60-unwrapped { };
firefox-esr = firefox-esr-60;