# -*- 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

PortSystem                      1.0
PortGroup                       github 1.0

name                            pure-faust
github.setup                    agraef pure-lang 0.13 ${name}-
github.tarball_from             releases
distname                        ${name}-${version}
homepage                        https://github.com/agraef/pure-lang/wiki/Addons#${name}

categories                      pure audio lang
platforms                       darwin
maintainers                     ryandesign gmail.com:aggraef
license                         LGPL-3+

description                     a module which lets you load and run \
                                Faust-generated signal processing modules \
                                in Pure

long_description                ${name} provides ${description}.

checksums                       rmd160  3e0709960ddd749693fb459cfc2e01cbf520ee55 \
                                sha256  5947f8c41e166c9998bd42d90a4a4119a1c7b6962bbf813df5a9839f5f30694a

use_configure                   no

# copied from pure-1.0.tcl
build.args-append               PUREC_FLAGS=-mcpu=generic

pre-build {
    if {${configure.cxx_stdlib} ne "" && [string match "*clang*" [option configure.cxx]]} {
        configure.cxxflags-append -stdlib=${configure.cxx_stdlib}
    }
    build.args-append           CC="${configure.cc}" \
                                CFLAGS="${configure.cflags} ${configure.cc_archflags}" \
                                CPPFLAGS="${configure.cppflags}" \
                                CXX="${configure.cxx}" \
                                CXXFLAGS="${configure.cxxflags} ${configure.cxx_archflags}" \
                                LDFLAGS="${configure.ldflags} ${configure.ld_archflags}"
}

post-destroot {
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    foreach f {COPYING README} {
        if {[file exists ${worksrcpath}/${f}]} {
            xinstall -m 644 ${worksrcpath}/${f} ${destroot}${prefix}/share/doc/${name}
        }
    }
    if {[file exists ${worksrcpath}/examples]} {
        xinstall -d ${destroot}${prefix}/share/examples
        copy ${worksrcpath}/examples ${destroot}${prefix}/share/examples/${name}
    }
}

depends_build-append            port:pkgconfig

depends_lib-append              port:pure \
                                port:libtool
