# -*- 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/mvdan/sh 3.8.0 v
name                shfmt
categories          devel
maintainers         {amake @amake} openmaintainer
license             BSD

description         Autoformat shell script source code

long_description    A shell script formatter supporting POSIX shell, Bash, and mksh.

go.package          mvdan.cc/sh

checksums           ${distname}${extract.suffix} \
                        rmd160  6a0da9e86619f455727357e703f4ff56e51dfecc \
                        sha256  d3525e9909dd125581fb541936bb87520fed7815defb45c873e15a54c41d822d \
                        size    221674

go.vendors          mvdan.cc/editorconfig \
                        repo    github.com/mvdan/editorconfig \
                        lock    1925077f8eb2 \
                        rmd160  f17d34cce7342831407f81a609d5e058fbec7652 \
                        sha256  f3ab1e3faa38e3edcf713924921499f767c75e13d44f3b8b69da0b6b0222c94d \
                        size    10289 \
                    golang.org/x/tools \
                        lock    v0.17.0 \
                        rmd160  4a5f6ce5caf69fd8635ff0829b1497270a3a3d9c \
                        sha256  5604847c26fd185fea7332c57ca2fb17e6cc3c7429c93b30e8cc5fc5c919e13e \
                        size    3640782 \
                    golang.org/x/term \
                        lock    v0.17.0 \
                        rmd160  31ced8e78b09ea4d3033ec24f1f27f221f9e4648 \
                        sha256  a83f4b75c5448d85a9167b3bec3f45d7a7564088ce376cf0c26b7dd2bff1d563 \
                        size    14743 \
                    golang.org/x/sys \
                        lock    v0.17.0 \
                        rmd160  bc96655eb5e0e6a21c3c7faf4197a25b5e974f53 \
                        sha256  5f94836d82aa1bbb99219d62a5a379b2b36f62dd8ea59207dcbb86b35eae5b1d \
                        size    1446795 \
                    golang.org/x/sync \
                        lock    v0.6.0 \
                        rmd160  f9a1a924a702fc4a3679db3dc36c58ca5b2eba0a \
                        sha256  b4e9aa29dbb296cc2ebfd679927b1789078d5743385b26c0656a24da89fdcee9 \
                        size    17596 \
                    github.com/rogpeppe/go-internal \
                        lock    v1.12.0 \
                        rmd160  ed748fa7713fcb28a8b0dd08c130eb4e61bf2a74 \
                        sha256  4e8a59559866e8e6a75f92ec826e6374c8d866da21ff8bb62b3eab3092214513 \
                        size    116901 \
                    github.com/pkg/diff \
                        lock    20ebb0f2a09e \
                        rmd160  f8336f7442e9394b64a6aad23a6ae1d6a230dfc4 \
                        sha256  086dfcc0449ef79f412e6308fd2ace2207a8a88cde2c86f13f77635673e08890 \
                        size    200592 \
                    github.com/kr/text \
                        lock    v0.2.0 \
                        rmd160  48558c7e8ff67d510f83c66883907e95f4783163 \
                        sha256  2f2e21ac8a9d523e88cbba4039441defc4a66bfaa78811c900a88fcf28729c4c \
                        size    8702 \
                    github.com/kr/pretty \
                        lock    v0.3.1 \
                        rmd160  8c08579b4c56cdc958794e77afe3413e80aa67c3 \
                        sha256  7fcea475d6280976cf4a838e75d2b3a4105827316e588a80e49e8063d950c999 \
                        size    10232 \
                    github.com/google/renameio \
                        lock    v2.0.0 \
                        rmd160  3e5bee752f1d83bcb6b2598ff5fdc2be13f69cfc \
                        sha256  7aba06e13c302f23c133799fbc596417832109f674e35b686a9e19223968441c \
                        size    14223 \
                    github.com/google/go-cmp \
                        lock    v0.6.0 \
                        rmd160  2c9f5dab93f8a0895591466fe4a07c5dd9166ae2 \
                        sha256  0d550825fae514f8a947ab7e42fcb874f509d9cbfa3ad2711d7570a25f31571a \
                        size    104795 \
                    github.com/frankban/quicktest \
                        lock    v1.14.6 \
                        rmd160  d517a6cb2f6acc7f969c9ed49f464014a717bf98 \
                        sha256  0142a3dd40b949b4d7e86768020e5f3c08fe026447458fd975b1b4c1f18b0745 \
                        size    40112 \
                    github.com/creack/pty \
                        lock    v1.1.21 \
                        rmd160  6f0252fc288157bb3a4ef437139a3627d0e4f5a1 \
                        sha256  4cf13bc8303ab89680d9109d89170b74b6822963471d48b548666a38ea1e2d80 \
                        size    20134

build.pre_args      -ldflags '-X main.version=${version}'
build.post_args     ${go.package}/cmd/shfmt

depends_build-append  port:scdoc

post-build {
    system -W ${worksrcpath} "scdoc < cmd/shfmt/shfmt.1.scd | gzip > shfmt.1.gz"
}

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

github.livecheck.regex  {([0-9.]+)}
