# -*- 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           perl5 1.0

github.setup        brendangregg FlameGraph 41fee1f99f9276008b7cd112fca19dc3ea84ac32
name                [string tolower ${github.project}]
# version is YYYYY.MM.DD date of commit hash
version             2024.10.20
revision            0
categories-append   devel
supported_archs     noarch
platforms           any
license             CDDL
maintainers         nomaintainer

description         Stack trace visualizer
long_description    Flame graphs are a visualization of hierarchical \
                    data, created to visualize stack traces of \
                    profiled software so that the most frequent \
                    code-paths to be identified quickly and accurately.

homepage            https://www.brendangregg.com/flamegraphs.html

checksums           rmd160  64f95834f926476ad9543d229c8670c24d810dd1 \
                    sha256  b1ba3aaaf296ab72ced4dca84514377a4b2c8122831d743f726c106d3d339c2a \
                    size    1063248
github.tarball_from archive

perl5.major         5.34

depends_run-append  port:p${perl5.major}-getopt-long

use_configure       no

build {
    foreach pl [glob ${worksrcpath}/*.pl] {
        reinplace -W ${worksrcpath} -E \
            "1 s|^(#!)/usr/bin/perl|\\1${perl5.bin}|" \
            ${pl}
    }
}

destroot {
    xinstall -d ${destroot}${prefix}/lib/${name}/bin
    foreach f [glob ${worksrcpath}/*.{pl,py,awk,php}] {
        xinstall ${f} ${destroot}${prefix}/lib/${name}/bin
    }
    xinstall ${worksrcpath}/jmaps ${destroot}${prefix}/lib/${name}/bin
}

test.run            yes
test.cmd            ./test.sh
test.dir            ${worksrcpath}
