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

name                sinsy
version             0.91
categories          audio japanese
maintainers         nomaintainer

description         HMM-Based Singing Voice Synthesis System
long_description    ${description}

homepage            http://www.sinsy.jp
platforms           darwin
license             BSD

master_sites        sourceforge:${name}
checksums           ${distname}${extract.suffix} \
                    rmd160  3c7a4397d20f6b8d5d1f5fe5ab775cf9e8aafd20 \
                    sha256  b2ccc1b9f277251f495a96cd187f01dc101047b101079176154f5d19dd972880

patchfiles          patch-dic_Makefile.diff

depends_lib         port:hts_engine_API

if {[variant_isset universal]} {
    use_autoreconf  yes
}

configure.args-append  --with-hts-engine-header-path=${prefix}/include \
                       --with-hts-engine-library-path=${prefix}/lib

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS COPYING ChangeLog NEWS README \
        ${destroot}${docdir}
}

default_variants    +voice

set voice_nitech       hts_voice_nitech_jp_song070_f001-0.90
set voice_nitech_dist  ${voice_nitech}${extract.suffix}

variant voice description {Add HTS voices and a demo script} {
    distfiles-append    ${voice_nitech_dist}
    master_sites-append sourceforge:project/sinsy/files/HTS%20voice/${voice_nitech}/
    checksums-append    ${voice_nitech_dist} \
                        rmd160  502e4b10d2a147bc6f3fbc8d609aea123eea1898 \
                        sha256  461c94d2eadd4f81d31ae860527382002cb7bfc5a28b9648bfa96ca89b33b227

    post-destroot {
        # copy voice data.
        set voice_dir    ${prefix}/lib/${name}/voice
        xinstall -d ${destroot}${voice_dir}
        copy ${workpath}/${voice_nitech} ${destroot}${voice_dir}
        # configure an executable demo script file.
        set script_name  sinsy_demo
        set script_dest  ${destroot}${prefix}/bin/${script_name}
        xinstall -m 755 ${filespath}/${script_name} ${script_dest}
        reinplace "s|@PREFIX@|${prefix}|g"          ${script_dest}
    }
}

livecheck.type      regex
livecheck.url       http://sourceforge.net/projects/${name}/files/Sinsy/
livecheck.regex     /${name}-(\[0-9.\]+)/
