pipewire: fix build for FreeBSD (#387712)

authored by K900 and committed by GitHub 482a6cc2 83e2dec6

+52 -25
+52 -25
pkgs/development/libraries/pipewire/default.nix
··· 6 6 python3, 7 7 meson, 8 8 ninja, 9 + freebsd, 9 10 elogind, 11 + libinotify-kqueue, 12 + epoll-shim, 10 13 systemd, 11 - enableSystemd ? true, # enableSystemd=false maintained by maintainers.qyliss. 14 + enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, # enableSystemd=false maintained by maintainers.qyliss. 12 15 pkg-config, 13 16 docutils, 14 17 doxygen, ··· 55 58 libcanberra, 56 59 xorg, 57 60 libmysofa, 58 - ffadoSupport ? x11Support && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform, 61 + ffadoSupport ? 62 + x11Support 63 + && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform 64 + && lib.meta.availableOn stdenv.hostPlatform ffado, 59 65 ffado, 60 66 libselinux, 61 67 libebur128, ··· 66 72 webrtc-audio-processing_1 67 73 webrtc-audio-processing 68 74 ]; 75 + 76 + bluezSupport = stdenv.hostPlatform.isLinux; 77 + modemmanagerSupport = lib.meta.availableOn stdenv.hostPlatform modemmanager; 78 + libcameraSupport = lib.meta.availableOn stdenv.hostPlatform libcamera; 79 + ldacbtSupport = lib.meta.availableOn stdenv.hostPlatform ldacbt; 69 80 in 70 81 71 82 stdenv.mkDerivation (finalAttrs: { ··· 111 122 112 123 buildInputs = 113 124 [ 114 - alsa-lib 115 - bluez 116 125 dbus 117 - fdk_aac 118 126 ffmpeg 119 127 fftwFloat 120 128 glib 121 129 gst_all_1.gst-plugins-base 122 130 gst_all_1.gstreamer 123 - libcamera 124 131 libebur128 125 132 libjack2 126 - libfreeaptx 127 - liblc3 128 133 libmysofa 129 134 libopus 130 135 libpulseaudio 131 136 libusb1 132 - libselinux 133 137 libsndfile 134 138 lilv 135 - modemmanager 136 139 ncurses 137 140 readline 138 - sbc 139 141 ] 140 142 ++ ( 141 143 if enableSystemd then 142 144 [ systemd ] 143 - else 145 + else if stdenv.hostPlatform.isLinux then 144 146 [ 145 147 elogind 146 148 udev 147 149 ] 150 + else 151 + [ ] 148 152 ) 153 + ++ lib.optionals stdenv.hostPlatform.isFreeBSD [ 154 + libinotify-kqueue 155 + epoll-shim 156 + freebsd.libstdthreads 157 + ] 149 158 ++ lib.take 1 webrtc-audio-processings 150 - ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform ldacbt) ldacbt 159 + ++ lib.optional stdenv.hostPlatform.isLinux alsa-lib 160 + ++ lib.optional ldacbtSupport ldacbt 161 + ++ lib.optional libcameraSupport libcamera 151 162 ++ lib.optional zeroconfSupport avahi 152 163 ++ lib.optional raopSupport openssl 153 164 ++ lib.optional rocSupport roc-toolkit ··· 161 172 xorg.libX11 162 173 xorg.libXfixes 163 174 ] 164 - ++ lib.optional ffadoSupport ffado; 175 + ++ lib.optionals bluezSupport [ 176 + bluez 177 + libfreeaptx 178 + liblc3 179 + sbc 180 + fdk_aac 181 + ] 182 + ++ lib.optional ffadoSupport ffado 183 + ++ lib.optional stdenv.hostPlatform.isLinux libselinux 184 + ++ lib.optional modemmanagerSupport modemmanager; 165 185 166 186 # Valgrind binary is required for running one optional test. 167 187 nativeCheckInputs = lib.optional (lib.meta.availableOn stdenv.hostPlatform valgrind) valgrind; 168 188 169 189 mesonFlags = [ 190 + (lib.mesonEnable "pipewire-alsa" stdenv.hostPlatform.isLinux) 191 + (lib.mesonEnable "alsa" stdenv.hostPlatform.isLinux) 170 192 (lib.mesonEnable "docs" true) 171 193 (lib.mesonOption "udevrulesdir" "lib/udev/rules.d") 172 194 (lib.mesonEnable "installed_tests" true) 173 195 (lib.mesonOption "installed_test_prefix" (placeholder "installedTests")) 174 196 (lib.mesonOption "libjack-path" "${placeholder "jack"}/lib") 175 197 (lib.mesonEnable "echo-cancel-webrtc" (webrtc-audio-processings != [ ])) 176 - (lib.mesonEnable "libcamera" true) 198 + (lib.mesonEnable "libcamera" (lib.meta.availableOn stdenv.hostPlatform libcamera)) 177 199 (lib.mesonEnable "libffado" ffadoSupport) 178 200 (lib.mesonEnable "roc" rocSupport) 179 201 (lib.mesonEnable "libpulse" true) ··· 181 203 (lib.mesonEnable "gstreamer" true) 182 204 (lib.mesonEnable "gstreamer-device-provider" true) 183 205 (lib.mesonOption "logind-provider" (if enableSystemd then "libsystemd" else "libelogind")) 206 + (lib.mesonEnable "logind" stdenv.hostPlatform.isLinux) 207 + (lib.mesonEnable "selinux" stdenv.hostPlatform.isLinux) 208 + (lib.mesonEnable "avb" stdenv.hostPlatform.isLinux) 209 + (lib.mesonEnable "v4l2" stdenv.hostPlatform.isLinux) 210 + (lib.mesonEnable "pipewire-v4l2" stdenv.hostPlatform.isLinux) 184 211 (lib.mesonEnable "systemd" enableSystemd) 185 212 (lib.mesonEnable "systemd-system-service" enableSystemd) 186 - (lib.mesonEnable "udev" (!enableSystemd)) 213 + (lib.mesonEnable "udev" (!enableSystemd && stdenv.hostPlatform.isLinux)) 187 214 (lib.mesonEnable "ffmpeg" true) 188 215 (lib.mesonEnable "pw-cat-ffmpeg" true) 189 - (lib.mesonEnable "bluez5" true) 190 - (lib.mesonEnable "bluez5-backend-hsp-native" true) 191 - (lib.mesonEnable "bluez5-backend-hfp-native" true) 192 - (lib.mesonEnable "bluez5-backend-native-mm" true) 193 - (lib.mesonEnable "bluez5-backend-ofono" true) 194 - (lib.mesonEnable "bluez5-backend-hsphfpd" true) 216 + (lib.mesonEnable "bluez5" bluezSupport) 217 + (lib.mesonEnable "bluez5-backend-hsp-native" bluezSupport) 218 + (lib.mesonEnable "bluez5-backend-hfp-native" bluezSupport) 219 + (lib.mesonEnable "bluez5-backend-native-mm" bluezSupport) 220 + (lib.mesonEnable "bluez5-backend-ofono" bluezSupport) 221 + (lib.mesonEnable "bluez5-backend-hsphfpd" bluezSupport) 195 222 # source code is not easily obtainable 196 223 (lib.mesonEnable "bluez5-codec-lc3plus" false) 197 - (lib.mesonEnable "bluez5-codec-lc3" true) 198 - (lib.mesonEnable "bluez5-codec-ldac" (lib.meta.availableOn stdenv.hostPlatform ldacbt)) 224 + (lib.mesonEnable "bluez5-codec-lc3" bluezSupport) 225 + (lib.mesonEnable "bluez5-codec-ldac" (bluezSupport && ldacbtSupport)) 199 226 (lib.mesonEnable "opus" true) 200 227 (lib.mesonOption "sysconfdir" "/etc") 201 228 (lib.mesonEnable "raop" raopSupport) ··· 233 260 changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${finalAttrs.version}"; 234 261 homepage = "https://pipewire.org/"; 235 262 license = licenses.mit; 236 - platforms = platforms.linux; 263 + platforms = platforms.linux ++ platforms.freebsd; 237 264 maintainers = with maintainers; [ 238 265 kranzes 239 266 k900