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

github.setup            grame-cncm faustlive f7edb2ff41d4987fb302fbce51723616eb728f19
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
version                 2.46-20181019
revision                3

name                    faustlive-devel
categories              audio
platforms               darwin
maintainers             {ryandesign @ryandesign} {gmail.com:aggraef @agraef}
license                 GPL-3

description             a graphical frontend to the Faust compiler

long_description        FaustLive is ${description}. \
                        It provides an advanced self-contained prototyping \
                        environment for the Faust programming language with \
                        an ultra-short edit-compile-run cycle. \
                        Thanks to its fully embedded compilation chain, \
                        FaustLive is simple to install and doesn't require \
                        any external compiler, development toolchain or SDK \
                        to run. Faust programs can be compiled and run on the \
                        fly by simple drag and drop. They can even be edited \
                        and recompiled while running without interrupting \
                        sound or disconnecting the Jack audio server.

homepage                http://faust.grame.fr/

fetch.type              git
post-fetch {
    system -W ${worksrcpath} "git submodule update --init"
}

set llvm_version        3.4
if {${os.platform} eq "darwin" && ${os.major} > 14} {
    # clang 3.4 isn't supported in the latest macOS versions any more, go with LLVM 7.0 instead.
    set llvm_version    7.0
}

set llvm_prefix         ${prefix}/libexec/llvm-${llvm_version}
build.env               PATH=${llvm_prefix}/bin:$env(PATH)

depends_build           port:faust-devel \
                        port:clang-${llvm_version} \
                        port:llvm-${llvm_version}

depends_lib             port:curl \
                        port:libmicrohttpd \
                        port:liblo \
                        port:libsndfile \
                        path:lib/libssl.dylib:openssl \
                        port:qrencode

use_configure           no

build.args              STATIC=1

destroot.args           APPDIR=${applications_dir}

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${subport}
    xinstall -d ${docdir}/FilesToConfigure
    xinstall -m 644 -W ${worksrcpath} \
        GPL.txt \
        Build/Darwin/README.txt \
        Build/Darwin/Distributions/READ_ME_BEFORE_YOU_START.pdf \
        Build/Darwin/Distributions/Whats_New.pdf \
        Documentation/faust-quick-reference.pdf \
        Documentation/UserManual.pdf \
        ${docdir}
    xinstall -m 644 -W ${worksrcpath}/Build/Darwin/Distributions \
        DefaultDSP.dsp \
        DefaultDSP.lib \
        process.svg \
        ${docdir}/FilesToConfigure
}

variant jack description {Enable Jack support} {
    depends_lib-append  port:jack
    build.args-append   JACK=1
}

variant qt4 conflicts qt5 description {Build with Qt4 support} {
    depends_lib-append  port:qt4-mac
    build.args-append   qm=${prefix}/libexec/qt4/bin/qmake
}

variant qt5 conflicts qt4 description {Build with Qt5 support} {
    depends_lib-append  port:qt5
    build.args-append   qm=${prefix}/libexec/qt5/bin/qmake
}

if {![variant_isset qt4] && ![variant_isset qt5]} {
    default_variants    +qt4
}

# fixme
livecheck.type          none
