# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 88744 2012-01-10 08:59:30Z ryandesign@macports.org $

PortSystem              1.0

name                    faust
version                 0.9.46
categories              audio lang
platforms               darwin
maintainers             ryandesign
license                 GPL-2
master_sites            sourceforge:project/faudiostream
homepage                http://faust.grame.fr/

description             functional programming language for realtime audio

long_description        Faust is a functional programming language \
                        specifically designed for realtime audio applications \
                        and plugins.

checksums               rmd160  4071de856a9309646b7180f03e6bdbe4c34b9195 \
                        sha256  b60e239a05cef6c921c1a1a07b96d1ac0338cba12eb2e50ff7278942491e8249

patchfiles-append       patch-prefix.diff

post-patch {
    eval reinplace "s|/usr/local|${prefix}|g" \
        ${worksrcpath}/compiler/parser/enrobage.cpp \
        ${worksrcpath}/compiler/tlib/compatibility.cpp \
        ${worksrcpath}/tools/scbuilder/scbuilder \
        [glob ${worksrcpath}/tools/faust2appls/faust2*]
    fs-traverse f ${worksrcpath} {
        switch [file rootname [file tail ${f}]] {
            Makefile {
                reinplace "s|/usr/local|${prefix}|g" ${f}
                reinplace "s|/opt/local|${prefix}|g" ${f}
            }
        }
    }
}

use_configure           no

variant universal {}

build.args-append       prefix=${prefix} \
                        CXX="${configure.cxx} [get_canonical_archflags]"

destroot.destdir        prefix=${destroot}${prefix}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        COPYING \
        README \
        ${docdir}
}

livecheck.type          regex
livecheck.url           http://sourceforge.net/projects/faudiostream/files/
livecheck.regex         ${name}-(\[0-9a-z.\]+)\\.tar
