about summary refs log tree commit diff
path: root/pkgs/development/libraries/libao/default.nix
blob: 6c6743b2b55e8b7165febce7dd193b2d34fbbc87 (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
{ stdenv, lib, fetchFromGitHub, fetchpatch
, autoreconfHook, pkg-config, libpulseaudio, alsa-lib, libcap
, CoreAudio, CoreServices, AudioUnit
, usePulseAudio }:

stdenv.mkDerivation rec {
  version = "1.2.2";
  pname = "libao";

  # the github mirror is more up to date than downloads.xiph.org
  src = fetchFromGitHub {
    owner  = "xiph";
    repo   = "libao";
    rev    = version;
    sha256 = "0svgk4sc9kdhcsfyvbvgm5vpbg3sfr6z5rliflrw49v3x2i4vxq5";
  };

  patches = [
    # add header time.h for nanosecond
    (fetchpatch {
      name = "nanosecond-header.patch";
      url = "https://github.com/xiph/libao/commit/1f998f5d6d77674dad01b181811638578ad68242.patch";
      hash = "sha256-cvlyhQq1YS4pVya44LfsKD1R6iSOONsHJGRbP5LlanQ=";
    })
  ];

  configureFlags = [
    "--disable-broken-oss"
    "--enable-alsa-mmap"
  ];

  outputs = [ "out" "dev" "man" "doc" ];

  buildInputs = [ ] ++
    lib.optional  usePulseAudio   libpulseaudio ++
    lib.optionals stdenv.hostPlatform.isLinux  [ alsa-lib libcap ] ++
    lib.optionals stdenv.hostPlatform.isDarwin [ CoreAudio CoreServices AudioUnit ];

  nativeBuildInputs = [ autoreconfHook pkg-config ];

  meta = with lib; {
    longDescription = ''
      Libao is Xiph.org's cross-platform audio library that allows
      programs to output audio using a simple API on a wide variety of
      platforms.
    '';
    homepage = "https://xiph.org/ao/";
    license = licenses.gpl2;
    maintainers = [ ];
    platforms = with platforms; unix;
  };
}