# $Id: Portfile 106319 2013-05-22 13:08:54Z 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.20111121
revision            4
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  cd6a38824eb6ece1aae24494b6d05451c42dc319 \
                    sha256  9c26d1330d506496789edafe55b0386f20d83c4aa2c0e3f81fbeb0f114ab1b99

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-src__common__pa_types.h \
                    patch-clang.diff

platform darwin {
    # patch-IOerror.diff is a fix for "Input overflowed" IOError; see #39150.
    patchfiles-append patch-IOerror.diff
    if {${os.major} >= 10} {
        patchfiles-append patch-src__hostapi__coreaudio__pa_mac_core.c
    }
    if {${os.major} >= 11} {
        # patch-include__pa_mac_core.h.diff is for Lion (10.7); see #30251.
        patchfiles-append patch-include__pa_mac_core.h.diff
    }
}

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._\]+)\\.
