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

github.setup        osmcode libosmium 2.22.0 v
github.tarball_from archive
revision            1

categories          gis
maintainers         {@frankdean fdsd.co.uk:frank.dean} openmaintainer

license             Boost-1 public-domain
platforms           any
supported_archs     noarch

description         A fast and flexible C++ library for working with OpenStreetMap data

long_description    The Osmium Library has extensive support for all types of \
                    OSM entities: nodes, ways, relations, and changesets. It \
                    allows reading from and writing to OSM files in XML, PBF, \
                    and several other formats, including change files and full \
                    history files. Osmium can store OSM data in memory and on \
                    disk in various formats and using various indexes. Its easy \
                    to use handler interface allows you to quickly write data \
                    filtering and conversion functions. Osmium can create WKT, \
                    WKB, OGR, GEOS and GeoJSON geometries for easy conversion \
                    into many GIS formats and it can assemble multipolygons \
                    from ways and relations.

homepage            https://osmcode.org/libosmium/

checksums           rmd160  5953deb5fc78bb3d0f1aad9f9c15062cba8ea533 \
                    sha256  8f74e3f6ba295baa7325ae5606e8f74ad9056f1d6ab4555c50bff6aa8246f366 \
                    size    563148

compiler.cxx_standard 2011

configure.args-append \
                    -DBUILD_EXAMPLES=OFF \
                    -DINSTALL_GDALCPP=ON \
                    -DPROJ_INCLUDE_DIR=${prefix}/lib/proj7/include \
                    -DPROJ_LIBRARY=${prefix}/lib/proj7/lib/libproj.dylib

depends_build-append \
                    port:bzip2 \
                    port:expat \
                    port:gdal \
                    port:lz4 \
                    port:proj7 \
                    port:protozero \
                    port:sparsehash \
                    port:zlib

boost.depends_type  build

subport ${name}-doc {
    description      {*}${description} - documentation
    long_description {*}${long_description} \nThis port contains the Osmium \
                     library documentation.
                    
    depends_build-append \
                    path:bin/doxygen:doxygen \
                    path:bin/dot:graphviz

    build.target    doc
    
    destroot {
        xinstall -d ${destroot}${prefix}/share/doc/${name}/html
        file rename -force ${workpath}/build/doc/html ${destroot}${prefix}/share/doc/${name}
    }
}

test.run            yes
test.cmd            ctest --output-on-failure
