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

name                    php-openswoole
categories-append       net devel
maintainers             {ryandesign @ryandesign} openmaintainer
license                 Apache-2

php.branches            7.2 7.3 7.4 8.0 8.1 8.2
php.pecl                yes

if {[vercmp ${php.branch} >= 7.4]} {
    version             22.0.0
    revision            1
    checksums           rmd160  9c9c2da1afd86be905ccc9b692450cf0af4f43c0 \
                        sha256  bf1ebf241bd4a52b5b39102a37da8cfa4b3dfcbd2be4104adf408873dac89034 \
                        size    1244040
} elseif {[vercmp ${php.branch} >= 7.2]} {
    version             4.10.0
    revision            2
    checksums           rmd160  074542644edb0ff9815a7179d4d3ad0172c0d1cd \
                        sha256  15225470bde025a6aae2bb942ba01b29e51856f9018f88093d992f4eb1ba0e6f \
                        size    1627513
    patchfiles          arm.patch
}

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

long_description        ${name} is ${description}.

if {${name} ne ${subport}} {
    PortGroup           legacysupport 1.1
    # strndup
    legacysupport.newest_darwin_requires_legacy \
                        10
    # https://github.com/swoole/swoole-src/issues/3896
    # CLOCK_REALTIME
    legacysupport.newest_darwin_requires_legacy \
                        15

    conflicts           ${php}-swoole

    compiler.cxx_standard 2011
    compiler.thread_local_storage yes

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

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