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

View File

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

View File

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