summary refs log tree commit diff
path: root/pkgs/misc/apulse/pressureaudio.nix
blob: f0b39afb98e89c995b23a67fffcf5caeaaa89cf2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{ stdenv, apulse, libpulseaudio, pkg-config, intltool, autoreconfHook }:

stdenv.mkDerivation {
  pname = "libpressureaudio";
  version = apulse.version;

  src = libpulseaudio.src;

  nativeBuildInputs = [ pkg-config intltool autoreconfHook ];

  dontConfigure = true;

  buildPhase = ":";

  installPhase = ''
    echo "Copying libraries from apulse."
    mkdir -p $out/lib
    ls ${apulse}/lib/apulse $out/lib
    cp -a ${apulse}/lib/apulse/* $out/lib/

    echo "Copying headers from pulseaudio."
    mkdir -p $out/include/pulse
    cp -a src/pulse/*.h $out/include/pulse

    echo "Generating custom pkgconfig definitions."
    mkdir -p $out/lib/pkgconfig
    for a in libpulse.pc libpulse-simple.pc libpulse-mainloop-glib.pc ; do
        cat > $out/lib/pkgconfig/$a << EOF
    prefix=$out
    libdir=$out/lib
    includedir=$out/include

    EOF
    done

    cat >> $out/lib/pkgconfig/libpulse.pc << EOF
    Name: libpulse
    Description: PulseAudio Client Interface
    Version: ${libpulseaudio.version}-rebootstrapped
    Libs: -L$out/lib -lpulse
    Cflags: -I$out/include -D_REENTRANT
    EOF

    cat >> $out/lib/pkgconfig/libpulse-simple.pc << EOF
    Name: libpulse-simple
    Description: PulseAudio Simplified Synchronous Client Interface
    Version: ${libpulseaudio.version}-rebootstrapped
    Libs: -L$out/lib -lpulse-simple
    Cflags: -I$out/include -D_REENTRANT
    Requires: libpulse
    EOF

    cat >> $out/lib/pkgconfig/libpulse-mainloop-glib.pc << EOF
    Name: libpulse-mainloop-glib
    Description: PulseAudio GLib 2.0 Main Loop Wrapper
    Version: ${libpulseaudio.version}-rebootstrapped
    Libs: -L$out/lib -lpulse-mainloop-glib
    Cflags: -I$out/include -D_REENTRANT
    Requires: libpulse glib-2.0
    EOF
  '';

  meta = apulse.meta // {
    description = "libpulse without any sound daemons over pure ALSA";
    longDescription = ''
      apulse (${apulse.meta.homepage}) implements most of libpulse
      API over pure ALSA in 5% LOC of the original PulseAudio.

      But apulse is made to be used as a wrapper that substitutes its
      replacement libs into LD_LIBRARY_PATH. The problem with that is
      that you still have to link against the original libpulse.

      pressureaudio (http://git.r-36.net/pressureaudio/) wraps apulse
      with everything you need to replace libpulse completely.

      This derivation is a reimplementation of pressureaudio in pure
      nix.

      You can simply override libpulse with this and most
      packages would just work.
    '';
  };
}