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

# configure script checks endianness.
PortGroup           muniversal 1.0

name                stk
version             4.5.0
revision            1
categories          audio
platforms           darwin
maintainers         ryandesign openmaintainer
license             MIT

description         open source audio signal processing and algorithmic \
                    synthesis classes

long_description    The Synthesis ToolKit in C++ (STK) is a set of open source \
                    audio signal processing and algorithmic synthesis classes \
                    written in the C++ programming language. \
                    STK was designed to facilitate rapid development of music \
                    synthesis and audio processing software, with an emphasis \
                    on cross-platform functionality, realtime control, ease of \
                    use, and educational example code. \
                    The Synthesis ToolKit is extremely portable (it's mostly \
                    platform-independent C and C++ code), and it's completely \
                    user-extensible (all source included, no unusual \
                    libraries, and no hidden drivers). \
                    We like to think that this increases the chances that our \
                    programs will still work in another 5-10 years. \
                    In fact, the ToolKit has been working continuously for \
                    nearly 20 years now. \
                    STK currently runs with realtime support (audio and MIDI) \
                    on Linux, OS X, and Windows computer platforms. \
                    Generic, non-realtime support has been tested under \
                    NeXTStep, Sun, and other platforms and should work with \
                    any standard C++ compiler.

homepage            https://ccrma.stanford.edu/software/stk/
master_sites        ${homepage}release/

checksums           rmd160  a37dcae6792f395f6c74491dfeb9fa02224927e3 \
                    sha256  619f1a0dee852bb2b2f37730e2632d83b7e0e3ea13b4e8a3166bf11191956ee3

set rawwave_path    ${prefix}/share/stk/rawwaves/

patchfiles          patch-configure.ac.diff \
                    patch-include-Stk.h.diff \
                    patch-src-Makefile.in.diff

post-patch {
    reinplace "s|@RAWWAVE_PATH@|${rawwave_path}|g" ${worksrcpath}/include/Stk.h
}

use_autoreconf      yes

# configure script does not use provided CFLAGS, CXXFLAGS, LDFLAGS.
merger_arch_compiler yes
merger_arch_flag    no

configure.args      --disable-static \
                    --enable-shared \
                    RAWWAVE_PATH="${rawwave_path}"

build.env           DYLD_LIBRARY_PATH=${worksrcpath}/src

post-destroot {
    xinstall -d ${destroot}${rawwave_path}
    copy {*}[glob ${worksrcpath}/rawwaves/*] ${destroot}${rawwave_path}
}

livecheck.type      regex
livecheck.url       ${homepage}download.html
livecheck.regex     /${name}-(\[0-9.\]+)${extract.suffix}