# -*- 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           cmake 1.1
PortGroup           java 1.0

name                nyquist
version             3.24
revision            0
categories          audio lang
license             BSD
maintainers         {makr @mohd-akram} openmaintainer

description         sound synthesis and composition language

long_description    Nyquist is a sound synthesis and composition language \
                    offering a Lisp syntax as well as an imperative language \
                    syntax and a powerful integrated development environment. \
                    Nyquist is an elegant and powerful system based on \
                    functional programming.

homepage            https://www.cs.cmu.edu/~music/nyquist/
master_sites        sourceforge:project/${name}/${name}/${version}

distname            nyqsrc[string map {. {}} ${version}]
use_zip             yes

checksums           rmd160  6a5e541deb567d711bb38f9fd725b98c1564b26a \
                    sha256  a3c633a728f95bf5bbdc165833db6d125ef165bb872669abf4290ac9b60dd507 \
                    size    12909307

worksrcdir          ${name}

java.version        11+
java.deptypes       build run

patchfiles          patch-nyquist-dir.diff

post-patch {
    reinplace "s|@NYQUIST_DIR@|${prefix}/share/${name}|" \
        ${worksrcpath}/jnyqide/MainFrame.java
    reinplace "s|svn export|cp -R|g;s|closefile|closeFile|g;s|openfile|openFile|g" \
        ${worksrcpath}/jnyqide/make-osx-app.sh
}

cmake.out_of_source no

destroot {
    copy ${worksrcpath}/nyquist-install/nyquist ${destroot}${prefix}/share
    copy ${worksrcpath}/nyquist-install/NyquistIDE.app \
        ${destroot}${applications_dir}
    ln -s ${applications_dir}/NyquistIDE.app/Contents/Java/ny \
        ${destroot}${prefix}/bin
}
