# -*- 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 1.0
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  2909c13b4edf7178cb99a2809b009c3d8518dfee \
                    sha256  faec7a671331435ddf5be644404a62eef3b6fc0f895811b1f7c6b840e0bec234 \
                    size    4720029

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}
}
