# -*- coding: utf-8; 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
# $Id: Portfile 54441 2009-07-27 18:25:33Z toby@macports.org $

PortSystem 1.0

name            libmad
version         0.15.1b
revision        2
categories      audio
maintainers     nomaintainer
description     MPEG Audio Decoder
long_description \
    MAD is a high-quality MPEG audio decoder.  \
    It currently supports MPEG-1 as well as the \
    MPEG-2 extension to Lower Sampling Frequencies.  \
    All three audio layers (Layer I, Layer II, and Layer \
    III a.k.a. MP3) are fully implemented.
homepage        http://www.underbit.com/products/mad/
platforms       darwin freebsd
master_sites    ftp://ftp.mars.org/pub/mpeg/ \
                sourceforge:mad
checksums       md5 1be543bc30c56fb6bea1d7bf6a64e66c

depends_build   port:pkgconfig

patchfiles      patch-configure

post-patch {
    file copy -force ${filespath}/mad.pc.in ${worksrcpath}/mad.pc

    reinplace "s|%PREFIX%|${prefix}|g" ${worksrcpath}/mad.pc
    reinplace "s|%VERSION%|${version}|g" ${worksrcpath}/mad.pc
}

post-destroot {
    file mkdir ${destroot}${prefix}/lib/pkgconfig
    file copy -force ${worksrcpath}/mad.pc ${destroot}${prefix}/lib/pkgconfig
}

livecheck.check regex
livecheck.url   ftp://ftp.mars.org/pub/mpeg/
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*\[a-z\])${extract.suffix}"

universal_variant   no
