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

name                qjackctl
version             0.6.2
license             GPL-2+
categories          audio
maintainers         nomaintainer
platforms           darwin
homepage            http://qjackctl.sourceforge.net/

description \
    QjackCtl is a simple Qt application to control the JACK sound server daemon.
long_description \
    Provides a simple GUI dialog for setting several JACK daemon parameters, \
    which are properly saved between sessions, and a way control of the status \
    of the audio server daemon. With time, this primordial interface has become \
    richer by including a enhanced patchbay and connection control features.

master_sites        http://downloads.sourceforge.net/qjackctl

checksums           rmd160  b6349402c406b3d5a2eb6694c3528ef0b25350d6 \
                    sha256  1ec77d0e8edac1b4d60a32a08d2f4329f90571801920cb48c6147e0eae6f50e6 \
                    size    1027742

universal_variant   no

depends_lib-append  \
    port:jack

qt5.depends_component \
    qtbase \
    qttools

compiler.cxx_standard 2011
configure.cxxflags-append \
    -std=c++11

post-patch {
    # fix jackd path
    reinplace "s|\"/Server\", \"jackd\"|\"/Server\", \"${prefix}/bin/jackd\"|" ${worksrcpath}/src/qjackctlSetup.cpp
}

configure.args-append \
    --with-jack=${prefix} \
    --disable-alsa-seq \
    --with-qt=${qt_dir} \
    --disable-debug

configure.args-delete \
    --disable-dependency-tracking

variant debug description "Enable debugging" {}

if {[variant_isset debug]} {
    configure.args-append --enable-debug
} else {
    configure.args-append --disable-debug
}

variant portaudio description "enable PortAudio interface" {}

if {[variant_isset portaudio]} {
    configure.args-append --enable-portaudio
    depends_lib-append    port:portaudio
} else {
    configure.args-append --disable-portaudio
}

variant stacktrace description "enable debugger stack-trace" {}

if {[variant_isset stacktrace]} {
    configure.args-append --enable-stacktrace
} else {
    configure.args-append --disable-stacktrace
}

variant dbus description "enable D-Bus interface" {}

if {[variant_isset dbus]} {
    configure.args-append --enable-dbus
} else {
    configure.args-append --disable-dbus
}

post-destroot {
    # move the created .app to MacPorts' applications directory ...
    move ${destroot}${prefix}/bin/qjackctl.app ${destroot}${applications_dir}
    # ... and link the actual executable back to the bindir
    ln -s ${applications_dir}/qjackctl.app/Contents/MacOS/qjackctl ${destroot}${prefix}/bin/qjackctl
}

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