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

name                pdl-cli

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}

# keep version in sync with p5-pdl
perl5.setup         PDL 2.100
license             {Artistic-1 GPL}
homepage            https://pdl.perl.org/
maintainers         {devans @dbevans} openmaintainer
description         Command line interface scripts for the Perl Data Language (PDL)
long_description    {*}${description}

distname
distfiles

depends_lib         port:p${perl5.major}-pdl

use_configure       no
build               {}

destroot {
# this directory is required to keep portgroup perl5 happy even if nothing is installed in it
# it will be removed at the end of destroot with other empty directories
    xinstall -d ${destroot}${prefix}/lib/perl5/vendor_perl/${perl5.major}

    lappend pdlbins pdl pdl2 pdldoc perldl pptemplate
    lappend pdlmanfiles pdl2 pdldoc perldl pptemplate

    foreach pdlbin ${pdlbins} {
        ln -s ${prefix}/libexec/perl${perl5.major}/${pdlbin} ${destroot}${prefix}/bin/${pdlbin}
    }

    foreach pdlmanfile ${pdlmanfiles} {
        ln -s ${prefix}/share/perl${perl5.major}/man/man1/${pdlmanfile}.1pm ${destroot}${prefix}/share/man/man1/${pdlmanfile}.1pm
    }
   
    # pdl is a compiled synonym of perldl for use in shebangs
    ln -s ${prefix}/share/perl${perl5.major}/man/man1/perldl.1pm ${destroot}${prefix}/share/man/man1/pdl.1pm
}
