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