# -*- 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.3 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  047343cf08cef8b0057506b26acd0d4bae05f9aa \
                    sha256  3ffb4c3aaa261dd18d8d4def4a2330d498181b4e1ec7f3dd7f1844af85f6d90e \
                    size    344968

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 \
                    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/
}
