# -*- 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            libkml libkml 1.3.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                4
checksums               rmd160  b13c1c8d072098f365ac315cc1588ef3eba4ad1d \
                        sha256  5ac678ec9b3f737749712206fc199acb27bbdb74ca8656607fc809cbc951a482 \
                        size    6640063

license                 BSD
categories              gis
maintainers             {ryandesign @ryandesign} openmaintainer

description             library to parse, generate and operate on KML

long_description        ${name} is a library for parsing, generating and \
                        operating on KML. \
                        It is an implementation of the OGC KML 2.2 standard.

depends_lib-append      port:expat \
                        port:minizip \
                        port:uriparser \
                        port:zlib

patchfiles              DYLD_LIBRARY_PATH.patch \
                        iomem_simple.h.patch \
                        libkml_pc-boost.patch \
                        unzip.c.patch

configure.args-append   -DBUILD_EXAMPLES=OFF \
                        -DBUILD_TESTING=OFF \
                        -DEXPAT_LIBRARY=${prefix}/lib/libexpat.dylib \
                        -DMINIZIP_LIBRARY=${prefix}/lib/libminizip.dylib \
                        -DURIPARSER_LIBRARY=${prefix}/lib/liburiparser.dylib \
                        -DWITH_JAVA=OFF \
                        -DWITH_PYTHON=OFF \
                        -DWITH_SWIG=OFF \
                        -DZLIB_LIBRARY_RELEASE=${prefix}/lib/libz.dylib

variant tests description {Enable tests} {
    configure.args-replace  -DBUILD_TESTING=OFF \
                            -DBUILD_TESTING=ON

    depends_build-append    port:gtest

    # gtest requires C++14
    compiler.cxx_standard   2014
    cmake.set_cxx_standard  yes

    test.run                yes
    test.target             test
}

post-destroot {
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -W ${worksrcpath} -m 0644 \
        AUTHORS \
        ChangeLog \
        LICENSE \
        README.md \
        ${destroot}${docdir}
}

github.livecheck.regex  {([0-9.]+)}
