# -*- 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           cargo   1.0
PortGroup           github  1.0

github.setup        roapi roapi 0.12.4 roapi-v
github.tarball_from archive
revision            0

subport columnq     {}

categories          textproc
installs_libs       no
license             Apache-2
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           ${distname}${extract.suffix} \
                    rmd160  c7661fa0dfce7a972b509187c152a884bb36093a \
                    sha256  93eaccd70b7b21d0d8f349d6ad594761b8c4ecba884c7106cfefa37d86e3649c \
                    size    345038

set bin_name        ${name}

if {${subport} eq ${name}} {
    # roapi

    homepage        https://roapi.github.io/docs/

    description     \
        Create full-fledged APIs for slowly moving datasets without writing a \
        single line of code.

    long_description \
        ROAPI automatically spins up read-only APIs for static datasets \
        without requiring you to write a single line of code. It builds on \
        top of Apache Arrow and Datafusion. The core of its design can be \
        boiled down to the following: \
        - Query frontends to translate SQL, GraphQL and REST API queries into \
          Datafusion plans. \
        - Datafusion for query plan execution. \
        - Data layer to load datasets from a variety of sources and formats \
          with automatic schema inference. \
        - Response encoding layer to serialize intermediate Arrow record \
          batch into various formats requested by client.

} else {
    # columnq
    set bin_name    columnq

    version         0.5.2

    description     \
        Simple CLI to help you query tabular data with support for a rich \
        set of growing formats and data sources.

    long_description \
        {*}${description} It supports JSON, CSV, Parquet, Arrow and all \
        other formats that are supported by ROAPI, which is documented at \
        here.  It also supports querying datasets from remote locations like \
        S3 and HTTPs, see ROAPI's blob store documentation for more info.

}

depends_build-append \
                    path:bin/cmake:cmake

build.pre_args-delete \
                    --frozen --locked

build.args-append   --bin ${bin_name}

destroot {
    xinstall -m 0755 \
        ${worksrcpath}/target/[cargo.rust_platform]/release/${bin_name} \
        ${destroot}${prefix}/bin/
}
