# -*- 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.23.1 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  ef078a33912556f1ac0e0e2a30fd8f8bc89d9466 \
                    sha256  eb47d8163396c73870dbf27819dcadda0c56f0191935c4f8659d1e61b261552f \
                    size    568225

patchfiles          CMakeLists.txt.diff

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
