# -*- 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.5.0 v
revision            0
checksums           rmd160  69c1b687accf57ef7577bb8e072054fb35552e87 \
                    sha256  d89060bb2fb6f7d0e0f399495155dd15e06697aa2c6568eab70ecd4a43084ba9 \
                    size    5371588

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}

configure.args-append \
                    -DLEXBOR_OPTIMIZATION_LEVEL="${configure.optflags}"

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
}
