# $Id: Portfile 116836 2014-02-08 12:34:59Z hum@macports.org $
# -*- Mode: Tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                portaudio
version             19.20140130
categories          audio devel
platforms           darwin macosx
maintainers         hum openmaintainer
license             MIT

description         PortAudio is a free, cross platform, open-source, audio I/O library.

long_description    PortAudio is a free, cross platform, open-source, audio I/O library. \
                    It lets you write simple audio programs in 'C' or C++ that will \
                    compile and run on many platforms including Windows, \
                    Macintosh OS X, and Unix (OSS/ALSA). \
                    It is intended to promote the exchange of audio \
                    software between developers on different platforms. \
                    Many applications use PortAudio for Audio I/O.

homepage            http://www.portaudio.com/
master_sites        ${homepage}archives

distname            pa_stable_v[strsed ${version} {g/\./_/}]
extract.suffix      .tgz

checksums           rmd160  0a290cea8a102a45b2df9b72046b3eed0ab35b4f \
                    sha256  8fe024a5f0681e112c6979808f684c3516061cc51d3acc0b726af98fc96c8d57

worksrcdir          ${name}

# By default, PortAudio is built as a universal binary.
# To build a non-universal library for the host architecture,
# simply use the --disable-mac-universal option with configure.
# http://www.portaudio.com/trac/wiki/TutorialDir/Compile/MacintoshCoreAudio
configure.args      --disable-mac-universal --enable-cxx

# patch-configure removes -Werror, and adds -DNDEBUG.
patchfiles          patch-configure \
                    patch-ltmain.sh.diff \
                    patch-src__common__pa_types.h

platform darwin {
    if {${os.major} >= 10} {
        patchfiles-append patch-src__hostapi__coreaudio__pa_mac_core.c
    }
}

use_parallel_build  no

post-destroot {
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} \
        README.txt \
        LICENSE.txt \
        ${destroot}${prefix}/share/doc/${name}
    # The build of PyAudio requires pa_mac_core.h.
    xinstall -m 644 ${worksrcpath}/include/pa_mac_core.h \
        ${destroot}${prefix}/include
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.version   [strsed ${version} {g/\./_/}]
livecheck.regex     pa_stable_v(\[0-9._\]+)\\.
