# -*- 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-ssh2
categories-append       net
maintainers             {ryandesign @ryandesign} {mathiesen.info:macintosh @BjarneDMat} openmaintainer
license                 PHP

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 8.6

if {[vercmp ${php.branch} >= 8.0]} {
    version             1.6.1
    revision            0
    checksums           rmd160  459d4268af1d0b00700cc192d65027be20ffe4f9 \
                        sha256  1a04c23fbca9877ed620a726ed446fe477f7548e90e3582bde37c06b5dec6443 \
                        size    42214
} elseif {[vercmp ${php.branch} >= 7.0]} {
    version             1.4.1
    revision            0
    checksums           rmd160  9c847364d67788ead5fb3def171c89c312b8ccca \
                        sha256  2ab7294c9a60b8f7fde962f5f7c6a46e530f67c20f38bb182e1b08beed6d0d8d \
                        size    35990
} else {
    version             0.13
    revision            0
    checksums           rmd160  2f1464dfa7c5d3d114f4354a10ba03958e3f2a6f \
                        sha256  cb2cb8ab840b5b36bcd8a8df06ea4a970a61e4cb3980f3c0ac5c913522e6c1be \
                        size    28984
}

description             PHP bindings for libssh2

long_description        ${description}

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-ssh2 ${version}
    } else {
        php.pecl                yes
    }

    depends_lib-append      port:libssh2

    configure.args          --with-ssh2=${prefix}
}
