# -*- 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           active_variants 1.1
PortGroup           cmake 1.1
PortGroup           github 1.0

github.setup        ubarsc kealib 1.6.1 kealib-
revision            0

categories          gis
license             MIT
maintainers         {vince @Veence}
description         KEAlib - An HDF5 Based Raster File Format
long_description    KEALib provides an implementation of the GDAL data model.  \
                    The format supports raster attribute tables, image         \
                    pyramids, meta-data and in-built statistics while also     \
                    handling very large files and compression throughout.

homepage            http://www.kealib.org

github.tarball_from releases

checksums           rmd160  ce77a0bae81ddf435098a652ca5471056a7dc68c \
                    sha256  6c892db9c95d32fa67f927ca37e8019dcbca5146353d69ee8af3e71935115edd \
                    size    189915

depends_lib-append  port:gdal \
                    port:hdf5

compiler.cxx_standard  2011
cmake.set_cxx_standard yes

configure.args-append \
                    -DGDAL_INCLUDE_DIR=${prefix} \
                    -DHDF5_INCLUDE_DIR=${prefix}

# Find out path to "mpi.h" (if) used by HDF5
set mpl_include_dir ""
if {![catch {set result [active_variants hdf5 openmpi]}]} {
    if {$result} {
        set mpl_include_dir "-I${prefix}/include/openmpi-mp"
    }
}
if {![catch {set result [active_variants hdf5 mpich]}]} {
    if {$result} {
        set mpl_include_dir "-I${prefix}/include/mpich-mp"
    }
}
if {$mpl_include_dir ne ""} {
    configure.cxxflags-append ${mpl_include_dir}
}

notes "Enable the GDAL driver for KEA files by installing 'gdal' with the '+kea' variant."
