1{ stdenv, lib, fetchFromGitHub, fetchpatch
2, autoreconfHook, pkg-config, libpulseaudio, alsa-lib, libcap
3, CoreAudio, CoreServices, AudioUnit
4, usePulseAudio }:
5
6stdenv.mkDerivation rec {
7 version = "1.2.2";
8 pname = "libao";
9
10 # the github mirror is more up to date than downloads.xiph.org
11 src = fetchFromGitHub {
12 owner = "xiph";
13 repo = "libao";
14 rev = version;
15 sha256 = "0svgk4sc9kdhcsfyvbvgm5vpbg3sfr6z5rliflrw49v3x2i4vxq5";
16 };
17
18 patches = [
19 # add header time.h for nanosecond
20 (fetchpatch {
21 name = "nanosecond-header.patch";
22 url = "https://github.com/xiph/libao/commit/1f998f5d6d77674dad01b181811638578ad68242.patch";
23 hash = "sha256-cvlyhQq1YS4pVya44LfsKD1R6iSOONsHJGRbP5LlanQ=";
24 })
25 ];
26
27 configureFlags = [
28 "--disable-broken-oss"
29 "--enable-alsa-mmap"
30 ];
31
32 outputs = [ "out" "dev" "man" "doc" ];
33
34 buildInputs = [ ] ++
35 lib.optional usePulseAudio libpulseaudio ++
36 lib.optionals stdenv.isLinux [ alsa-lib libcap ] ++
37 lib.optionals stdenv.isDarwin [ CoreAudio CoreServices AudioUnit ];
38
39 nativeBuildInputs = [ autoreconfHook pkg-config ];
40
41 meta = with lib; {
42 longDescription = ''
43 Libao is Xiph.org's cross-platform audio library that allows
44 programs to output audio using a simple API on a wide variety of
45 platforms.
46 '';
47 homepage = "https://xiph.org/ao/";
48 license = licenses.gpl2;
49 maintainers = [ ];
50 platforms = with platforms; unix;
51 };
52}