# $Id: Portfile 92658 2012-05-03 08:49:35Z jeremyhu@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            2
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' that will \
                    compile and run on many platforms including Windows, \
                    Macintosh (8,9,X), Unix (OSS), SGI, and BeOS. \
                    PortAudio is intended to promote the exchange of audio \
                    synthesis software between developers on different \
                    platforms. \
                    PortAudio provides a very simple API for recording and/or \
                    playing sound using a simple callback function. \
                    Example programs are included that synthesize sine waves \
                    and pink noise, perform fuzz distortion on a guitar, list \
                    available audio devices, etc.

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

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

platform darwin {
    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
    }
}

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