# -*- 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/terrastruct/d2 0.6.8 v
go.package          oss.terrastruct.com/d2
go.offline_build    no
github.tarball_from archive
revision            0

description         D2 is a modern diagram scripting language that turns text \
                    to diagrams.

long_description    {*}${description}

categories          graphics
installs_libs       no
license             MPL-2
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    {fastmail.com:ivofrolov @ivofrolov} \
                    openmaintainer

fetch.type          git

build.pre_args-append \
                    -o ./bin

build.args          ./...

post-fetch {
    system -W ${worksrcpath} "git submodule update --init --recursive"
}

pre-build {
    file mkdir ${worksrcpath}/bin
}

destroot {
    foreach d2bin {d2plugin-dagre d2} {
        xinstall -m 0755 ${worksrcpath}/bin/${d2bin} ${destroot}${prefix}/bin/
    }
}
