# -*- 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

github.setup        litehtml litehtml 0.6 v
revision            1
checksums           rmd160  4d42b03dc217b506454b14b307117abe2ab9f8f3 \
                    sha256  d8ef26218d5dd7c622d9d42cbc233c0e26baf56d069df2dbe65cc5c0a6d38861 \
                    size    347790

categories          devel www
maintainers         {ryandesign @ryandesign} openmaintainer
license             BSD

description         fast, lightweight HTML/CSS rendering engine

long_description    ${name} is a {*}${description}.

homepage            http://www.litehtml.com
github.tarball_from archive

depends_lib-append  port:gumbo-parser

patchfiles          container.patch

compiler.c_standard 1999
compiler.cxx_standard \
                    2011

configure.args      -DBUILD_SHARED_LIBS=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF \
                    -DEXTERNAL_GUMBO=ON

# Building the tests causes gtest and gmock to also get installed when
# this port is installed.
# https://github.com/litehtml/litehtml/issues/152
configure.args-append \
                    -DBUILD_TESTING=OFF

post-destroot {
    set docdir ${prefix}/share/doc/${name}

    xinstall -d ${destroot}${docdir} \
        ${destroot}${prefix}/include/${name}/containers \
        ${destroot}${prefix}/share/${name}/css

    xinstall -m 0644 -W ${worksrcpath} LICENSE ${destroot}${docdir}

    copy ${worksrcpath}/containers/linux \
        ${destroot}${prefix}/include/${name}/containers
    xinstall -m 0644 {*}[glob ${worksrcpath}/include/*.css] \
        ${destroot}${prefix}/share/${name}/css
}
