# -*- 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/xo/usql 0.19.4 v
go.offline_build    no
revision            0

description         Universal command-line interface for SQL databases

long_description    \
    ${name} is a universal command-line interface for PostgreSQL, MySQL, \
    Oracle Database, SQLite3, Microsoft SQL Server, and many other databases \
    including NoSQL and non-relational databases. ${name} provides a simple \
    way to work with SQL and NoSQL databases via a command-line inspired by \
    PostgreSQL's psql. ${name} supports most of the core psql features, such \
    as variables, backticks, and commands and has additional features that \
    psql does not, such as syntax highlighting, context-based completion, \
    and multiple database support.

categories          databases
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  a4a4b00f7128afc2ff0f532d9c521dd2f3d3455b \
                    sha256  61aff0f9448ca9d90894bdf99276186f87b5a91ab196ff45133f34c61475b717 \
                    size    357500

depends_build-append \
                    port:realpath

build.cmd           ./build.sh
build.args          -N -v ${github.tag_prefix}${version}

patch {
    reinplace -E {/^[[:space:]]*TAR=gtar/   d}  ${worksrcpath}/build.sh
    reinplace -E {/^[[:space:]]*sha256sum/  d}  ${worksrcpath}/build.sh
}

destroot {
    xinstall -m 0755 \
        [glob ${worksrcpath}/build/${goos}/*/*/${name}] \
        ${destroot}${prefix}/bin/
}
