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

perl5.branches      5.28 5.30 5.32 5.34
perl5.setup         ExtUtils-F77 1.26 ../../authors/id/E/ET/ETJ
revision            1
license             {Artistic-1 GPL}
maintainers         nomaintainer
description         Helper for linking C with Fortran subroutines
long_description    ExtUtils::F77 describes to the calling perl code how to link C programs \
                    with Fortran subroutines on the current system.

supported_archs     noarch

checksums           rmd160  0ff0a50951d9df9441c76345cfce91fabc88e3e9 \
                    sha256  abdd1d3eec4ca4fcae5f152b40bcaa862e3c806e07e4aa9123757f6aa48b9dd6 \
                    size    13141

if {${perl5.major} != ""} {
    compilers.choose    f77
    compilers.setup     require_fortran -g95

    depends_lib-append \
                    port:p${perl5.major}-file-which \
                    port:p${perl5.major}-text-parsewords

# add lib dependency on selected gcc compiler
# ensures compiler availability to calling perl modules
    set variant_name [gcc_variant_name]

    if {${variant_name} eq "gccdevel"} {
                    depends_lib-append port:gcc-devel
    } else {
                    depends_lib-append port:${variant_name}
    }

    patchfiles      patch-F77.pm.diff

    post-patch {
        set lib [string replace ${compilers.libfortran} [string last / ${compilers.libfortran}] end]
        reinplace "s|@@GCCLIB@@|${lib}|g" ${worksrcpath}/F77.pm
        reinplace "s|@@F77@@|${configure.f77}|g" ${worksrcpath}/F77.pm
    }
}
