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

github.setup        liquidaty zsv 1.4.4 v
github.tarball_from archive
revision            0

description         \
    ${name}: world's fastest (simd) CSV parser, with an extensible CLI


long_description    \
    ${name} is a fast CSV parser library and extensible command-line utility. \
    It achieves high performance using SIMD operations, efficient memory use \
    and other optimization techniques.

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

checksums           rmd160  26b07a807129ac3ed403664870631170617110a4 \
                    sha256  99486b6901d6b576bf15afceb0bcc888ceeb3f555a6d489547eefe67eff52079 \
                    size    13439037

patchfiles-append   patch-app-Makefile-destdir.diff \
                    patch-src-Makefile-destdir.diff

depends_build-append \
                    port:realpath

# cc1: error: unrecognized command line option "-std=gnu11"
compiler.c_standard 2011

configure.args-append \
                    --arch=none \
                    --force-avx2=no \
                    --force-avx=no

use_configure       yes
use_parallel_build  no

# Release archives do not contain the Git metadata used by the Makefiles.
build.args-append   VERSION=${version}
destroot.args-append VERSION=${version}

if {$subport eq $name} {

    depends_lib-append \
                    port:libzsv \
                    port:jq \
                    port:ncurses \
                    port:pcre2

    configure.args-append \
                    --jq-prefix=${prefix} \
                    --pcre2-8-prefix=${prefix}

    build.args-append PCRE2_STATIC=0
    destroot.args-append PCRE2_STATIC=0

    build.pre_args  -C app
    build.args-append build-cli

    destroot.pre_args-append \
                    -C app
}

subport libzsv {

    description     \
        (Library) {*}${description}

    long_description \
        (Library) {*}${long_description}

    build.pre_args  -C src
    build.args-append build

    installs_libs   yes

    configure.args-append --minimal=yes

    destroot.pre_args-append \
                    -C src
}
