Ignore:
Timestamp:
Nov 13, 2015, 5:30:50 PM (3 years ago)
Author:
dstrubbe@…
Message:

mpi portgroup: Fix mpi Fortran variant enforcement -- it should be run whenever a Fortran variant is selected, not just if Fortran is required; take into account +fortran variants from gcc subports and how default/clang/llvm subports have +gccX not +gfortran; give accurate recommendation of what needs to be installed. Also, improve documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/mpi-1.0.tcl

    r142493 r142511  
    4949# proc mpi.setup {args}
    5050#   Creates MPI variants.
    51 #   Available arguments: "require" means an MPI variant must be set. "-mpich", "-openmpi", etc.
    52 #   means remove this variant from the list. All of the arguments for compilers.setup are available
    53 #   too and will be passed to that procedure. "default" means an MPI variant (mpich) will be
    54 #   set as a default variant.
     51#   Available arguments: "require" means an MPI variant must be set.
     52#   All of the arguments for compilers.setup are available too and will be passed to that procedure.
     53#   "default" means an MPI variant (mpich) will be set as a default variant.
     54#   You can either list which MPI's can be used (e.g. mpich mpich-devel),
     55#   which cannot be used (e.g. -mpich -openmpi-devel).
     56#   There are four MPI variants: mpich, mpich-devel, openmpi, openmpi-devel.
    5557
    5658PortGroup compilers 1.0
     
    161163                return $m
    162164            }
     165        } else {
     166            # warning or error!
    163167        }
    164168    }
     
    204208
    205209            eval compilers.action_enforce_c $portname
     210        } else {
     211            # warning or error!
    206212        }
    207213    }
     
    210216# only run this if mpi is chosen
    211217pre-fetch {
    212     if {${compilers.require_fortran} && [mpi_variant_isset]} {
    213         set mpif [fortran_active_variant_name ${mpi.name}]
    214         set myf  [fortran_variant_name]
    215 
    216         if {[fortran_compiler_name $myf] ne [fortran_compiler_name $mpif]} {
    217             ui_error "${mpi.name} has a different fortran variant ($mpif) than the selected $myf"
    218             return -code error "${mpi.name} needs the $myf variant"
     218    if {[fortran_variant_isset] && [mpi_variant_isset]} {
     219        set gcc_name ""
     220        regexp (gcc\[0-9\]*) ${mpi.name} gcc_name
     221        if {$gcc_name ne ""} {
     222            if {[active_variants ${mpi.name} "fortran" ""]} {
     223                set mpif $gcc_name
     224            } else {
     225                set mpif ""
     226            }
     227        } else {
     228            # this is a default, clang, or llvm subport
     229            set mpif [fortran_active_variant_name ${mpi.name}]
     230           
     231        }
     232        # mpif will definitely have a real compiler name, not gfortran.
     233        set myf [fortran_compiler_name [fortran_variant_name]]
     234
     235        if {$myf ne $mpif} {
     236            if {$mpif eq "" && $gcc_name ne ""} {
     237                ui_error "${mpi.name} was built without Fortran support."
     238                set need "fortran"
     239            } else {
     240                if {[fortran_variant_name] eq "gfortran"} {
     241                    set selectedf " (via +gfortran)"
     242                } else {
     243                    set selectedf " "
     244                }
     245                ui_error "${mpi.name} has a different Fortran variant ($mpif) than the one selected, $myf$selectedf."
     246                set need $myf
     247            }
     248            return -code error "Install ${mpi.name} +$need"
    219249        }
    220250    }
Note: See TracChangeset for help on using the changeset viewer.