diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/pipewire')
5 files changed, 412 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/pipewire/0.2.nix b/nixpkgs/pkgs/development/libraries/pipewire/0.2.nix new file mode 100644 index 000000000000..cf2448bddfcb --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/pipewire/0.2.nix @@ -0,0 +1,54 @@ +{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, doxygen, graphviz +, glib, dbus, gst_all_1, alsa-lib, ffmpeg_4, libjack2, udev, libva, xorg +, sbc, SDL2, makeFontsConf +}: + +let + fontsConf = makeFontsConf { + fontDirectories = [ ]; + }; +in stdenv.mkDerivation rec { + pname = "pipewire"; + version = "0.2.7"; + + src = fetchFromGitHub { + owner = "PipeWire"; + repo = "pipewire"; + rev = version; + sha256 = "1q5wrqnhhs6r49p8yvkw1pl0cnsd4rndxy4h5lvdydwgf1civcwc"; + }; + + outputs = [ "out" "lib" "dev" "doc" ]; + + nativeBuildInputs = [ + meson ninja pkg-config doxygen graphviz + ]; + buildInputs = [ + glib dbus gst_all_1.gst-plugins-base gst_all_1.gstreamer + alsa-lib ffmpeg_4 libjack2 udev libva xorg.libX11 sbc SDL2 + ]; + + # Workaround build on gcc-10+ and clang11+: + # spa/plugins/bluez5/libspa-bluez5.so.p/bluez5-monitor.c.o:(.bss+0x0): + # multiple definition of `spa_a2dp_sink_factory' + env.NIX_CFLAGS_COMPILE = toString [ "-fcommon" ]; + + mesonFlags = [ + "-Ddocs=true" + "-Dgstreamer=enabled" + ]; + + PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user"; + + FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file + + doCheck = true; + + meta = with lib; { + description = "Server and user space API to deal with multimedia pipelines"; + homepage = "https://pipewire.org/"; + license = licenses.lgpl21; + platforms = platforms.linux; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/pipewire/0060-libjack-path.patch b/nixpkgs/pkgs/development/libraries/pipewire/0060-libjack-path.patch new file mode 100644 index 000000000000..7fde3dbb8faa --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/pipewire/0060-libjack-path.patch @@ -0,0 +1,26 @@ +diff --git a/src/modules/meson.build b/src/modules/meson.build +index 5d2dc9984..35f5773aa 100644 +--- a/src/modules/meson.build ++++ b/src/modules/meson.build +@@ -169,6 +169,7 @@ if build_module_jack_tunnel + install_dir : modules_install_dir, + install_rpath: modules_install_dir, + dependencies : [mathlib, dl_lib, pipewire_dep], ++ c_args: '-DNIXPKGS_LIBJACK_PATH="@0@"'.format(jack_dep.get_variable('libdir')) + ) + build_module_jackdbus_detect = dbus_dep.found() + if build_module_jackdbus_detect +diff --git a/src/modules/module-jack-tunnel/weakjack.h b/src/modules/module-jack-tunnel/weakjack.h +index 42580f798..e7aadd3cc 100644 +--- a/src/modules/module-jack-tunnel/weakjack.h ++++ b/src/modules/module-jack-tunnel/weakjack.h +@@ -164,8 +164,7 @@ static inline int weakjack_load(struct weakjack *jack, const char *lib) + + search_dirs = getenv("LIBJACK_PATH"); + if (!search_dirs) +- search_dirs = PREFIX "/lib64/:" PREFIX "/lib/:" +- "/usr/lib64/:/usr/lib/:" LIBDIR; ++ search_dirs = NIXPKGS_LIBJACK_PATH; + + while ((p = pw_split_walk(search_dirs, ":", &len, &state))) { + int pathlen; diff --git a/nixpkgs/pkgs/development/libraries/pipewire/0070-installed-tests-path.patch b/nixpkgs/pkgs/development/libraries/pipewire/0070-installed-tests-path.patch new file mode 100644 index 000000000000..b2bcb421befb --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/pipewire/0070-installed-tests-path.patch @@ -0,0 +1,29 @@ +diff --git a/meson.build b/meson.build +index 2107c19ec..20ccdfd9f 100644 +--- a/meson.build ++++ b/meson.build +@@ -380,8 +380,8 @@ lilv_lib = dependency('lilv-0', required: get_option('lv2')) + summary({'lilv (for lv2 plugins)': lilv_lib.found()}, bool_yn: true) + cdata.set('HAVE_LILV', lilv_lib.found()) + +-installed_tests_metadir = pipewire_datadir / 'installed-tests' / pipewire_name +-installed_tests_execdir = pipewire_libexecdir / 'installed-tests' / pipewire_name ++installed_tests_metadir = get_option('installed_test_prefix') / 'share' / 'installed-tests' / pipewire_name ++installed_tests_execdir = get_option('installed_test_prefix') / 'libexec' / 'installed-tests' / pipewire_name + installed_tests_enabled = get_option('installed_tests').allowed() + installed_tests_template = files('template.test.in') + +diff --git a/meson_options.txt b/meson_options.txt +index 961ae2a76..a36e9e45f 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -22,6 +22,9 @@ option('installed_tests', + description: 'Install manual and automated test executables', + type: 'feature', + value: 'disabled') ++option('installed_test_prefix', ++ description: 'Prefix for installed tests', ++ type: 'string') + option('gstreamer', + description: 'Build GStreamer plugins', + type: 'feature', diff --git a/nixpkgs/pkgs/development/libraries/pipewire/default.nix b/nixpkgs/pkgs/development/libraries/pipewire/default.nix new file mode 100644 index 000000000000..5d0ffee503b8 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/pipewire/default.nix @@ -0,0 +1,222 @@ +{ stdenv +, lib +, buildPackages +, fetchFromGitLab +, fetchpatch +, python3 +, meson +, ninja +, eudev +, systemd +, enableSystemd ? true +, pkg-config +, docutils +, doxygen +, graphviz +, glib +, dbus +, alsa-lib +, libjack2 +, libusb1 +, udev +, libsndfile +, vulkan-headers +, vulkan-loader +, webrtc-audio-processing +, webrtc-audio-processing_1 +, ncurses +, readline # meson can't find <7 as those versions don't have a .pc file +, lilv +, makeFontsConf +, callPackage +, nixosTests +, withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind +, valgrind +, libcameraSupport ? true +, libcamera +, libdrm +, gstreamerSupport ? true +, gst_all_1 +, ffmpegSupport ? true +, ffmpeg +, bluezSupport ? true +, bluez +, sbc +, libfreeaptx +, liblc3 +, fdk_aac +, libopus +, ldacbtSupport ? bluezSupport && lib.meta.availableOn stdenv.hostPlatform ldacbt +, ldacbt +, nativeHspSupport ? true +, nativeHfpSupport ? true +, nativeModemManagerSupport ? true +, modemmanager +, ofonoSupport ? true +, hsphfpdSupport ? true +, pulseTunnelSupport ? true +, libpulseaudio +, zeroconfSupport ? true +, avahi +, raopSupport ? true +, openssl +, rocSupport ? true +, roc-toolkit +, x11Support ? true +, libcanberra +, xorg +, mysofaSupport ? true +, libmysofa +, tinycompress +, ffadoSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform +, ffado +, libselinux +}: + +# Bluetooth codec only makes sense if general bluetooth enabled +assert ldacbtSupport -> bluezSupport; + +let + mesonEnableFeature = b: if b then "enabled" else "disabled"; + + self = stdenv.mkDerivation rec { + pname = "pipewire"; + version = "1.0.0"; + + outputs = [ + "out" + "jack" + "dev" + "doc" + "man" + "installedTests" + ]; + + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "pipewire"; + repo = "pipewire"; + rev = version; + sha256 = "sha256-mfnMluxJAxDbB6JlIM6HJ0zg7e1q3ia3uFbht6zeHCk="; + }; + + patches = [ + # Load libjack from a known location + ./0060-libjack-path.patch + # Move installed tests into their own output. + ./0070-installed-tests-path.patch + ]; + + strictDeps = true; + nativeBuildInputs = [ + docutils + doxygen + graphviz + meson + ninja + pkg-config + python3 + glib + ]; + + buildInputs = [ + alsa-lib + dbus + glib + libjack2 + libusb1 + libselinux + libsndfile + lilv + ncurses + readline + udev + vulkan-headers + vulkan-loader + tinycompress + ] ++ (if enableSystemd then [ systemd ] else [ eudev ]) + ++ (if lib.meta.availableOn stdenv.hostPlatform webrtc-audio-processing_1 then [ webrtc-audio-processing_1 ] else [ webrtc-audio-processing ]) + ++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ] + ++ lib.optionals libcameraSupport [ libcamera libdrm ] + ++ lib.optional ffmpegSupport ffmpeg + ++ lib.optionals bluezSupport [ bluez libfreeaptx liblc3 sbc fdk_aac libopus ] + ++ lib.optional ldacbtSupport ldacbt + ++ lib.optional nativeModemManagerSupport modemmanager + ++ lib.optional pulseTunnelSupport libpulseaudio + ++ lib.optional zeroconfSupport avahi + ++ lib.optional raopSupport openssl + ++ lib.optional rocSupport roc-toolkit + ++ lib.optionals x11Support [ libcanberra xorg.libX11 xorg.libXfixes ] + ++ lib.optional mysofaSupport libmysofa + ++ lib.optional ffadoSupport ffado; + + # Valgrind binary is required for running one optional test. + nativeCheckInputs = lib.optional withValgrind valgrind; + + mesonFlags = [ + "-Ddocs=enabled" + "-Dudevrulesdir=lib/udev/rules.d" + "-Dinstalled_tests=enabled" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" + "-Dlibjack-path=${placeholder "jack"}/lib" + "-Dlibcamera=${mesonEnableFeature libcameraSupport}" + "-Dlibffado=${mesonEnableFeature ffadoSupport}" + "-Droc=${mesonEnableFeature rocSupport}" + "-Dlibpulse=${mesonEnableFeature pulseTunnelSupport}" + "-Davahi=${mesonEnableFeature zeroconfSupport}" + "-Dgstreamer=${mesonEnableFeature gstreamerSupport}" + "-Dsystemd-system-service=${mesonEnableFeature enableSystemd}" + "-Dudev=${mesonEnableFeature (!enableSystemd)}" + "-Dffmpeg=${mesonEnableFeature ffmpegSupport}" + "-Dbluez5=${mesonEnableFeature bluezSupport}" + "-Dbluez5-backend-hsp-native=${mesonEnableFeature nativeHspSupport}" + "-Dbluez5-backend-hfp-native=${mesonEnableFeature nativeHfpSupport}" + "-Dbluez5-backend-native-mm=${mesonEnableFeature nativeModemManagerSupport}" + "-Dbluez5-backend-ofono=${mesonEnableFeature ofonoSupport}" + "-Dbluez5-backend-hsphfpd=${mesonEnableFeature hsphfpdSupport}" + # source code is not easily obtainable + "-Dbluez5-codec-lc3plus=disabled" + "-Dbluez5-codec-lc3=${mesonEnableFeature bluezSupport}" + "-Dbluez5-codec-ldac=${mesonEnableFeature ldacbtSupport}" + "-Dsysconfdir=/etc" + "-Draop=${mesonEnableFeature raopSupport}" + "-Dsession-managers=" + "-Dvulkan=enabled" + "-Dx11=${mesonEnableFeature x11Support}" + "-Dx11-xfixes=${mesonEnableFeature x11Support}" + "-Dlibcanberra=${mesonEnableFeature x11Support}" + "-Dlibmysofa=${mesonEnableFeature mysofaSupport}" + "-Dsdl2=disabled" # required only to build examples, causes dependency loop + "-Drlimits-install=false" # installs to /etc, we won't use this anyway + "-Dcompress-offload=enabled" + "-Dman=enabled" + ]; + + # Fontconfig error: Cannot load default config file + FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; }; + + doCheck = true; + + postUnpack = '' + patchShebangs source/doc/*.py + patchShebangs source/doc/input-filter-h.sh + ''; + + postInstall = '' + moveToOutput "bin/pw-jack" "$jack" + ''; + + passthru.tests.installed-tests = nixosTests.installed-tests.pipewire; + + meta = with lib; { + description = "Server and user space API to deal with multimedia pipelines"; + changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${version}"; + homepage = "https://pipewire.org/"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ kranzes k900 ]; + }; + }; + +in +self diff --git a/nixpkgs/pkgs/development/libraries/pipewire/wireplumber.nix b/nixpkgs/pkgs/development/libraries/pipewire/wireplumber.nix new file mode 100644 index 000000000000..a5bdb729a102 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/pipewire/wireplumber.nix @@ -0,0 +1,81 @@ +{ lib +, stdenv +, fetchFromGitLab +, nix-update-script +# base build deps +, meson +, pkg-config +, ninja +# docs build deps +, python3 +, doxygen +, graphviz +# GI build deps +, gobject-introspection +# runtime deps +, glib +, systemd +, lua5_4 +, pipewire +# options +, enableDocs ? true +, enableGI ? true +}: + +stdenv.mkDerivation rec { + pname = "wireplumber"; + version = "0.4.17"; + + outputs = [ "out" "dev" ] ++ lib.optional enableDocs "doc"; + + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "pipewire"; + repo = "wireplumber"; + rev = version; + hash = "sha256-vhpQT67+849WV1SFthQdUeFnYe/okudTQJoL3y+wXwI="; + }; + + nativeBuildInputs = [ + meson + pkg-config + ninja + ] ++ lib.optionals enableDocs [ + graphviz + ] ++ lib.optionals enableGI [ + gobject-introspection + ] ++ lib.optionals (enableDocs || enableGI) [ + doxygen + (python3.pythonOnBuildForHost.withPackages (ps: with ps; + lib.optionals enableDocs [ sphinx sphinx-rtd-theme breathe ] + ++ lib.optionals enableGI [ lxml ] + )) + ]; + + buildInputs = [ + glib + systemd + lua5_4 + pipewire + ]; + + mesonFlags = [ + (lib.mesonBool "system-lua" true) + (lib.mesonEnable "elogind" false) + (lib.mesonEnable "doc" enableDocs) + (lib.mesonEnable "introspection" enableGI) + (lib.mesonBool "systemd-system-service" true) + (lib.mesonOption "systemd-system-unit-dir" "${placeholder "out"}/lib/systemd/system") + (lib.mesonOption "sysconfdir" "/etc") + ]; + + passthru.updateScript = nix-update-script { }; + + meta = with lib; { + description = "A modular session / policy manager for PipeWire"; + homepage = "https://pipewire.org"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ k900 ]; + }; +} |