about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/browsers/firefox
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2020-10-06 12:10:08 +0200
committerAlyssa Ross <hi@alyssa.is>2020-11-27 13:28:55 +0000
commit626673b6d773dbbb3b81208cf7a5ced407b80a85 (patch)
tree786df5cd778e478eb889bafb685020ad28576d1e /nixpkgs/pkgs/applications/networking/browsers/firefox
parenta6d02c7dc663b40537fdd3f64a54055de7429d9d (diff)
downloadnixlib-626673b6d773dbbb3b81208cf7a5ced407b80a85.tar
nixlib-626673b6d773dbbb3b81208cf7a5ced407b80a85.tar.gz
nixlib-626673b6d773dbbb3b81208cf7a5ced407b80a85.tar.bz2
nixlib-626673b6d773dbbb3b81208cf7a5ced407b80a85.tar.lz
nixlib-626673b6d773dbbb3b81208cf7a5ced407b80a85.tar.xz
nixlib-626673b6d773dbbb3b81208cf7a5ced407b80a85.tar.zst
nixlib-626673b6d773dbbb3b81208cf7a5ced407b80a85.zip
firefox: ensure pipewire is only enabled with wayland & webrtc
This ensures that we aren't applying any of the experiemental pipewire
patches when the dependencies aren't enabled. As of now pipewire only
works with wayland and webrtc. If either of them are not activated we
can't build with pipewireSupport and we should not.

(cherry picked from commit a5a01d56a20ea7bfbc4c0e3b376f95d3de467a4d)
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/browsers/firefox')
-rw-r--r--nixpkgs/pkgs/applications/networking/browsers/firefox/common.nix16
1 files changed, 11 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/applications/networking/browsers/firefox/common.nix b/nixpkgs/pkgs/applications/networking/browsers/firefox/common.nix
index 790926ad8a96..d6e1f39bc0dc 100644
--- a/nixpkgs/pkgs/applications/networking/browsers/firefox/common.nix
+++ b/nixpkgs/pkgs/applications/networking/browsers/firefox/common.nix
@@ -22,7 +22,8 @@
 , ffmpegSupport ? true
 , gtk3Support ? true, gtk2, gtk3, wrapGAppsHook
 , gssSupport ? true, kerberos
-, waylandSupport ? gtk3Support, libxkbcommon, pipewire
+, waylandSupport ? gtk3Support, libxkbcommon
+, pipewireSupport ? waylandSupport && webrtcSupport, pipewire
 
 ## privacy-related options
 
@@ -69,6 +70,7 @@
 }:
 
 assert stdenv.cc.libc or null != null;
+assert pipewireSupport -> !waylandSupport || !webrtcSupport -> throw "pipewireSupport requires both wayland and webrtc support.";
 
 let
   flag = tf: x: [(if tf then "--enable-${x}" else "--disable-${x}")];
@@ -84,6 +86,7 @@ let
   execdir = if stdenv.isDarwin
             then "/Applications/${binaryNameCapitalized}.app/Contents/MacOS"
             else "/bin";
+
 in
 
 stdenv.mkDerivation ({
@@ -94,12 +97,12 @@ stdenv.mkDerivation ({
 
   patches = [
     ./env_var_for_system_dir.patch
+  ] ++ lib.optional pipewireSupport
     (fetchpatch {
       # https://src.fedoraproject.org/rpms/firefox/blob/master/f/firefox-pipewire-0-3.patch
       url = "https://src.fedoraproject.org/rpms/firefox/raw/e99b683a352cf5b2c9ff198756859bae408b5d9d/f/firefox-pipewire-0-3.patch";
       sha256 = "0qc62di5823r7ly2lxkclzj9rhg2z7ms81igz44nv0fzv3dszdab";
     })
-  ]
   ++ patches;
 
 
@@ -129,7 +132,8 @@ stdenv.mkDerivation ({
   ++ lib.optional  gtk3Support gtk3
   ++ lib.optional  waylandSupport libxkbcommon
   ++ lib.optional  gssSupport kerberos
-  ++ lib.optionals waylandSupport [ libxkbcommon pipewire ]
+  ++ lib.optionals waylandSupport [ libxkbcommon ]
+  ++ lib.optionals pipewireSupport [ pipewire ]
   ++ lib.optionals stdenv.isDarwin [ CoreMedia ExceptionHandling Kerberos
                                      AVFoundation MediaToolbox CoreLocation
                                      Foundation libobjc AddressBook cups ];
@@ -143,8 +147,10 @@ stdenv.mkDerivation ({
 
   postPatch = ''
     rm -rf obj-x86_64-pc-linux-gnu
-
-    # needed for enabling webrtc+pipewire
+  '' + lib.optionalString pipewireSupport ''
+    # substitute the /usr/include/ lines for the libraries that pipewire provides.
+    # The patch we pick from fedora only contains the generated moz.build files
+    # which hardcode the dependency paths instead of running pkg_config.
     substituteInPlace \
       media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build \
       --replace /usr/include ${pipewire.dev}/include