From 1dc5948cdac2e8b1be43c9170fbec8f91c41ea1e Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Thu, 6 Mar 2025 12:49:47 -0700 Subject: [PATCH 1/2] pipewire: fix build for FreeBSD - alsa-lib being present (detected during configure) results in the inclusion of sources which use linux-specific errno values - revive several isLinux configuration predicates --- .../libraries/pipewire/default.nix | 75 +++++++++++++------ 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix index 7693d9866569..e09ba063e80f 100644 --- a/pkgs/development/libraries/pipewire/default.nix +++ b/pkgs/development/libraries/pipewire/default.nix @@ -5,9 +5,12 @@ python3, meson, ninja, + freebsd, elogind, + libinotify-kqueue, + epoll-shim, systemd, - enableSystemd ? true, # enableSystemd=false maintained by maintainers.qyliss. + enableSystemd ? stdenv.hostPlatform.isLinux, # enableSystemd=false maintained by maintainers.qyliss. pkg-config, docutils, doxygen, @@ -54,7 +57,10 @@ libcanberra, xorg, libmysofa, - ffadoSupport ? x11Support && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform, + ffadoSupport ? + x11Support + && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform + && stdenv.hostPlatform.isLinux, ffado, libselinux, libebur128, @@ -65,6 +71,9 @@ let webrtc-audio-processing_1 webrtc-audio-processing ]; + + bluezSupport = stdenv.hostPlatform.isLinux; + modemmanagerSupport = stdenv.hostPlatform.isLinux; in stdenv.mkDerivation (finalAttrs: { @@ -109,43 +118,43 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ - alsa-lib - bluez dbus - fdk_aac ffmpeg fftwFloat glib gst_all_1.gst-plugins-base gst_all_1.gstreamer - libcamera libebur128 libjack2 - libfreeaptx - liblc3 libmysofa libopus libpulseaudio libusb1 - libselinux libsndfile lilv - modemmanager ncurses readline - sbc ] ++ ( if enableSystemd then [ systemd ] - else + else if stdenv.hostPlatform.isLinux then [ elogind udev ] + else + [ ] ) + ++ lib.optionals stdenv.hostPlatform.isFreeBSD [ + libinotify-kqueue + epoll-shim + freebsd.libstdthreads + ] ++ lib.take 1 webrtc-audio-processings + ++ lib.optional stdenv.hostPlatform.isLinux alsa-lib ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform ldacbt) ldacbt + ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform libcamera) libcamera ++ lib.optional zeroconfSupport avahi ++ lib.optional raopSupport openssl ++ lib.optional rocSupport roc-toolkit @@ -159,19 +168,30 @@ stdenv.mkDerivation (finalAttrs: { xorg.libX11 xorg.libXfixes ] - ++ lib.optional ffadoSupport ffado; + ++ lib.optionals bluezSupport [ + bluez + libfreeaptx + liblc3 + sbc + fdk_aac + ] + ++ lib.optional ffadoSupport ffado + ++ lib.optional stdenv.hostPlatform.isLinux libselinux + ++ lib.optional modemmanagerSupport modemmanager; # Valgrind binary is required for running one optional test. nativeCheckInputs = lib.optional (lib.meta.availableOn stdenv.hostPlatform valgrind) valgrind; mesonFlags = [ + (lib.mesonEnable "pipewire-alsa" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "alsa" stdenv.hostPlatform.isLinux) (lib.mesonEnable "docs" true) (lib.mesonOption "udevrulesdir" "lib/udev/rules.d") (lib.mesonEnable "installed_tests" true) (lib.mesonOption "installed_test_prefix" (placeholder "installedTests")) (lib.mesonOption "libjack-path" "${placeholder "jack"}/lib") (lib.mesonEnable "echo-cancel-webrtc" (webrtc-audio-processings != [ ])) - (lib.mesonEnable "libcamera" true) + (lib.mesonEnable "libcamera" (lib.meta.availableOn stdenv.hostPlatform libcamera)) (lib.mesonEnable "libffado" ffadoSupport) (lib.mesonEnable "roc" rocSupport) (lib.mesonEnable "libpulse" true) @@ -179,21 +199,28 @@ stdenv.mkDerivation (finalAttrs: { (lib.mesonEnable "gstreamer" true) (lib.mesonEnable "gstreamer-device-provider" true) (lib.mesonOption "logind-provider" (if enableSystemd then "libsystemd" else "libelogind")) + (lib.mesonEnable "logind" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "selinux" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "avb" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "v4l2" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "pipewire-v4l2" stdenv.hostPlatform.isLinux) (lib.mesonEnable "systemd" enableSystemd) (lib.mesonEnable "systemd-system-service" enableSystemd) - (lib.mesonEnable "udev" (!enableSystemd)) + (lib.mesonEnable "udev" (!enableSystemd && stdenv.hostPlatform.isLinux)) (lib.mesonEnable "ffmpeg" true) (lib.mesonEnable "pw-cat-ffmpeg" true) - (lib.mesonEnable "bluez5" true) - (lib.mesonEnable "bluez5-backend-hsp-native" true) - (lib.mesonEnable "bluez5-backend-hfp-native" true) - (lib.mesonEnable "bluez5-backend-native-mm" true) - (lib.mesonEnable "bluez5-backend-ofono" true) - (lib.mesonEnable "bluez5-backend-hsphfpd" true) + (lib.mesonEnable "bluez5" bluezSupport) + (lib.mesonEnable "bluez5-backend-hsp-native" bluezSupport) + (lib.mesonEnable "bluez5-backend-hfp-native" bluezSupport) + (lib.mesonEnable "bluez5-backend-native-mm" bluezSupport) + (lib.mesonEnable "bluez5-backend-ofono" bluezSupport) + (lib.mesonEnable "bluez5-backend-hsphfpd" bluezSupport) # source code is not easily obtainable (lib.mesonEnable "bluez5-codec-lc3plus" false) - (lib.mesonEnable "bluez5-codec-lc3" true) - (lib.mesonEnable "bluez5-codec-ldac" (lib.meta.availableOn stdenv.hostPlatform ldacbt)) + (lib.mesonEnable "bluez5-codec-lc3" bluezSupport) + (lib.mesonEnable "bluez5-codec-ldac" ( + bluezSupport && (lib.meta.availableOn stdenv.hostPlatform ldacbt) + )) (lib.mesonEnable "opus" true) (lib.mesonOption "sysconfdir" "/etc") (lib.mesonEnable "raop" raopSupport) @@ -231,7 +258,7 @@ stdenv.mkDerivation (finalAttrs: { changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${finalAttrs.version}"; homepage = "https://pipewire.org/"; license = licenses.mit; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.freebsd; maintainers = with maintainers; [ kranzes k900 From b75c1897a02993e2c085efdc45b45a817b1bcc47 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Mon, 10 Mar 2025 01:41:29 -0700 Subject: [PATCH 2/2] pipewire: hoist and clarify some dependency predicates --- pkgs/development/libraries/pipewire/default.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix index e09ba063e80f..a34e7779936f 100644 --- a/pkgs/development/libraries/pipewire/default.nix +++ b/pkgs/development/libraries/pipewire/default.nix @@ -10,7 +10,7 @@ libinotify-kqueue, epoll-shim, systemd, - enableSystemd ? stdenv.hostPlatform.isLinux, # enableSystemd=false maintained by maintainers.qyliss. + enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, # enableSystemd=false maintained by maintainers.qyliss. pkg-config, docutils, doxygen, @@ -60,7 +60,7 @@ ffadoSupport ? x11Support && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform - && stdenv.hostPlatform.isLinux, + && lib.meta.availableOn stdenv.hostPlatform ffado, ffado, libselinux, libebur128, @@ -73,7 +73,9 @@ let ]; bluezSupport = stdenv.hostPlatform.isLinux; - modemmanagerSupport = stdenv.hostPlatform.isLinux; + modemmanagerSupport = lib.meta.availableOn stdenv.hostPlatform modemmanager; + libcameraSupport = lib.meta.availableOn stdenv.hostPlatform libcamera; + ldacbtSupport = lib.meta.availableOn stdenv.hostPlatform ldacbt; in stdenv.mkDerivation (finalAttrs: { @@ -153,8 +155,8 @@ stdenv.mkDerivation (finalAttrs: { ] ++ lib.take 1 webrtc-audio-processings ++ lib.optional stdenv.hostPlatform.isLinux alsa-lib - ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform ldacbt) ldacbt - ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform libcamera) libcamera + ++ lib.optional ldacbtSupport ldacbt + ++ lib.optional libcameraSupport libcamera ++ lib.optional zeroconfSupport avahi ++ lib.optional raopSupport openssl ++ lib.optional rocSupport roc-toolkit @@ -218,9 +220,7 @@ stdenv.mkDerivation (finalAttrs: { # source code is not easily obtainable (lib.mesonEnable "bluez5-codec-lc3plus" false) (lib.mesonEnable "bluez5-codec-lc3" bluezSupport) - (lib.mesonEnable "bluez5-codec-ldac" ( - bluezSupport && (lib.meta.availableOn stdenv.hostPlatform ldacbt) - )) + (lib.mesonEnable "bluez5-codec-ldac" (bluezSupport && ldacbtSupport)) (lib.mesonEnable "opus" true) (lib.mesonOption "sysconfdir" "/etc") (lib.mesonEnable "raop" raopSupport)