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

name                            php-gearman
categories-append               net devel
platforms                       darwin freebsd openbsd
maintainers                     {ryandesign @ryandesign} {mathiesen.info:macintosh @BjarneDMat} openmaintainer
license                         PHP-3.01

# Compatible with PHP 8.4 as of 2.1.3
php.branches                    5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5

description                     Library to provide API for communicating with gearmand, using libgearman.
long_description \
    Library to provide API for communicating with gearmand, and writing clients and workers.

if {[vercmp ${php.branch} >= 7.2]} {
    version                     2.2.1
    revision                    0
    checksums                   rmd160  4635bdb73fe9618c06be3f485b812f023ad6a2d3 \
                                sha256  6cd9d3ad698d62905ffc9808ce12b9773d594e8573ed7d7a52cacd42df628c83 \
                                size    52708
} elseif {[vercmp ${php.branch} >= 7.1]} {
    version                     2.1.4
    revision                    0
    checksums                   rmd160  d9ecec0efeef7932f55d3d58eb1b5893dac55e98 \
                                sha256  ecc5f1f64436a627ab638ff44c4d68671bdcc73e418119fe9b08ff8bb1eb9630 \
                                size    47028
} elseif {[vercmp ${php.branch} >= 7.0]} {
    version                     2.1.3
    revision                    0
    checksums                   rmd160  47cdcef4013158df1993c06737e352e367dd9268 \
                                sha256  f3fa1d7b6af797c87826be6e21e707a9bec9f8b3aaee6ae7fa58263d8058cb2b \
                                size    47009
} elseif {[vercmp ${php.branch} >= 5.1]} {
    version                     1.1.2
    revision                    0
    checksums                   rmd160  8817e87f53cdb3cc21eaf91454dc7f35d6cadc88 \
                                sha256  c30a68145b4e33f4da929267f7b5296376ca81d76dd801fc77a261696a8a5965 \
                                size    30961
}

if {${name} ne ${subport}} {
    # remove w/ next update
    dist_subdir                 ${name}/${version}_1

    if {[vercmp ${php.branch} >= 7.0]} {
        github.tarball_from     archive
        github.setup            php pecl-networking-gearman ${version}
        set name_version        [lindex [split ${name} "-"] 1]-${version}
        git.branch              ${name_version}
        distname                ${name_version}
    } elseif {[vercmp ${php.branch} >= 5.1]} {
        php.pecl                yes
    }

    depends_lib-append          port:gearmand
}
