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

go.setup            github.com/naggie/dstask 0.28
go.offline_build    no
revision            0

description         \
    Single binary terminal-based TODO manager with git-based sync + markdown \
    notes per task

long_description    \
    {*}${description}. Dstask is a personal task tracker designed to help you \
    focus. It is similar to taskwarrior but uses git to synchronise instead \
    of a special protocol.

categories          office
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  506622d74bc13d28062408b091b88ee744306a09 \
                    sha256  6e0ede0b2b1cf392c04a06fede4935436abb6b488496045da1bd2671c65b24a7 \
                    size    1714043

use_parallel_build  no

build.cmd           make
build.args          dist/dstask

test.run            yes
test.cmd            ${worksrcpath}/dist/dstask help

patch {
    reinplace "s|go build|go build -ldflags \\\"-X github.com/naggie/dstask.VERSION=${version}\\\"|" \
        ${worksrcpath}/Makefile
}

destroot {
    foreach dstask_bin [glob ${worksrcpath}/dist/*] {
        xinstall -m 0755 ${dstask_bin} ${destroot}${prefix}/bin/
    }

    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    xinstall ${worksrcpath}/completions/bash.sh \
        ${destroot}${prefix}/share/bash-completion/completions/${name}

    xinstall -d ${destroot}${prefix}/share/fish/vendor_completions.d
    xinstall ${worksrcpath}/completions/completions.fish \
        ${destroot}${prefix}/share/fish/vendor_completions.d/${name}.fish

    xinstall -d ${destroot}${prefix}/share/zsh/site-functions
    xinstall ${worksrcpath}/completions/zsh.sh \
        ${destroot}${prefix}/share/zsh/site-functions/_${name}
}
