# -*- 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.0 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  ac3526b50d3a5e0c45e1c1d61bf585af71c8785f \
                    sha256  c05a8621d86e293de0f45fc194751f67f841a68e7a45d95b2f37fcdfb2dc2c14 \
                    size    188991

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."
