@@ -1,73 +1,39 @@
1−{ stdenv, fetchurl, pkgconfig, intltool, automake, autoconf, libtool
2−, json_c, libsndfile, gettext, check
3−
4−# Optional Dependencies
5−, xlibs ? null, libcap ? null, valgrind ? null, oss ? null, coreaudio ? null
6−, alsaLib ? null, esound ? null, glib ? null, gtk3 ? null, gconf ? null
7−, avahi ? null, libjack2 ? null, libasyncns ? null, lirc ? null, dbus ? null
8−, sbc ? null, bluez5 ? null, udev ? null, openssl ? null, fftw ? null
9−, speexdsp ? null, systemd ? null, webrtc-audio-processing ? null
1+{ lib, stdenv, fetchurl, pkgconfig, intltool, autoreconfHook
2+, json_c, libsndfile
3+, xlibs, libcap, alsaLib, glib
4+, avahi, libjack2, libasyncns, lirc, dbus
5+, sbc, bluez5, udev, openssl, fftwFloat
6+, speexdsp, systemd, webrtc-audio-processing, gconf ? null
107
118# Database selection
129, tdb ? null, gdbm ? null
1310
14−# Extra options
15−, prefix ? ""
11+, x11Support ? false
12+
13+, useSystemd ? true
14+
15+, # Whether to support the JACK sound system as a backend.
16+ jackaudioSupport ? false
17+
18+, # Whether to build the OSS wrapper ("padsp").
19+ ossWrapper ? true
20+
21+, airtunesSupport ? false
22+
23+, gconfSupport ? false
24+
25+, bluetoothSupport ? false
26+
27+, remoteControlSupport ? false
28+
29+, zeroconfSupport ? false
30+
31+, # Whether to build only the library.
32+ libOnly ? false
1633}:
1734
18−let
19− mkFlag = trueStr: falseStr: cond: name: val:
20− if cond == null then null else
21− "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
22− mkEnable = mkFlag "enable-" "disable-";
23− mkWith = mkFlag "with-" "without-";
24− mkOther = mkFlag "" "" true;
25−
26− shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
27−
28− libOnly = prefix == "lib";
29−
30− hasXlibs = xlibs != null;
31−
32− optLibcap = shouldUsePkg libcap;
33− hasCaps = optLibcap != null || stdenv.isFreeBSD; # Built-in on FreeBSD
34−
35− optOss = if libOnly then null else shouldUsePkg oss;
36− hasOss = optOss != null || stdenv.isFreeBSD; # Built-in on FreeBSD
37−
38− optCoreaudio = if libOnly then null else shouldUsePkg coreaudio;
39− optAlsaLib = if libOnly then null else shouldUsePkg alsaLib;
40− optEsound = if libOnly then null else shouldUsePkg esound;
41− optGlib = shouldUsePkg glib;
42− optGtk3 = if libOnly || !hasXlibs then null else shouldUsePkg gtk3;
43− optGconf = if libOnly then null else shouldUsePkg gconf;
44− optAvahi = if libOnly then null else shouldUsePkg avahi;
45− optLibjack2 = if libOnly then null else shouldUsePkg libjack2;
46− optLibasyncns = shouldUsePkg libasyncns;
47− optLirc = if libOnly then null else shouldUsePkg lirc;
48− optDbus = shouldUsePkg dbus;
49− optSbc = if libOnly then null else shouldUsePkg sbc;
50− optBluez5 = if optDbus == null || optSbc == null then null
51− else shouldUsePkg bluez5;
52− optUdev = if libOnly then null else shouldUsePkg udev;
53− optOpenssl = if libOnly then null else shouldUsePkg openssl;
54− optFftw = shouldUsePkg fftw;
55− optSpeexdsp = shouldUsePkg speexdsp;
56− optSystemd = shouldUsePkg systemd;
57− optWebrtc-audio-processing = if libOnly then null else shouldUsePkg webrtc-audio-processing;
58− hasWebrtc = if libOnly then null else optWebrtc-audio-processing != null;
59−
60− # Pick a database to use
61− databaseName = if tdb != null then "tdb" else
62− if gdbm != null then "gdbm" else "simple";
63− database = {
64− tdb = tdb;
65− gdbm = gdbm;
66− simple = null;
67− }.${databaseName};
68−in
6935stdenv.mkDerivation rec {
70− name = "${prefix}pulseaudio-${version}";
36+ name = "${if libOnly then "lib" else ""}pulseaudio-${version}";
7137 version = "6.0";
7238
7339 src = fetchurl {
@@ -77,16 +43,23 @@ stdenv.mkDerivation rec {
7743
7844 patches = [ ./caps-fix.patch ];
7945
80− nativeBuildInputs = [ pkgconfig intltool automake autoconf libtool ];
81− buildInputs = [
82− json_c libsndfile gettext check database
83−
84− optLibcap valgrind optOss optCoreaudio optAlsaLib optEsound optGlib
85− optGtk3 optGconf optAvahi optLibjack2 optLibasyncns optLirc optDbus optUdev
86− optOpenssl optFftw optSpeexdsp optSystemd optWebrtc-audio-processing
87− ] ++ stdenv.lib.optionals hasXlibs (with xlibs; [
88− libX11 libxcb libICE libSM libXtst xextproto libXi
89− ]) ++ stdenv.lib.optionals (optBluez5 != null) [ optBluez5 optSbc ];
46+ nativeBuildInputs = [ pkgconfig intltool autoreconfHook ];
47+
48+ buildInputs =
49+ [ json_c libsndfile speexdsp fftwFloat ]
50+ ++ lib.optionals stdenv.isLinux [ libcap glib dbus.libs ]
51+ ++ lib.optionals (!libOnly) (
52+ [ libasyncns webrtc-audio-processing ]
53+ ++ lib.optional jackaudioSupport libjack2
54+ ++ lib.optionals x11Support [ xlibs.xlibs xlibs.libXtst xlibs.libXi ]
55+ ++ lib.optional useSystemd systemd
56+ ++ lib.optionals stdenv.isLinux [ alsaLib udev ]
57+ ++ lib.optional airtunesSupport openssl
58+ ++ lib.optional gconfSupport gconf
59+ ++ lib.optionals bluetoothSupport [ bluez5 sbc ]
60+ ++ lib.optional remoteControlSupport lirc
61+ ++ lib.optional zeroconfSupport avahi
62+ );
9063
9164 preConfigure = ''
9265 # Performs and autoreconf
@@ -98,62 +71,24 @@ stdenv.mkDerivation rec {
9871 sed -i "src/Makefile.in" \
9972 -e "s|udevrulesdir[[:blank:]]*=.*$|udevrulesdir = $out/lib/udev/rules.d|g"
10073
101− # don't install proximity-helper as root and setuid
102− sed -i "src/Makefile.in" \
103− -e "s|chown root|true |" \
104− -e "s|chmod r+s |true |"
74+ # don't install proximity-helper as root and setuid
75+ sed -i "src/Makefile.in" \
76+ -e "s|chown root|true |" \
77+ -e "s|chmod r+s |true |"
10578 '';
10679
107− configureFlags = [
108− (mkOther "localstatedir" "/var")
109− (mkOther "sysconfdir" "/etc")
110− (mkEnable false "atomic-arm-memory-barrier" null) # TODO: Enable on armv8
111− (mkEnable false "neon-opt" null) # TODO: Enable on armv8
112− (mkEnable hasXlibs "x11" null)
113− (mkWith hasCaps "caps" optLibcap)
114− (mkEnable true "tests" null)
115− (mkEnable false "samplerate" null) # Deprecated
116− (mkWith true "database" databaseName)
117− (mkEnable hasOss "oss-output" null)
118− (mkEnable true "oss-wrapper" null) # Does not use OSS
119− (mkEnable (optCoreaudio != null) "coreaudio-output" null)
120− (mkEnable (optAlsaLib != null) "alsa" null)
121− (mkEnable (optEsound != null) "esound" null)
122− (mkEnable false "solaris" null)
123− (mkEnable false "waveout" null) # Windows Only
124− (mkEnable (optGlib != null) "glib2" null)
125− (mkEnable (optGtk3 != null) "gtk3" null)
126− (mkEnable (optGconf != null) "gconf" null)
127− (mkEnable (optAvahi != null) "avahi" null)
128− (mkEnable (optLibjack2 != null) "jack" null)
129− (mkEnable (optLibasyncns != null) "asyncns" null)
130− (mkEnable false "tcpwrap" null)
131− (mkEnable (optLirc != null) "lirc" null)
132− (mkEnable (optDbus != null) "dbus" null)
133− (mkEnable false "bluez4" null)
134− (mkEnable (optBluez5 != null) "bluez5" null)
135− (mkEnable (optBluez5 != null) "bluez5-ofono-headset" null)
136− (mkEnable (optBluez5 != null) "bluez5-native-headset" null)
137− (mkEnable (optUdev != null) "udev" null)
138− (mkEnable false "hal-compat" null)
139− (mkEnable true "ipv6" null)
140− (mkEnable (optOpenssl != null) "openssl" null)
141− (mkWith (optFftw != null) "fftw" null)
142− (mkWith (optSpeexdsp != null) "speex" null)
143− (mkEnable false "xen" null)
144− (mkEnable false "gcov" null)
145− (mkEnable (optSystemd != null) "systemd-daemon" null)
146− (mkEnable (optSystemd != null) "systemd-login" null)
147− (mkEnable (optSystemd != null) "systemd-journal" null)
148− (mkEnable true "manpages" null)
149− (mkEnable hasWebrtc "webrtc-aec" null)
150− (mkEnable true "adrian-aec" null)
151− (mkWith true "system-user" "pulse")
152− (mkWith true "system-group" "pulse")
153− (mkWith true "access-group" "audio")
154− (mkWith true "systemduserunitdir" "\${out}/lib/systemd/user")
155− (mkWith stdenv.isDarwin "mac-sysroot" "/")
156− ];
80+ configureFlags =
81+ [ "--disable-solaris"
82+ "--disable-jack"
83+ "--disable-oss-output"
84+ ] ++ lib.optional (!ossWrapper) "--disable-oss-wrapper" ++
85+ [ "--localstatedir=/var"
86+ "--sysconfdir=/etc"
87+ "--with-access-group=audio"
88+ ]
89+ ++ lib.optional (jackaudioSupport && !libOnly) "--enable-jack"
90+ ++ lib.optional stdenv.isDarwin "--with-mac-sysroot=/"
91+ ++ lib.optional (stdenv.isLinux && useSystemd) "--with-systemduserunitdir=\${out}/lib/systemd/user";
15792
15893 enableParallelBuilding = true;
15994
@@ -162,26 +97,23 @@ stdenv.mkDerivation rec {
16297 # the alternative is to copy the files from /usr/include to src, but there are
16398 # probably a large number of files that would need to be copied (I stopped
16499 # after the seventh)
165− NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin
166− "-I/usr/include";
100+ NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I/usr/include";
167101
168− installFlags = [
169− "sysconfdir=$(out)/etc"
170− "pulseconfdir=$(out)/etc/pulse"
171− ];
102+ installFlags =
103+ [ "sysconfdir=$(out)/etc"
104+ "pulseconfdir=$(out)/etc/pulse"
105+ ];
172106
173− postInstall = stdenv.lib.optionalString libOnly ''
107+ postInstall = lib.optionalString libOnly ''
174108 rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
175109 '';
176110
177− meta = with stdenv.lib; {
111+ meta = {
178112 description = "Sound server for POSIX and Win32 systems";
179113 homepage = http://www.pulseaudio.org/;
180− # Note: Practically, the server is under the GPL due to the
181− # dependency on `libsamplerate'. See `LICENSE' for details.
182− licenses = licenses.lgpl2Plus;
183− maintainers = with maintainers; [ lovek323 wkennington ];
184− platforms = platforms.unix;
114+ licenses = lib.licenses.lgpl2Plus;
115+ maintainers = with lib.maintainers; [ lovek323 wkennington ];
116+ platforms = lib.platforms.unix;
185117
186118 longDescription = ''
187119 PulseAudio is a sound server for POSIX and Win32 systems. A