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


github.setup        valentjn ltex-ls 16.0.0
github.tarball_from releases
revision            0

categories          devel
supported_archs     noarch
platforms           any
license             MPL-2
maintainers         {judaew @judaew} openmaintainer
homepage            https://valentjn.github.io/ltex

description         LTeX Language Server: LSP language server for LanguageTool\
                    with support for LaTeX, Markdown, and others
long_description    {*}${description}

checksums           rmd160  c8803e7ac8e3185d8768d772bafc8936739c8231 \
                    sha256  956d537d3724aa10a686372f76e21263da8074a3ccff47286f16c8ac2ab92644 \
                    size    243227042

java.version        11+
java.fallback       openjdk17

use_configure       no
build {}

set javadir         ${prefix}/share/java/

destroot {
    xinstall -d ${destroot}${javadir}/${name}

    move ${worksrcpath}/bin ${destroot}${javadir}${name}/bin
    move ${worksrcpath}/lib ${destroot}${javadir}${name}/lib
    delete {*}[glob ${destroot}${javadir}${name}/bin/*.bat]

    ln -s ${javadir}${name}/bin/ltex-cli ${destroot}${prefix}/bin/ltex-cli
    ln -s ${javadir}${name}/bin/ltex-ls ${destroot}${prefix}/bin/ltex-ls

    # add docs
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} \
        ACKNOWLEDGMENTS.md changelog.xml LICENSE.md README.md \
        ${destroot}${prefix}/share/doc/${name}
}
