# -*- 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                   github 1.0
PortGroup                   cmake 1.1
PortGroup                   boost 1.0

github.setup                Stiffstream restinio 0.6.14 v.
revision                    3
checksums                   rmd160  3459b19aa7ee177a8a2eaf77f7104913af47f609 \
                            sha256  b75bb9a1b843a05968eb696eda41029b76a3833bd056e8fb00cd68853fc97796 \
                            size    536814

categories                  www devel
license                     BSD
platforms                   any
supported_archs             noarch
maintainers                 {gmail.com:g.litenstein @Lord-Kamina} openmaintainer
homepage                    https://stiffstream.com/en/products/restinio.html
description                 Header-only C++14 library that gives you an embedded HTTP/Websocket server.
long_description            RESTinio is a header-only C++14 library that gives you an embedded \
                            HTTP/Websocket server. It is based on standalone version of ASIO and targeted \
                            primarily for asynchronous processing of HTTP-requests.

github.tarball_from         releases
use_bzip2                   yes

set port_libfmt             libfmt9
cmake.module_path-append \
                            ${prefix}/lib/${port_libfmt}/cmake

compiler.cxx_standard       2014

depends_build-append        path:lib/libssl.dylib:openssl \
                            port:pcre \
                            port:zlib \
                            path:bin/doxygen:doxygen

depends_lib-append          port:asio \
                            port:http-parser \
                            port:${port_libfmt}

patchfiles                  patch-CMakeLists.txt.diff

cmake.source_dir            ${worksrcpath}/dev
cmake.build_type            Release
cmake.generator             Unix Makefiles

configure.args              -DRESTINIO_BENCH=OFF \
                            -DRESTINIO_FIND_DEPS=ON \
                            -DRESTINIO_FMT_HEADER_ONLY=ON \
                            -DRESTINIO_INSTALL_BENCHES=OFF \
                            -DRESTINIO_INSTALL_SAMPLES=OFF \
                            -DRESTINIO_SAMPLE=OFF \
                            -DRESTINIO_TEST=OFF \
                            -DRESTINIO_USE_EXTERNAL_HTTP_PARSER=ON
configure.pre_args-delete   -DCMAKE_POLICY_DEFAULT_CMP0025=NEW
configure.optflags-delete   -Os
compiler.blacklist-append   *gcc-3.* *gcc-4.* {*gcc-5.[0-3]} \
                            {clang < 800} macports-clang-3.4 macports-clang-3.7

destroot {
    set components { . impl path2regex router third_party/optional-lite third_party/string-view-lite transforms utils utils/impl websocket websocket/impl }
    set files { }
    set instdir "${destroot}${prefix}/include/${github.project}"

    foreach i ${components} {
        lappend files {*}[glob -tails -directory ${worksrcpath}/dev/${github.project}/ ${i}/*{.hpp,.inl}]
        xinstall -m 755 -d ${instdir}/${i}
    }
    xinstall -m 0644 -W ${worksrcpath}/dev/${github.project} {*}${files} ${instdir}
    set docdir "${destroot}${prefix}/share/doc/${github.project}"
    xinstall -m 755 -d "${docdir}/html/search"
    system -W ${worksrcpath}/dev "${prefix}/bin/doxygen ${worksrcpath}/dev/Doxyfile"
    xinstall -m 644 "${worksrcpath}/README.md" "${docdir}"
    xinstall -m 644 "${worksrcpath}/LICENSE" "${docdir}"
    xinstall -m 644 {*}[glob "${worksrcpath}/dev/doc/html/*.*" "${docdir}/html"]
    xinstall -m 644 {*}[glob "${worksrcpath}/dev/doc/html/search/*.*" "${docdir}/html/search"]
}
