# -*- 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                tinyows
version             1.2.1
revision            0
maintainers         {yahoo.com:n_larsson @nilason} openmaintainer
categories          gis
license             GPL-2+

description         TinyOWS is a small footprint WFS server
long_description    TinyOWS is a WFS server part of MapServer that can be installed in a\
                    standalone configuration using FastCGI.

homepage            https://mapserver.osgeo.org/tinyows
master_sites        https://download.osgeo.org/mapserver

checksums           rmd160  8ab0fd74243b1fe50c7e36dfe021d4c7350cdb4e \
                    sha256  27e1e5c3f2fb2fd5e45e1660a3d56038ed26cfb469dd0da2e01a0a7878592c1e \
                    size    4059394

patchfiles          patch-Makefile_in.diff \
                    patch-ows_define_h.diff \
                    patch_ows_config_c.patch

depends_lib         port:libxml2 \
                    port:postgresql16 \
                    port:pg16-postgis3 \
                    port:fcgi

depends_build       port:autoconf \
                    port:flex

configure.args      --with-xml2-config=${prefix}/bin/xml2-config \
                    --with-pg_config=${prefix}/lib/postgresql16/bin/pg_config \
                    --with-shp2pgsql=${prefix}/lib/postgresql16/bin/pg_config \
                    --with-fastcgi=${prefix}

pre-configure {
    system "mv ${worksrcpath}/configure.in ${worksrcpath}/configure.ac"
    system "cd ${worksrcpath} && autoupdate"
    system "cd ${worksrcpath} && ./autogen.sh"
}

notes               "A demo configuration file has been copied into '${prefix}/etc/tinyows.xml'." \
                    "Edit it, and/or copy to location of your choise, according to your needs." \
                    "Set its path to environment variable TINYOWS_CONFIG_FILE" \
                    "(see https://mapserver.org/tinyows/configfile.html)." \
                    "Copy or link '${prefix}/bin/tinyows' to your Fast CGI directory."

livecheck.type      regex
livecheck.url       https://download.osgeo.org/mapserver
livecheck.regex     tinyows-(\[0-9.\]+)${extract.suffix}
