# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                libao
version             1.2.2
categories          audio
maintainers         nomaintainer
description         A Cross-platform Audio Library
long_description    libao is a way to easily add cross-platform audio output to your \
                    program. Output devices are implemented as dynamic plugins, and \
                    OSS, ESD, ALSA, aRTs, PulseAudio, Solaris, and Irix outputs are \
                    currently supported.
homepage            http://www.xiph.org/ao/
platforms           darwin
license             GPL-2+
master_sites        https://gitlab.xiph.org/xiph/libao/repository/${version}/archive.tar.bz2?dummy=

checksums           rmd160  9983f2435a45ad1fc97a2b7f2d60e8f2e6172bfa \
                    sha256  0c79a14c3449c6f8d61222e0c9ab7f58bb87bc9ad6ba831d6d4d80b37b4d525a

use_bzip2           yes

post-extract {
    move [glob ${workpath}/libao-${version}-*] ${worksrcpath}
}

post-patch {
    reinplace "s|/etc/libao.conf|${prefix}/etc/libao.conf|" \
        ${worksrcpath}/doc/config.html \
        ${worksrcpath}/libao.conf.5 \
        ${worksrcpath}/include/ao/ao_private.h \
}

use_autoreconf yes

configure.args      --disable-arts \
                    --disable-esd \
                    --disable-pulse \
                    --without-x

platform darwin {
    post-destroot {
        system "echo default_driver=macosx >> ${destroot}${prefix}/etc/libao.conf"
    }
}

variant esd description {Enable Enlightened Sound Daemon support} {
    depends_lib-append    port:esound
    configure.args-delete --disable-esd
    configure.args-append --enable-esd
}

variant pulse description {Enable PulseAudio support} {
    depends_lib-append    port:pulseaudio
    configure.args-delete --disable-pulse
    configure.args-append --enable-pulse
}

livecheck.type      regex
livecheck.url       https://gitlab.xiph.org/xiph/libao/tags
livecheck.regex     tags/(\\d+(?:\\.\\d+)*)
