# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem                      1.0
PortGroup                       github 1.0
PortGroup                       php 1.1

name                            php-phalcon5
maintainers                     {ryandesign @ryandesign} {mathiesen.info:macintosh @BjarneDMat} openmaintainer
license                         BSD

php.branches                    7.4 8.0 8.1 8.2 8.3 8.4 8.5

if {[vercmp ${php.branch} <= 7.4]} {
    conflicts-append            ${php}-phalcon4
}

if {[vercmp ${php.branch} >= 8.1]} {
    github.setup                phalcon cphalcon 5.20.3 v
    revision                    0
    checksums                   rmd160  937e521bf533a9f9c006c8932fae85310b2812c6 \
                                sha256  1762612075db4e5b939b73115a7a7bcb7d20174ffd200aecbb58388effffa331 \
                                size    3905325
} elseif {[vercmp ${php.branch} >= 8.0]} {
    github.setup                phalcon cphalcon 5.8.0 v
    revision                    0
    checksums                   rmd160  cac79b26b1d8cc6b9408ddcbbd5038f1c0857d3d \
                                sha256  c49cfc301209f4719de9d02979add21b906248b5a5b50376dbb831e711d6ec48 \
                                size    6151691
} elseif {[vercmp ${php.branch} >= 7.4]} {
    github.setup                phalcon cphalcon 5.4.0 v
    revision                    0
    checksums                   rmd160  065bee36a48f88f7e171248ad42520816214d55e \
                                sha256  bd6c3ee8b3a98a82828773e48b56c3029d4127087b12f0d051db0e7b1ed0b5c6 \
                                size    6133723
}

if {[vercmp ${php.branch} <= 8.0]} {
    patch.pre_args-replace  -p0 -p1
    patchfiles                  patch_phalcon.zep.c.diff
}

description                     full stack PHP framework written as an extension
long_description \
    Phalcon is an open source full stack framework for PHP, written as a C-extension. \
    Phalcon is optimized for high performance. Its unique architecture allows the framework \
    to always be memory resident, offering its functionality whenever it's needed, without \
    expensive file stats and file reads that traditional PHP frameworks employ.

homepage                        https://phalcon.io
github.tarball_from             archive
dist_subdir                     php-phalcon

if {${name} ne ${subport}} {
    depends_lib-append          port:${php}-psr \
                                port:pcre

    php.build_dirs              [list "${worksrcpath}/build/phalcon"]
    configure.args              --enable-phalcon
}
