# -*- 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                juman6
version             6.01
revision            1
categories          textproc japanese
maintainers         nomaintainer

description         a user-extensible morphological analyzer for Japanese.
long_description    ${description}

homepage            http://nlp.ist.i.kyoto-u.ac.jp/index.php?JUMAN
license             BSD

master_sites        http://nlp.kuee.kyoto-u.ac.jp/nl-resource/juman/
dist_subdir         juman
distname            juman-${version}
checksums           sha1    aeca5d50b803e7b659a7e70501db1157c5ebc005 \
                    rmd160  562773845e75bce157d027f541a47dd3b1846051

if {${os.major} >= 12 && ${os.platform} eq "darwin"} {
    patchfiles-append patch-sed.diff
}

if {${universal_possible} && [variant_isset universal]} {
    patchfiles-append patch-automake-1.13.diff
    use_autoreconf  yes
}

# install the distribution into ${prefix_juman6}.
set prefix_juman6   ${prefix}/lib/${name}
configure.pre_args  --prefix=${prefix_juman6}

# install juman6 as an executable.
post-destroot {
    ln -s ${prefix_juman6}/bin/juman ${destroot}${prefix}/bin/juman6
}

platform darwin arm {
    depends_build-append    port:automake

    post-patch {
        # Use newer config.guess and config.sub to support Apple Silicon.
        set automake_dirs [glob -directory ${prefix}/share automake-*]
        set automake_dir [lindex [lsort -command vercmp $automake_dirs] end]
        copy -force ${automake_dir}/config.guess ${automake_dir}/config.sub \
            ${worksrcpath}
    }
}

livecheck.type      none
