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

name                gopls
categories          devel
license             BSD
maintainers         {ra1nb0w @ra1nb0w} \
                    {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer
description         gopls is the official language server for the Go language
long_description    {*}${description}

go.setup            golang.org/x/tools 0.24.0 gopls/v
go.toolchain_min    1.26.0
go.offline_build    no

# The tag's archive is named tools-<version>.tar.gz, which collides with
# golang.org/x/tools' own same-numbered releases in the shared go distfiles
# directory, so keep gopls' archives apart.
dist_subdir         ${name}
revision            0

checksums           rmd160  d67993151ee960f6b6d6108c470874a89a7d5405 \
                    sha256  5ecc22f581cafe4039873e2f28e0d045efecfb0dfc6ea51ee1345daa694cb6a9 \
                    size    8722459

build.dir           ${worksrcpath}/${name}

test.run            yes
test.cmd            ${worksrcpath}/${name}/gopls version

github.livecheck.regex  {([0-9.]+)}

destroot {
    xinstall -m 0755 ${worksrcpath}/${name}/${name} \
        ${destroot}${prefix}/bin/${name}

    set dest_doc ${destroot}${prefix}/share/doc/${name}
    xinstall -d -m 0755 ${dest_doc}
    xinstall -m 0644 {*}[glob ${worksrcpath}/${name}/doc/*.md] ${dest_doc}
    copy ${worksrcpath}/${name}/doc/design ${dest_doc}
}
