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

# php82-oracle and earlier subports are in the php Portfile.
php.branches        8.3 8.4 8.5
php.pecl            yes
php.pecl.name       PDO_OCI
homepage            http://pecl.php.net/package/${php.pecl.name}

description         a PHP interface to Oracle, including the oci8 and \
                    pdo_oci extensions

long_description    ${description}

if {[vercmp ${php.branch} >= 8.3]} {
    version         1.2.0
    revision        0
    checksums       rmd160  4971b4305ab1d076b7d97537730d9b43b5e3c0f9 \
                    sha256  c55e59bceb68c243e7b6ea90d1d4b28690b997e30392f10a1e8462f12d3f937e \
                    size    20721

    distname        [string tolower ${php.pecl.name}]-${version}

} 

if {${name} ne ${subport}} {

    epoch                   3

    # port:oracle-instantclient has to be manually installed
    depends_lib-append      port:oracle-instantclient

    set lib_dir             ${prefix}/lib/oracle
    pre-configure {
        regexp {\.dylib\.(.+)$} [glob -directory ${lib_dir} libclntsh.dylib.*] -> library_version
        configure.args-append \
                            --with-pdo-oci=instantclient,${lib_dir},${library_version}
    }
}
