lol
at v206 133 lines 4.3 kB view raw
1{ lib, stdenv, fetchurl, pkgconfig, intltool, autoreconfHook 2, json_c, libsndfile, libtool 3, xorg, libcap, alsaLib, glib 4, avahi, libjack2, libasyncns, lirc, dbus 5, sbc, bluez5, udev, openssl, fftwFloat 6, speexdsp, systemd, webrtc-audio-processing, gconf ? null 7 8# Database selection 9, tdb ? null, gdbm ? null 10 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 33}: 34 35stdenv.mkDerivation rec { 36 name = "${if libOnly then "lib" else ""}pulseaudio-${version}"; 37 version = "7.0"; 38 39 src = fetchurl { 40 url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${version}.tar.xz"; 41 sha256 = "1yp8x8z4wigrzik131kjdyhn7hznazvbkbp2zz1vy9l9gqvy26na"; 42 }; 43 44 patches = [ ./caps-fix.patch ]; 45 46 nativeBuildInputs = [ pkgconfig intltool autoreconfHook ]; 47 48 propagatedBuildInputs = 49 lib.optionals stdenv.isLinux [ libcap ]; 50 51 buildInputs = 52 [ json_c libsndfile speexdsp fftwFloat ] 53 ++ lib.optionals stdenv.isLinux [ glib dbus.libs ] 54 ++ lib.optionals (!libOnly) ( 55 [ libasyncns webrtc-audio-processing ] 56 ++ lib.optional jackaudioSupport libjack2 57 ++ lib.optionals x11Support [ xorg.xlibsWrapper xorg.libXtst xorg.libXi ] 58 ++ lib.optional useSystemd systemd 59 ++ lib.optionals stdenv.isLinux [ alsaLib udev ] 60 ++ lib.optional airtunesSupport openssl 61 ++ lib.optional gconfSupport gconf 62 ++ lib.optionals bluetoothSupport [ bluez5 sbc ] 63 ++ lib.optional remoteControlSupport lirc 64 ++ lib.optional zeroconfSupport avahi 65 ); 66 67 preConfigure = '' 68 # Performs and autoreconf 69 export NOCONFIGURE="yes" 70 patchShebangs bootstrap.sh 71 ./bootstrap.sh 72 73 # Move the udev rules under $(prefix). 74 sed -i "src/Makefile.in" \ 75 -e "s|udevrulesdir[[:blank:]]*=.*$|udevrulesdir = $out/lib/udev/rules.d|g" 76 77 # don't install proximity-helper as root and setuid 78 sed -i "src/Makefile.in" \ 79 -e "s|chown root|true |" \ 80 -e "s|chmod r+s |true |" 81 ''; 82 83 configureFlags = 84 [ "--disable-solaris" 85 "--disable-jack" 86 "--disable-oss-output" 87 ] ++ lib.optional (!ossWrapper) "--disable-oss-wrapper" ++ 88 [ "--localstatedir=/var" 89 "--sysconfdir=/etc" 90 "--with-access-group=audio" 91 "--with-bash-completion-dir=\${out}/share/bash-completions/completions" 92 ] 93 ++ lib.optional (jackaudioSupport && !libOnly) "--enable-jack" 94 ++ lib.optional stdenv.isDarwin "--with-mac-sysroot=/" 95 ++ lib.optional (stdenv.isLinux && useSystemd) "--with-systemduserunitdir=\${out}/lib/systemd/user"; 96 97 enableParallelBuilding = true; 98 99 # not sure what the best practices are here -- can't seem to find a way 100 # for the compiler to bring in stdlib and stdio (etc.) properly 101 # the alternative is to copy the files from /usr/include to src, but there are 102 # probably a large number of files that would need to be copied (I stopped 103 # after the seventh) 104 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I/usr/include"; 105 106 installFlags = 107 [ "sysconfdir=$(out)/etc" 108 "pulseconfdir=$(out)/etc/pulse" 109 ]; 110 111 postInstall = lib.optionalString libOnly '' 112 rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}} 113 sed 's|-lltdl|-L${libtool}/lib -lltdl|' -i $out/lib/libpulsecore-${version}.la 114 ''; 115 116 meta = { 117 description = "Sound server for POSIX and Win32 systems"; 118 homepage = http://www.pulseaudio.org/; 119 licenses = lib.licenses.lgpl2Plus; 120 maintainers = with lib.maintainers; [ lovek323 wkennington ]; 121 platforms = lib.platforms.unix; 122 123 longDescription = '' 124 PulseAudio is a sound server for POSIX and Win32 systems. A 125 sound server is basically a proxy for your sound applications. 126 It allows you to do advanced operations on your sound data as it 127 passes between your application and your hardware. Things like 128 transferring the audio to a different machine, changing the 129 sample format or channel count and mixing several sounds into 130 one are easily achieved using a sound server. 131 ''; 132 }; 133}