# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github  1.0

github.setup        pgpointcloud pointcloud 1.2.5 v
revision            4
github.tarball_from archive

name                pgpointcloud
license             BSD
categories          databases gis
maintainers         {yahoo.com:n_larsson @nilason} openmaintainer

description         pgPointcloud is a PostgreSQL extension for storing point cloud (LIDAR) data
long_description    {*}${description}

homepage            https://pgpointcloud.github.io/pointcloud/

checksums           rmd160  54e0784994a458e9591ea416caf7ae106c0d7007 \
                    sha256  f3924f283345f2da46a971e65f0c6ce602640ecf88a2057293443ec2a7a56774 \
                    size    348678

patchfiles          01-patch-xml2-config.diff \
                    02-patch-cunit-conf.diff \
                    03-patch-cxx.diff \
                    04-patch-pgsql.diff

configure.cmd       autoupdate && ./autogen.sh && ./configure

depends_build-append \
                    port:autoconf \
                    port:automake \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:libxml2 \
                    port:zlib

configure.args-append \
                    --with-xml2config=${prefix}/bin/xml2-config \
                    --without-lazperf \
                    --without-cunit

# cc1plus: error: unrecognized command line option "-std=c++11"
compiler.cxx_standard 2011

# PostgreSQL subports
set postgresql_suffixes {12 13 14 15 16 17}
foreach v ${postgresql_suffixes} {
    subport pg${v}-${name} {
        set p postgresql${v}
        depends_lib-append      port:${p}
        configure.args-append   --with-pgconfig=${prefix}/lib/${p}/bin/pg_config
        livecheck.type          none
    }
}

variant tests description {Enable tests} {
    depends_test-append     port:cunit
    configure.args-replace  --without-cunit --with-cunit=${prefix}
    test.run        yes
    test.target     check
}

if {${name} eq ${subport}} {
    PortGroup   stub 1.0
    platforms   any
    supported_archs noarch
}
