# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           perl5 1.0

github.setup        darold pgbadger 13.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          databases
maintainers         nomaintainer
description         PostgreSQL log analyzer with fully detailed reports and graphs.
long_description    pgBadger is a PostgreSQL log analyzer built for speed with fully reports \
                    from your PostgreSQL log file. It's a single and small Perl script that \
                    outperforms any other PostgreSQL log analyzer.

license             BSD
supported_archs     noarch
platforms           {darwin any}

homepage            https://pgbadger.darold.net/

checksums           rmd160  fdfdcfab2ba575a15dfed645e3736fa329917b36 \
                    sha256  1ed8befe93a1d6fa90e090dbfa974a5367448baa1e1dc92d89109914f642a6c2 \
                    size    4365855

perl5.require_variant   yes
perl5.conflict_variants yes
perl5.branches          5.28 5.30 5.32 5.34
perl5.default_branch    5.34
perl5.create_variants   ${perl5.branches}

depends_lib-append  port:p${perl5.major}-text-csv_xs \
                    port:p${perl5.major}-json-xs

post-patch {
    reinplace "s|^#!/usr/bin/env perl|#!${perl5.bin}|" ${worksrcpath}/${name}
}

configure.cmd       ${perl5.bin}
configure.pre_args  Makefile.PL
configure.args      INSTALLDIRS=perl

post-destroot {
    fs-traverse f ${destroot}${prefix}/lib/perl5 {
        if {[file isfile $f] && [file tail $f] eq "perllocal.pod"} {
            file delete $f
        }
        if {[file isfile $f] && [file tail $f] eq ".packlist"} {
            reinplace -n "s|${destroot}||p" $f
        }
    }
}
