# -*- 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.branches      5.28 5.30 5.32 5.34
perl5.link_binaries no
perl5.setup         PDL 2.100 ../../authors/id/E/ET/ETJ
revision            0
license             {Artistic-1 GPL}
maintainers         {peculier.com:mgrimes @mvgrimes} openmaintainer
description         Perl Data Language - scientific computing capability for perl
long_description    The perlDL project aims to turn perl into an efficient numerical \
                    language for scientific computing. The PDL module gives standard perl \
                    the ability to COMPACTLY store and SPEEDILY manipulate the large \
                    N-dimensional data sets which are the bread and butter of scientific \
                    computing.

checksums           rmd160  acb1892d4ef1ac3d04f9d089c683804006509271 \
                    sha256  8aaa6edf90255a3d0b4d0047d6270e1124bf1e1acd2414804e87310b6b39be40 \
                    size    2219478

#
# current support options
# See https://metacpan.org/pod/PDL::Course for full PDL usage details
#
# plotting support using backend independent API is available via separate module PDL::Graphics::Simple
# plotting support using pgplot is available via separate module PGPLOT
# plotting support using gnuplot is available via separate module PDL::Graphics::Gnuplot
# plotting support using plplot is available via separate module PDL::Graphics::PLplot
# hdf4 io support is available via separate module PDL::IO::HDF
# hdf5 io support is available via separate module PDL::IO::HDF5
# image io support using the GD library is available via separate module PDL::IO::GD
# fft support via PDL::FFT is built-in
# alternate fft support is available via separate module PDL::FFTW3
# basic statistical support is available via separate module PDL:Stats
#
# TODO
#
# fast 3D plotting support using OpenGL is available via separate module PDL::Graphics::TriD (not yet ported)
# projection transform support using the Proj library is available via separate module PDL::GIS::Proj (not yet ported)
# coordinate transform support using the Proj library is available via separate module PDL::Transform::Proj4 (not yet ported)
# slatec library support is available via separate module PDL::Slatec (deprecated in favor of built-in PDL::Primitive and separate module PDL::LinearAlgebra)
# neither PDL::Slatec nor PDL::LinearAlgebra are as yet ported
#

if {${perl5.major} != ""} {
    # see https://trac.macports.org/ticket/67506
    # clang: error: unable to execute command: Segmentation fault: 11
    compiler.blacklist-append {clang < 1200}

    depends_build-append \
                    port:p${perl5.major}-devel-checklib \
                    port:p${perl5.major}-extutils-makemaker \
                    port:p${perl5.major}-file-path \
                    port:p${perl5.major}-test-deep \
                    port:p${perl5.major}-test-exception \
                    port:p${perl5.major}-test-warn

    depends_lib-append \
                    port:netpbm \
                    port:p${perl5.major}-astro-fits-header \
                    port:p${perl5.major}-data-dumper \
                    port:p${perl5.major}-file-map \
                    port:p${perl5.major}-file-which \
                    port:p${perl5.major}-filter \
                    port:p${perl5.major}-filter-simple \
                    port:p${perl5.major}-inline \
                    port:p${perl5.major}-inline-c \
                    port:p${perl5.major}-math-complex \
                    port:p${perl5.major}-term-readkey \
                    port:p${perl5.major}-text-balanced

    # our p5-pod-parser is only required on perl 5.32+
    if {${perl5.major} > 5.30} {
        depends_lib-append \
                    port:p${perl5.major}-pod-parser
    }

    # pgplot is not universal
    universal_variant no
    use_parallel_build no

    post-build {
       # Create the pdldoc.db file for the help system
       exec ${perl5.bin} -I ${worksrcpath}/blib/arch \
           -I ${worksrcpath}/blib/lib \
           ${worksrcpath}/utils/scantree.pl ${worksrcpath}/blib/lib \
           ${worksrcpath}/pdldoc.db \
           ${worksrcpath}/blib/lib/PDL/Index.pod \
           >/dev/null 2>/dev/null

       # Rewrite the paths in the pdldoc.db file. scantree will have the
       # ${worksrcpath}/blib/lib paths, we need ${perl5.archlib}.
       exec ${perl5.bin} ${filespath}/fix-pdldocdb.pl \
           ${worksrcpath}/pdldoc.db \
           ${worksrcpath}/blib/lib/PDL/pdldoc.db \
           "${worksrcpath}/blib/lib" \
           "${perl5.archlib}"
   }
}
