# -*- 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

name                    gawkextlib
categories              lang textproc
maintainers             {ryandesign @ryandesign} openmaintainer
license                 GPL-3+

homepage                https://gawkextlib.sourceforge.net
master_sites            sourceforge:project/gawkextlib

depends_lib-append      port:gawk \
                        port:gettext-runtime

configure.args-append   --with-gawk=${prefix}

test.run                yes
test.target             check

if {${subport} eq ${name}} {
    version             1.0.4
    revision            0
    checksums           rmd160  aa5dc9fb36b03670496119fca9733ccdb33a35fa \
                        sha256  ecd06c1857f58530f73866dffb74a32f17d1194c045f351b5ab8acad4f77678c \
                        size    352608

    description         extension library for gawk

    long_description    Formerly an experimental fork of gawk called \
                        xgawk, ${name} provides a library containing \
                        some gawk extension API additions useful for \
                        writing gawk extensions, and its subports \
                        offer several extensions that enhance the \
                        functionality of gawk.
} else {
    set extension       [string range ${subport} 5 end]
    homepage            ${homepage}/${extension}/${extension}.html

    description         ${extension} extension for gawk

    long_description    {*}${description}
}

subport gawk-abort {
    version             1.0.1
    revision            0
    checksums           rmd160  027f25513de3e14e2cd03643e795d164e5ab7443 \
                        sha256  61a007421159607131d0b7d730948b696db2d03694bac40eb54265a5c9c023b5 \
                        size    387359
}

subport gawk-aregex {
    version             1.1.0
    revision            0
    checksums           rmd160  784c165e6f35e007ec8169452ba799df4bd816b2 \
                        sha256  dcbf5fd243a1ea09d5c5de7e49a2c15aadc78646b2100359d4ce834df0e47afe \
                        size    391996

    depends_lib-append  port:${name} \
                        port:tre

    configure.args-append \
                        --with-gawkextlib=${prefix}
}

subport gawk-errno {
    version             1.1.1
    revision            0
    checksums           rmd160  4788354f5ff364643e842a52abeb18e1d35fb151 \
                        sha256  95851395247868ebd8d2f934f160b57753ef28fdd4a547b4665166f4325675c4 \
                        size    415489
}

subport gawk-gd {
    version             1.0.3
    revision            0
    checksums           rmd160  568fdc0f952539a376a261004c526dbc2c8556fa \
                        sha256  059406fc0b72c38ca14f422136e3bd29e41ae8acd73440ddd8e743b83340b1ea \
                        size    546661

    depends_lib-append  port:${name} \
                        port:gd2

    configure.args-append \
                        --with-gawkextlib=${prefix} \
                        --with-gd=${prefix}
}

subport gawk-haru {
    version             1.0.2
    revision            0
    checksums           rmd160  a3136b24dd60412789f7076db73f161cfb7fd9d8 \
                        sha256  92fb8d83b71de2fe2aec0bc2468459e728290e0c675ca8c19aaf195ba3cad9b6 \
                        size    426048

    depends_lib-append  port:${name} \
                        port:libharu

    configure.args-append \
                        --with-gawkextlib=${prefix} \
                        --with-haru=${prefix}
}

subport gawk-json {
    version             2.1.0
    revision            0
    checksums           rmd160  ad2e61c1351a402c251d80b7c0bd7a22ff3d43f7 \
                        sha256  478b22124c6ff4901826fbe8f6cc91b26000bb7499d737493cd4cbc1b734c2e2 \
                        size    450947

    depends_build-append \
                        port:rapidjson
}

subport gawk-lmdb {
    version             1.1.3
    revision            0
    checksums           rmd160  a93970fb4b7336dceca547a9aa7ba2127bb0fc00 \
                        sha256  e3d0b899f2f56c0158404d105f1812fa8886bccd45adc3b9dd7da851005aa422 \
                        size    427795

    depends_lib-append  port:${name} \
                        port:lmdb

    configure.args-append \
                        --with-gawkextlib=${prefix} \
                        --with-lmdb=${prefix}
}

subport gawk-mpfr {
    version             1.1.0
    revision            0
    checksums           rmd160  4590b0b8859fb32246e6ebd9fcf67638b40bca0d \
                        sha256  295d9e83fdca0703f74c3de58b387317a7b6d1a5b3d45104aee2d279e5676d10 \
                        size    546567

    depends_lib-append  port:${name} \
                        port:gmp \
                        port:mpfr

    configure.args-append \
                        --with-gawkextlib=${prefix} \
                        --with-gmp=${prefix} \
                        --with-mpfr=${prefix}
}

subport gawk-nl_langinfo {
    version             1.1.0
    revision            0
    checksums           rmd160  69c213c93b282d3e665a84e197bb4635f46f9b09 \
                        sha256  3d8a208b9e180be5ff287bd41002cdf38ee859083a0b4e7315c1568f05054b28 \
                        size    414061
}

subport gawk-pgsql {
    version             1.1.2
    revision            0
    checksums           rmd160  23ccadb50f2756d7da9b13cc3cd82bc53afe62e6 \
                        sha256  a258385265ce254c967cf47ad9288a65f5b5d40c626911dfab78fac3e344f170 \
                        size    562941

    set pgsql_version   16

    depends_lib-append  port:${name} \
                        port:postgresql${pgsql_version}

    configure.args-append \
                        --with-gawkextlib=${prefix}

    configure.env-append \
                        "PATH=${prefix}/lib/postgresql${pgsql_version}/bin:$env(PATH)"

    configure.cppflags-prepend \
                        -I${prefix}/include/postgresql${pgsql_version}

    configure.ldflags-prepend \
                        -L${prefix}/lib/postgresql${pgsql_version}
}

subport gawk-redis {
    version             1.7.8
    revision            2
    checksums           rmd160  0e77a657c68890a715d39810e189e256cdead5b8 \
                        sha256  1c462f2630f62bbfc14f3248358abd7d7646b964e5514473a1059f69b1f11109 \
                        size    456229

    depends_lib-append  port:hiredis

    configure.args-append \
                        --with-hiredis=${prefix}
}

subport gawk-select {
    version             1.1.4
    revision            0
    checksums           rmd160  848b4a1d40a7979a74fa338e11d92588646042d5 \
                        sha256  35fbaf4180851c9230dc2fa5272b669d77842ee4bfedbbdbb534e92219f99bcd \
                        size    425879

    depends_lib-append  port:${name}

    configure.args-append \
                        --with-gawkextlib=${prefix}
}

subport gawk-timex {
    version             1.0.0
    revision            0
    checksums           rmd160  1c55b76ece8e5a0d9b6a00c26cf1135401b12c5a \
                        sha256  131ba120ae013ef8e49c5f16904e5a27bfb65ff5bdb9008dd7474b352e127524 \
                        size    390366
}

subport gawk-xml {
    version             1.1.2
    revision            0
    checksums           rmd160  df266a615b3b75599c60b5512288ddb16e5895a3 \
                        sha256  9ae39935cc5df1aebc805d7c7797c6cf42da5e74e3dfdc35b67ad237f8460f50 \
                        size    1151813

    depends_lib-append  port:${name} \
                        port:expat

    configure.args-append \
                        --with-gawkextlib=${prefix} \
                        --with-expat=${prefix}
}

distname                ${subport}-${version}

livecheck.regex         /${subport}-(\\d+(?:\\.\\d+)*)
