# -*- 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        lexbor lexbor 2.4.0 v
revision            0
checksums           rmd160  f71c9bb4b2c15d7f2b5afdfee9652e432211b590 \
                    sha256  8949744d425743828891de6d80327ccb64b5146f71ff6c992644e6234e63930e \
                    size    4245007

description         a fast embeddable web browser engine

long_description    ${name} is {*}${description} written in C \
                    with no dependencies.

categories          net www
maintainers         {ryandesign @ryandesign} openmaintainer
license             Apache-2

homepage            https://lexbor.com
github.tarball_from archive

# https://github.com/lexbor/lexbor/issues/226
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2
compiler.c_standard 1999

set docdir          ${prefix}/share/doc/${subport}

post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        CHANGELOG.md LICENSE NOTICE README.md \
        ${destroot}${docdir}
}

variant perf description "Enable support for rdtsc" {
    configure.args-append \
                    -DLEXBOR_WITH_PERF=ON
}

variant tests description "Enable testing" {
    configure.pre_args-replace \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF
    configure.args-append \
                    -DLEXBOR_BUILD_TESTS=ON

    test.run        yes
}
