# -*- 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/honza/smithy 0.3.0 v
revision            0

description         A tiny git forge written in Go

long_description    Smithy is a web frontend for git repositories. It's \
                    implemented entirely in Golang, compiles to a single \
                    binary, and it's fast and easy to deploy. Smithy is an \
                    alternative to cgit or gitweb, and doesn't seek to \
                    compete with Gitea and the like.

categories          devel
installs_libs       no
license             GPL-3
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  810936771f1fac343f6b86800293d4b1c56f4b3b \
                    sha256  90e3ebe67692d4e8a07597310263109301eb690b6638e3b8942a4ae47f238e32 \
                    size    85208

go.offline_build no

depends_build-append \
                    port:scdoc

build.cmd           make
build.pre_args      BUILD_VERSION=${github.tag_prefix}${version}
build.args          all

use_parallel_build  no

post-build {
    # fix syntax error in smithy.yml.5.scd
    reinplace -E {s|^`templates\.dir`|\\`templates.dir\\`|} \
        ${worksrcpath}/docs/${name}.yml.5.scd

    system -W ${worksrcpath}/docs "scdoc < ./${name}.1.scd > ${name}.1"
    system -W ${worksrcpath}/docs "scdoc < ./${name}.yml.5.scd > ${name}.yml.5"
}

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

    xinstall -d ${destroot}${prefix}/share/${name}
    copy ${worksrcpath}/${name}.yml ${destroot}${prefix}/share/${name}/

    copy ${worksrcpath}/docs/${name}.1 ${destroot}${prefix}/share/man/man1/
    copy ${worksrcpath}/docs/${name}.yml.5 ${destroot}${prefix}/share/man/man5/
}
