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

epoch                   1
name                    php-swoole
categories-append       net devel
platforms               darwin
maintainers             {ryandesign @ryandesign} openmaintainer
license                 Apache-2

php.branches            5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3
php.pecl                yes

if {[vercmp ${php.branch} 7] >= 0} {
    version             4.3.1
    revision            0
    checksums           rmd160  a996c8ca986960e3076519917d02d8247cd98115 \
                        sha256  8078960cd654b1a4a72cd3b092e672455e28013d56670ccdd4f882281c6425dd \
                        size    1311706
} elseif {[vercmp ${php.branch} 5.5] >= 0} {
    # https://github.com/swoole/swoole-src/issues/1783
    version             2.0.11
    revision            2
    checksums           rmd160  7238015b141faf59d9662d4ab21c73bb66b58e35 \
                        sha256  07df75ede4bf0833d2c2443b666a5c3054bc498a78f5251babc1b0e7cc8cd573 \
                        size    769029
} else {
    version             1.10.5
    revision            2
    checksums           rmd160  48b8c3bf5999e5365b3e804440464114500120ed \
                        sha256  5c1dc0b82772ca1c352de4ddf20deeb35f06e4c5a01beba5a446d78a1f747bd2 \
                        size    730797
}

description             an event-driven asynchronous & concurrent & coroutine networking engine with high performance for PHP

long_description        ${name} is ${description}.

if {${name} ne ${subport}} {
    if {[vercmp ${version} 4.0.4] >= 0} {
        PortGroup       cxx11 1.1
    }

    depends_lib-append  port:hiredis \
                        port:nghttp2 \
                        path:lib/libssl.dylib:openssl \
                        port:zlib

    compiler.blacklist-append \
                        *gcc-4.0 *gcc-4.2

    configure.args      --enable-async-redis \
                        --enable-http2 \
                        --enable-openssl \
                        --enable-swoole \
                        --with-openssl-dir=${prefix}

    if {[vercmp ${version} 4.1] >= 0} {
        depends_lib-append \
                        port:brotli
    }

    use_parallel_build  yes
}