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

github.setup        Corvusoft restbed 4.8
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          devel
license             AGPL-3
maintainers         nomaintainer
description         Framework that brings asynchronous RESTful functionality to C++14 applications.
long_description    Restbed is a comprehensive and consistent programming model for building applications \
                    that require seamless and secure communication over HTTP, with the ability to model \
                    a range of business processes, designed to target mobile, tablet, desktop \
                    and embedded production environments.
homepage            https://www.corvusoft.co.uk
checksums           rmd160  45f056be2a4f79f51b95c035bcf594468ff5bec7 \
                    sha256  8d2959b8a4b14a5c4f15364220b9b4be203b9af9ba46c439fa68084e2910f27f \
                    size    145776

depends_lib-append  port:asio

patchfiles          patch-CMakeLists.diff

compiler.cxx_standard 2014

configure.args-append \
                    -DBUILD_IPC=OFF \
                    -DBUILD_SSL=OFF \
                    -DBUILD_TESTS=OFF

pre-destroot {
    xinstall -d ${destroot}${prefix}/include/${name}
}

post-destroot {
    # Fix permissions; setting to 0644 does not have a needed effect.
    file attributes ${destroot}${prefix}/include/${name} -permissions 0755
    # Remove unneeded subprefix; we install headers in ${prefix}/include/restbed:
    fs-traverse h ${destroot}${prefix}/include/${name} {
        if {[file isfile ${h}]} {
            reinplace -q "s,corvusoft/,,g" ${h}
        }
    }
}
