Fortran recipe

Jeremy Huddleston Sequoia jeremyhu at macports.org
Mon Aug 19 15:05:20 PDT 2013


Most ports that require fortran set configure.compiler to macports-gcc-4.X.  This gets the port a fortran compiler, but it also switches the C and C++ compilers as well.  If the port also has C and C++ sources, then it would be preferable to leave configure.cc and configure.cxx alone and just choose a fortran compiler.

I'm suggesting that such ports be updated to do this and want some feedback on this Portfile recipe:

set gcc_versions {4.3 4.4 4.5 4.6 4.7 4.8 4.9}
set default_fortran_variant "+gcc48"

foreach ver ${gcc_versions} {
    set ver_no_dot [join [split ${ver} "."] ""]
    variant gcc${ver_no_dot} description {build with gfortran from gcc${ver_no_dot}} conflicts g95 {
        depends_lib-append port:libgcc
        depends_build-append port:gcc${ver_no_dot}

        configure.fc  ${prefix}/bin/gfortran-mp-${ver}
        configure.f77 ${prefix}/bin/gfortran-mp-${ver}
        configure.f90 ${prefix}/bin/gfortran-mp-${ver}
    }

    foreach over ${gcc_versions} {
        if {${ver} == ${over}} {
            continue
        }

        set over_no_dot [join [split ${over} "."] ""]
        variant gcc${ver_no_dot} conflicts gcc${over_no_dot} {}
    }

    variant g95 conflicts gcc${ver_no_dot} {}

    if {[variant_isset gcc${ver_no_dot}]} {
        set default_fortran_variant ""
    }
}

variant g95 description {build with g95} {
    depends_build-append port:g95
    configure.fc ${prefix}/bin/g95
    configure.f77 ${prefix}/bin/g95
    configure.f90 ${prefix}/bin/g95
}

if {[variant_isset g95]} {
    set default_fortran_variant ""
}

if {${default_fortran_variant} != ""} {
    default_variants ${default_fortran_variant}
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4145 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20130819/cd62220c/attachment.p7s>


More information about the macports-dev mailing list