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

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

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
php.pecl                yes

if {[vercmp ${php.branch} >= 7.0]} {
    version             2.3.10
    revision            0
    checksums           rmd160  6a3cf22fb9e97bedf9c30722866b33d34ba8f7b6 \
                        sha256  251aee99c2726ebc6126e1ff0bb2db6e2d5fd22056aa335e84db9f1055d59d95 \
                        size    843156
    set patchv          {}
} elseif {[vercmp ${php.branch} >= 5.2]} {
    version             0.9.4
    revision            0
    php.pecl.prerelease yes
    checksums           rmd160  e484c4902f287ef18d9f75dda75a28d73bb8272d \
                        sha256  002a2d4a825d16aeb3017c59f94d8c5e5d06611dd6197acd2f07fce197d3b8f8 \
                        size    842077
    set patchv          .${version}
}

description             A Hierarchical Profiler for PHP

long_description        XHProf is a function-level hierarchical profiler for \
                        PHP and has a simple HTML based navigational interface.

if {${name} ne ${subport}} {
    patchfiles          callgraph_utils.php${patchv}.patch
    
    post-patch {
        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/xhprof_lib/utils/callgraph_utils.php
    }
    
    php.build_dirs      ${worksrcpath}/extension
    
    use_parallel_build  yes
    
    post-destroot {
        # Install php files not installed by the Makefile
        xinstall -d ${destroot}${prefix}/www/${subport}
        copy ${worksrcpath}/examples ${destroot}${prefix}/www/${subport}/examples
        copy ${worksrcpath}/xhprof_lib ${destroot}${prefix}/www/${subport}/xhprof_lib
        copy ${worksrcpath}/xhprof_html ${destroot}${prefix}/www/${subport}/xhprof_html
    }
    
    variant graphviz description {Build with graphviz, support for callgraphs} {
        depends_run-append      path:bin/dot:graphviz
    }
}
