# -*- 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                palmkit
version             1.0.32
revision            3
categories          audio textproc japanese
platforms           darwin
maintainers         nomaintainer
license             BSD

description         Publicly Available Language Modeling toolKIT
long_description    ${description}

homepage            http://palmkit.sourceforge.net/
master_sites        ${homepage}

checksums           sha1    c63fdc780ff214c324c2c519219694fe68da90bf \
                    rmd160  c836b42009a819ea12b4c8148eacc27fc0012b7b

worksrcdir          ${distname}/src

# respect build_arch
patchfiles          patch-configure.diff

# fix shebang lines in scripts
patchfiles-append   patch-scripts.diff \
                    patch-src.diff

configure.args      --enable-largefile \
                    --enable-longid

depends_build       port:nkf

use_parallel_build  no

universal_variant   no

set install_srcdir  ${workpath}/${distname}
set src_docdir      ${install_srcdir}/doc
set dest_docdir     ${destroot}${prefix}/share/doc/${name}

post-destroot {
    xinstall -m 755 {*}[glob ${install_srcdir}/bin/*]     ${destroot}${prefix}/bin
    xinstall -m 644 {*}[glob ${install_srcdir}/include/*] ${destroot}${prefix}/include
    xinstall -m 644 {*}[glob ${install_srcdir}/lib/*]     ${destroot}${prefix}/lib
    file mkdir ${dest_docdir}
    xinstall -m 644 {*}[glob ${install_srcdir}/doc/*.eps] ${dest_docdir}
    xinstall -m 644 {*}[glob ${install_srcdir}/doc/*.png] ${dest_docdir}
    # Convert text encodings to UTF-8.
    foreach html_path [glob -directory ${src_docdir} *.html] {
        set html [file tail ${html_path}]
        system "${prefix}/bin/nkf -w ${html_path} > ${dest_docdir}/${html}"
    }
    foreach doc {ChangeLog README.jp} {
        system "${prefix}/bin/nkf -w ${install_srcdir}/${doc} > ${dest_docdir}/${doc}"
    }
}

livecheck.type      regex
livecheck.regex     ${name}-(\[0-9.\]+)\\.
