2015-04-26 20:09:52 +01:00
|
|
|
{ stdenv, fetchurl, pkgconfig, intltool, automake, autoconf, libtool
|
|
|
|
, json_c, libsndfile, gettext, check
|
2008-12-19 14:56:37 +00:00
|
|
|
|
2015-04-26 05:27:41 +01:00
|
|
|
# Optional Dependencies
|
|
|
|
, xlibs ? null, libcap ? null, valgrind ? null, oss ? null, coreaudio ? null
|
|
|
|
, alsaLib ? null, esound ? null, glib ? null, gtk3 ? null, gconf ? null
|
|
|
|
, avahi ? null, libjack2 ? null, libasyncns ? null, lirc ? null, dbus ? null
|
|
|
|
, sbc ? null, bluez5 ? null, udev ? null, openssl ? null, fftw ? null
|
2015-04-26 20:10:33 +01:00
|
|
|
, speexdsp ? null, systemd ? null, webrtc-audio-processing ? null
|
2008-12-19 14:56:37 +00:00
|
|
|
|
2015-04-26 05:27:41 +01:00
|
|
|
# Database selection
|
|
|
|
, tdb ? null, gdbm ? null
|
|
|
|
|
|
|
|
# Extra options
|
|
|
|
, prefix ? ""
|
|
|
|
}:
|
|
|
|
|
2015-05-22 20:59:21 +01:00
|
|
|
with stdenv;
|
2015-04-26 05:27:41 +01:00
|
|
|
let
|
|
|
|
libOnly = prefix == "lib";
|
|
|
|
|
|
|
|
hasXlibs = xlibs != null;
|
|
|
|
|
2015-04-26 20:10:33 +01:00
|
|
|
optLibcap = shouldUsePkg libcap;
|
2015-04-26 05:27:41 +01:00
|
|
|
hasCaps = optLibcap != null || stdenv.isFreeBSD; # Built-in on FreeBSD
|
|
|
|
|
|
|
|
optOss = if libOnly then null else shouldUsePkg oss;
|
|
|
|
hasOss = optOss != null || stdenv.isFreeBSD; # Built-in on FreeBSD
|
|
|
|
|
|
|
|
optCoreaudio = if libOnly then null else shouldUsePkg coreaudio;
|
|
|
|
optAlsaLib = if libOnly then null else shouldUsePkg alsaLib;
|
|
|
|
optEsound = if libOnly then null else shouldUsePkg esound;
|
2015-05-30 04:50:40 +01:00
|
|
|
optGlib = shouldUsePkg glib;
|
2015-05-11 22:59:05 +01:00
|
|
|
optGtk3 = if libOnly || !hasXlibs then null else shouldUsePkg gtk3;
|
2015-04-26 05:27:41 +01:00
|
|
|
optGconf = if libOnly then null else shouldUsePkg gconf;
|
|
|
|
optAvahi = if libOnly then null else shouldUsePkg avahi;
|
|
|
|
optLibjack2 = if libOnly then null else shouldUsePkg libjack2;
|
|
|
|
optLibasyncns = shouldUsePkg libasyncns;
|
|
|
|
optLirc = if libOnly then null else shouldUsePkg lirc;
|
|
|
|
optDbus = shouldUsePkg dbus;
|
|
|
|
optSbc = if libOnly then null else shouldUsePkg sbc;
|
|
|
|
optBluez5 = if optDbus == null || optSbc == null then null
|
|
|
|
else shouldUsePkg bluez5;
|
|
|
|
optUdev = if libOnly then null else shouldUsePkg udev;
|
|
|
|
optOpenssl = if libOnly then null else shouldUsePkg openssl;
|
2015-04-26 20:10:33 +01:00
|
|
|
optFftw = shouldUsePkg fftw;
|
|
|
|
optSpeexdsp = shouldUsePkg speexdsp;
|
2015-04-26 05:27:41 +01:00
|
|
|
optSystemd = shouldUsePkg systemd;
|
|
|
|
optWebrtc-audio-processing = if libOnly then null else shouldUsePkg webrtc-audio-processing;
|
|
|
|
hasWebrtc = if libOnly then null else optWebrtc-audio-processing != null;
|
|
|
|
|
|
|
|
# Pick a database to use
|
|
|
|
databaseName = if tdb != null then "tdb" else
|
|
|
|
if gdbm != null then "gdbm" else "simple";
|
|
|
|
database = {
|
|
|
|
tdb = tdb;
|
|
|
|
gdbm = gdbm;
|
|
|
|
simple = null;
|
|
|
|
}.${databaseName};
|
|
|
|
in
|
2015-05-22 20:59:21 +01:00
|
|
|
with stdenv.lib;
|
2008-12-19 14:56:37 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2015-04-26 05:27:41 +01:00
|
|
|
name = "${prefix}pulseaudio-${version}";
|
|
|
|
version = "6.0";
|
2008-12-19 14:56:37 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-04-26 05:27:41 +01:00
|
|
|
url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${version}.tar.xz";
|
2015-03-26 05:08:17 +00:00
|
|
|
sha256 = "1xpnfxa0d8pgf6b4qdgnkcvrvdxbbbjd5ync19h0f5hbp3h401mm";
|
2008-12-19 14:56:37 +00:00
|
|
|
};
|
|
|
|
|
2015-04-26 20:09:52 +01:00
|
|
|
patches = [ ./caps-fix.patch ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig intltool automake autoconf libtool ];
|
2015-04-26 05:27:41 +01:00
|
|
|
buildInputs = [
|
2015-04-26 20:09:52 +01:00
|
|
|
json_c libsndfile gettext check database
|
2009-05-11 22:11:25 +01:00
|
|
|
|
2015-04-26 05:27:41 +01:00
|
|
|
optLibcap valgrind optOss optCoreaudio optAlsaLib optEsound optGlib
|
|
|
|
optGtk3 optGconf optAvahi optLibjack2 optLibasyncns optLirc optDbus optUdev
|
2015-04-26 20:10:33 +01:00
|
|
|
optOpenssl optFftw optSpeexdsp optSystemd optWebrtc-audio-processing
|
2015-05-22 20:59:21 +01:00
|
|
|
] ++ optionals hasXlibs (with xlibs; [
|
2015-04-26 05:27:41 +01:00
|
|
|
libX11 libxcb libICE libSM libXtst xextproto libXi
|
2015-05-22 20:59:21 +01:00
|
|
|
]) ++ optionals (optBluez5 != null) [ optBluez5 optSbc ];
|
2008-12-19 14:56:37 +00:00
|
|
|
|
2009-01-19 20:22:54 +00:00
|
|
|
preConfigure = ''
|
2015-04-26 20:09:52 +01:00
|
|
|
# Performs and autoreconf
|
|
|
|
export NOCONFIGURE="yes"
|
|
|
|
patchShebangs bootstrap.sh
|
|
|
|
./bootstrap.sh
|
|
|
|
|
2009-12-13 20:19:19 +00:00
|
|
|
# Move the udev rules under $(prefix).
|
|
|
|
sed -i "src/Makefile.in" \
|
|
|
|
-e "s|udevrulesdir[[:blank:]]*=.*$|udevrulesdir = $out/lib/udev/rules.d|g"
|
2011-11-06 20:03:07 +00:00
|
|
|
|
|
|
|
# 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 |"
|
2009-01-19 20:22:54 +00:00
|
|
|
'';
|
|
|
|
|
2014-09-03 12:24:47 +01:00
|
|
|
configureFlags = [
|
2015-04-26 20:10:33 +01:00
|
|
|
(mkOther "localstatedir" "/var")
|
|
|
|
(mkOther "sysconfdir" "/etc")
|
2015-04-26 05:27:41 +01:00
|
|
|
(mkEnable false "atomic-arm-memory-barrier" null) # TODO: Enable on armv8
|
|
|
|
(mkEnable false "neon-opt" null) # TODO: Enable on armv8
|
|
|
|
(mkEnable hasXlibs "x11" null)
|
2015-04-26 20:09:52 +01:00
|
|
|
(mkWith hasCaps "caps" optLibcap)
|
2015-04-26 05:27:41 +01:00
|
|
|
(mkEnable true "tests" null)
|
|
|
|
(mkEnable false "samplerate" null) # Deprecated
|
|
|
|
(mkWith true "database" databaseName)
|
|
|
|
(mkEnable hasOss "oss-output" null)
|
2015-05-13 18:53:00 +01:00
|
|
|
(mkEnable true "oss-wrapper" null) # Does not use OSS
|
2015-04-26 05:27:41 +01:00
|
|
|
(mkEnable (optCoreaudio != null) "coreaudio-output" null)
|
|
|
|
(mkEnable (optAlsaLib != null) "alsa" null)
|
|
|
|
(mkEnable (optEsound != null) "esound" null)
|
|
|
|
(mkEnable false "solaris" null)
|
|
|
|
(mkEnable false "waveout" null) # Windows Only
|
|
|
|
(mkEnable (optGlib != null) "glib2" null)
|
|
|
|
(mkEnable (optGtk3 != null) "gtk3" null)
|
|
|
|
(mkEnable (optGconf != null) "gconf" null)
|
|
|
|
(mkEnable (optAvahi != null) "avahi" null)
|
|
|
|
(mkEnable (optLibjack2 != null) "jack" null)
|
|
|
|
(mkEnable (optLibasyncns != null) "asyncns" null)
|
|
|
|
(mkEnable false "tcpwrap" null)
|
|
|
|
(mkEnable (optLirc != null) "lirc" null)
|
|
|
|
(mkEnable (optDbus != null) "dbus" null)
|
|
|
|
(mkEnable false "bluez4" null)
|
|
|
|
(mkEnable (optBluez5 != null) "bluez5" null)
|
|
|
|
(mkEnable (optBluez5 != null) "bluez5-ofono-headset" null)
|
|
|
|
(mkEnable (optBluez5 != null) "bluez5-native-headset" null)
|
|
|
|
(mkEnable (optUdev != null) "udev" null)
|
|
|
|
(mkEnable false "hal-compat" null)
|
|
|
|
(mkEnable true "ipv6" null)
|
|
|
|
(mkEnable (optOpenssl != null) "openssl" null)
|
|
|
|
(mkWith (optFftw != null) "fftw" null)
|
2015-04-26 20:10:33 +01:00
|
|
|
(mkWith (optSpeexdsp != null) "speex" null)
|
2015-04-26 05:27:41 +01:00
|
|
|
(mkEnable false "xen" null)
|
|
|
|
(mkEnable false "gcov" null)
|
|
|
|
(mkEnable (optSystemd != null) "systemd-daemon" null)
|
|
|
|
(mkEnable (optSystemd != null) "systemd-login" null)
|
|
|
|
(mkEnable (optSystemd != null) "systemd-journal" null)
|
|
|
|
(mkEnable true "manpages" null)
|
|
|
|
(mkEnable hasWebrtc "webrtc-aec" null)
|
|
|
|
(mkEnable true "adrian-aec" null)
|
2015-05-06 10:40:47 +01:00
|
|
|
(mkWith true "system-user" "pulse")
|
|
|
|
(mkWith true "system-group" "pulse")
|
2015-04-26 05:27:41 +01:00
|
|
|
(mkWith true "access-group" "audio")
|
2015-05-02 23:50:31 +01:00
|
|
|
(mkWith true "systemduserunitdir" "\${out}/lib/systemd/user")
|
|
|
|
(mkWith stdenv.isDarwin "mac-sysroot" "/")
|
|
|
|
];
|
2011-07-26 16:25:21 +01:00
|
|
|
|
2011-07-07 18:24:31 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2013-09-06 02:47:49 +01:00
|
|
|
# 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)
|
2015-05-22 20:59:21 +01:00
|
|
|
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin
|
2013-09-06 02:47:49 +01:00
|
|
|
"-I/usr/include";
|
|
|
|
|
2015-04-26 05:27:41 +01:00
|
|
|
installFlags = [
|
|
|
|
"sysconfdir=$(out)/etc"
|
|
|
|
"pulseconfdir=$(out)/etc/pulse"
|
|
|
|
];
|
|
|
|
|
2015-05-22 20:59:21 +01:00
|
|
|
postInstall = optionalString libOnly ''
|
2015-04-26 05:27:41 +01:00
|
|
|
rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
|
|
|
|
'';
|
2013-09-06 02:47:49 +01:00
|
|
|
|
2015-05-22 20:59:21 +01:00
|
|
|
meta = {
|
2014-08-24 15:21:08 +01:00
|
|
|
description = "Sound server for POSIX and Win32 systems";
|
2013-09-06 02:47:49 +01:00
|
|
|
homepage = http://www.pulseaudio.org/;
|
|
|
|
# Note: Practically, the server is under the GPL due to the
|
|
|
|
# dependency on `libsamplerate'. See `LICENSE' for details.
|
|
|
|
licenses = licenses.lgpl2Plus;
|
2015-04-26 05:27:41 +01:00
|
|
|
maintainers = with maintainers; [ lovek323 wkennington ];
|
2013-09-06 02:47:49 +01:00
|
|
|
platforms = platforms.unix;
|
2008-12-19 14:56:37 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|