# -*- 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/pranshuparmar/witr 0.3.2 v
set git-commit      5feece67c5e1ec6680ae0056daba07aa65158cb3
# This line is for displaying commit in CLI only
revision            1
categories          sysutils
license             Apache-2
maintainers         {i0ntempest @i0ntempest} openmaintainer

description         Why is this running?
long_description    ${name} exists to answer a single question: {*}${description}\
                    It explains where a running thing came from, how it was started,\
                    and what chain of systems is responsible for it existing right now,\
                    in a single, human-readable output or an interactive TUI dashboard.

checksums           rmd160  4b4d9ef8127f96475f5f39fa00a9ecc56471a0ab \
                    sha256  4ba1bdb58845aa74a219e905003c3ea604985fd14162c47419954ece2b35410b \
                    size    2828642

# See https://github.com/pranshuparmar/witr/issues/201, remove in the next release
patchfiles-append   patch-9bfc2a35211805c7f0423db0894f8cd4d1a7bd99.diff
patch.args          -p1

go.offline_build    no

set time [clock format [clock seconds] -gmt true -format "%Y-%m-%dT%H:%M:%SZ"]
build.args          -o ./${name}
build.post_args     -ldflags="-s -w \
                              -X '${go.package}/internal/version.Version=${github.tag_prefix}${version}' \
                              -X '${go.package}/internal/version.Commit=${git-commit}' \
                              -X '${go.package}/internal/version.BuildDate=${time}'"

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
    xinstall -m 0644 ${worksrcpath}/docs/cli/${name}.1 ${destroot}${prefix}/share/man/man1
}
