3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/pulseaudio/default.nix

149 lines
4.9 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, pkgconfig, autoreconfHook
, libsndfile, libtool, makeWrapper, perlPackages
2019-11-30 23:11:47 +00:00
, xorg, libcap, alsaLib, glib, dconf
, avahi, libjack2, libasyncns, lirc, dbus
, sbc, bluez5, udev, openssl, fftwFloat
, soxr, speexdsp, systemd, webrtc-audio-processing
, x11Support ? false
, useSystemd ? true
, # Whether to support the JACK sound system as a backend.
jackaudioSupport ? false
, # Whether to build the OSS wrapper ("padsp").
ossWrapper ? true
, airtunesSupport ? false
, bluetoothSupport ? true
, remoteControlSupport ? false
, zeroconfSupport ? false
, # Whether to build only the library.
libOnly ? false
2017-01-04 19:21:48 +00:00
, CoreServices, AudioUnit, Cocoa
2015-04-26 05:27:41 +01:00
}:
stdenv.mkDerivation rec {
name = "${if libOnly then "lib" else ""}pulseaudio-${version}";
version = "13.0";
src = fetchurl {
2015-04-26 05:27:41 +01:00
url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${version}.tar.xz";
sha256 = "0mw0ybrqj7hvf8lqs5gjzip464hfnixw453lr0mqzlng3b5266wn";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [ pkgconfig autoreconfHook makeWrapper perlPackages.perl perlPackages.XMLParser ];
propagatedBuildInputs =
lib.optionals stdenv.isLinux [ libcap ];
buildInputs =
[ libtool libsndfile soxr speexdsp fftwFloat ]
++ lib.optionals stdenv.isLinux [ glib dbus ]
2017-01-04 19:21:48 +00:00
++ lib.optionals stdenv.isDarwin [ CoreServices AudioUnit Cocoa ]
++ lib.optionals (!libOnly) (
[ libasyncns webrtc-audio-processing ]
++ lib.optional jackaudioSupport libjack2
++ lib.optionals x11Support [ xorg.xlibsWrapper xorg.libXtst xorg.libXi ]
++ lib.optional useSystemd systemd
++ lib.optionals stdenv.isLinux [ alsaLib udev ]
++ lib.optional airtunesSupport openssl
++ lib.optionals bluetoothSupport [ bluez5 sbc ]
++ lib.optional remoteControlSupport lirc
++ lib.optional zeroconfSupport avahi
2019-06-10 10:15:40 +01:00
);
2020-06-25 01:37:22 +01:00
prePatch = ''
substituteInPlace bootstrap.sh \
--replace pkg-config $PKG_CONFIG
'';
autoreconfPhase = ''
# Performs an autoreconf
2015-04-26 20:09:52 +01:00
patchShebangs bootstrap.sh
NOCONFIGURE=1 ./bootstrap.sh
2015-04-26 20:09:52 +01:00
# Move the udev rules under $(prefix).
sed -i "src/Makefile.in" \
-e "s|udevrulesdir[[:blank:]]*=.*$|udevrulesdir = $out/lib/udev/rules.d|g"
# don't install proximity-helper as root and setuid
sed -i "src/Makefile.in" \
-e "s|chown root|true |" \
-e "s|chmod r+s |true |"
'';
configureFlags =
[ "--disable-solaris"
"--disable-jack"
"--disable-oss-output"
] ++ lib.optional (!ossWrapper) "--disable-oss-wrapper" ++
[ "--localstatedir=/var"
"--sysconfdir=/etc"
"--with-access-group=audio"
"--with-bash-completion-dir=${placeholder "out"}/share/bash-completions/completions"
]
++ lib.optional (jackaudioSupport && !libOnly) "--enable-jack"
++ lib.optional stdenv.isDarwin "--with-mac-sysroot=/"
++ lib.optional (stdenv.isLinux && useSystemd) "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user";
enableParallelBuilding = true;
# not sure what the best practices are here -- can't seem to find a way
# for the compiler to bring in stdlib and stdio (etc.) properly
# the alternative is to copy the files from /usr/include to src, but there are
# probably a large number of files that would need to be copied (I stopped
# after the seventh)
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I/usr/include";
installFlags =
[ "sysconfdir=${placeholder "out"}/etc"
"pulseconfdir=${placeholder "out"}/etc/pulse"
];
2015-04-26 05:27:41 +01:00
postInstall = lib.optionalString libOnly ''
2015-04-26 05:27:41 +01:00
rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
sed 's|-lltdl|-L${libtool.lib}/lib -lltdl|' -i $out/lib/pulseaudio/libpulsecore-${version}.la
''
2019-12-27 03:51:28 +00:00
+ ''
moveToOutput lib/cmake "$dev"
rm -f $out/bin/qpaeq # this is packaged by the "qpaeq" package now, because of missing deps
'';
preFixup = lib.optionalString stdenv.isLinux ''
wrapProgram $out/libexec/pulse/gsettings-helper \
--prefix XDG_DATA_DIRS : "$out/share/gsettings-schemas/${name}" \
2019-11-30 23:11:47 +00:00
--prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules"
'';
2020-10-26 01:18:26 +00:00
passthru = {
pulseDir = "lib/pulse-" + lib.versions.majorMinor version;
};
meta = {
description = "Sound server for POSIX and Win32 systems";
homepage = "http://www.pulseaudio.org/";
license = lib.licenses.lgpl2Plus;
maintainers = with lib.maintainers; [ lovek323 ];
platforms = lib.platforms.unix;
longDescription = ''
PulseAudio is a sound server for POSIX and Win32 systems. A
sound server is basically a proxy for your sound applications.
It allows you to do advanced operations on your sound data as it
passes between your application and your hardware. Things like
transferring the audio to a different machine, changing the
sample format or channel count and mixing several sounds into
one are easily achieved using a sound server.
'';
};
}