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

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}

name                fusioninventory-agent
perl5.setup         FusionInventory-Agent 2.6 ../../authors/id/G/GB/GBOUGARD
revision            1

# "latest" 2.6 version as of 26-Nov-2020 has a unique distname
distname            ${perl5.module}_${perl5.moduleversion}

platforms           {darwin any}
maintainers         nomaintainer
license             GPL-2+
supported_archs     noarch

description         FusionInventory::Agent

long_description    Perl application that runs an agent connecting to a \
                    server running for example FusionInventory for GLPI \
                    for inventorying purposes.

homepage            http://www.fusioninventory.org/overview/

checksums           rmd160  62d312ad8d1ff7e5f7f130c515c8acf4cbdc5be8 \
                    sha256  83e0e350cc82781f1142e4bc8deea901324a23f9d64e8ead80102dfd680a83df \
                    size    2820813

depends_build-append \
                    port:p${perl5.major}-http-proxy \
                    port:p${perl5.major}-http-server-simple \
                    port:p${perl5.major}-http-server-simple-authen \
                    port:p${perl5.major}-io-capture \
                    port:p${perl5.major}-ipc-run \
                    port:p${perl5.major}-net-snmp \
                    port:p${perl5.major}-test-compile \
                    port:p${perl5.major}-test-deep \
                    port:p${perl5.major}-test-exception \
                    port:p${perl5.major}-test-http-server-simple \
                    port:p${perl5.major}-test-mockmodule \
                    port:p${perl5.major}-test-mockobject \
                    port:p${perl5.major}-test-nowarnings

depends_lib-append \
                    port:p${perl5.major}-file-copy-recursive \
                    port:p${perl5.major}-file-which \
                    port:p${perl5.major}-io-socket-ssl \
                    port:p${perl5.major}-libwww-perl \
                    port:p${perl5.major}-lwp-protocol-https \
                    port:p${perl5.major}-memoize \
                    port:p${perl5.major}-net-ip \
                    port:p${perl5.major}-parallel-forkmanager \
                    port:p${perl5.major}-parse-edid \
                    port:p${perl5.major}-text-template \
                    port:p${perl5.major}-universal-require \
                    port:p${perl5.major}-xml-treepp \
                    port:p${perl5.major}-xml-xpath \
                    port:p${perl5.major}-yaml-tiny

patchfiles          patch-Makefile.PL.diff

post-patch {
    reinplace "s|/usr/local|${prefix}|" ${worksrcpath}/Makefile.PL
}

pre-destroot {
    xinstall -d ${destroot}${perl5.lib}
}

destroot.target     install
destroot.keepdirs   ${destroot}${prefix}/var/fusioninventory

notes "
    On initial installation of ${name}

        cp ${prefix}/etc/fusioninventory/agent.cfg.new ${prefix}/etc/fusioninventory/agent.cfg

    and edit as desired before running the program.

    Subsequent updates will not overwrite agent.cfg
"
livecheck.type      regex
livecheck.url       https://cpan.metacpan.org/authors/id/G/GB/GBOUGARD
livecheck.regex     "${perl5.module}\[-_\](\\d+(?:\\.\\d+)+)${extract.suffix}"
