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

github.setup        JuliaMath openspecfun 0.5.7 v
github.tarball_from archive
revision            0
categories          math
license             {MIT public-domain}
maintainers         {mps @Schamschula} openmaintainer
description         The OpenSpecFun library largely includes two libraries, AMOS and \
                    Faddeeva.
long_description    {*}${description}
homepage            https://github.com/JuliaMath/openspecfun

checksums           rmd160  46d95b038ba5622645e78fe6efa4dbe6e7d179ad \
                    sha256  6209413bc5291f4aad68903fc7851a18ddc94d3432ee0dd1b69e02dc370ece2a \
                    size    107827

compilers.choose    fc f77 f90
compilers.setup     require_fortran

post-configure {
    # openspecfun will definitely use a real compiler name, not gfortran.
    set myc [fortran_compiler_name [fortran_variant_name]]
    if {[string match "gcc1*" $myc]} {
        set myf gfortran-mp-[string range $myc 3 end]
    } elseif {${myc} eq "gcc-devel"} {
        set myf "gfortran-mp-devel"
    } else {
        set myf "g95"
    }

    reinplace "s|gfortran|$myf|" \
        ${worksrcpath}/Make.inc \
        ${worksrcpath}/CMakeFiles/openspecfun-shared.dir/build.make \
        ${worksrcpath}/CMakeFiles/openspecfun-shared.dir/link.txt \
        ${worksrcpath}/CMakeFiles/openspecfun-static.dir/build.make
}
