# $Id: Portfile 115368 2014-01-01 02:14:44Z jeremyhu@macports.org $

PortSystem 1.0

name		faac
version		1.28
revision	3
categories	audio
license		Restrictive
maintainers	nomaintainer
description	ISO AAC audio encoder
long_description	FAAC is an AAC audio encoder. FAAC currently supports MPEG-4 \
			LTP, MAIN and LOW COMPLEXITY object types and MAIN and LOW \
			MPEG-2 object types. It also supports multichannel and \
			gapless encoding.

homepage	http://www.audiocoding.com/
platforms	darwin
master_sites	sourceforge:project/faac/faac-src/faac-${version}
checksums           md5     80763728d392c7d789cde25614c878f6 \
                    sha1    d00b023a3642f81bb1fb13d962a65079121396ee \
                    rmd160  03902393488f04223aabdc804bfe77bb32a61c94

patchfiles          patch-configure.in.diff

# TODO: Check ${configure.cxx_stdlib} directly once MacPorts 2.3 is released
platform darwin {
    set cxxstdlib {}

    if {[info exists configure.cxx_stdlib] &&
        ${configure.cxx_stdlib} ne {} &&
        [string match *clang* ${configure.cxx}]} {
        set cxxstdlib ${configure.cxx_stdlib}
    } elseif {[string match *clang* ${configure.cxx}] &&
              ${os.major} >= 13} {
        set cxxstdlib libc++
    } else {
        set cxxstdlib libstdc++
    }

    post-patch {
        if {${cxxstdlib} == "libc++"} {
            reinplace "s:-lstdc\+\+:-lc++:" \
                ${worksrcpath}/frontend/Makefile.am \
                ${worksrcpath}/frontend/Makefile.in
        }
    }
}

configure.cflags-append	"-D__unix__"

use_autoreconf yes
autoreconf.args -fvi

livecheck.url   http://sourceforge.net/projects/${name}/files/${name}-src/
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)"
