about summary refs log tree commit diff
path: root/pkgs/development/libraries/pcaudiolib/default.nix
blob: 1152283b1f2c3ae58737ce334b94ca4a1ea3bdd9 (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
{ config
, lib
, stdenv
, fetchFromGitHub
, alsa-lib
, autoconf
, automake
, libpulseaudio
, libtool
, pkg-config
, portaudio
, which
, pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "pcaudiolib";
  version = "1.2";

  src = fetchFromGitHub {
    owner = "espeak-ng";
    repo = "pcaudiolib";
    rev = finalAttrs.version;
    hash = "sha256-ZG/HBk5DHaZP/H3M01vDr3M2nP9awwsPuKpwtalz3EE=";
  };

  nativeBuildInputs = [
    autoconf
    automake
    libtool
    pkg-config
    which
  ];

  buildInputs = [
    portaudio
  ]
  ++ lib.optional stdenv.hostPlatform.isLinux alsa-lib
  ++ lib.optional pulseaudioSupport libpulseaudio;

  # touch ChangeLog to avoid below error on darwin:
  # Makefile.am: error: required file './ChangeLog.md' not found
  preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
    touch ChangeLog
  '' + ''
    ./autogen.sh
  '';

  meta = with lib; {
    homepage = "https://github.com/espeak-ng/pcaudiolib";
    description = "Provides a C API to different audio devices";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ aske ];
    platforms = platforms.unix;
  };
})