Ignore:
Timestamp:
Jan 23, 2014, 8:07:55 PM (5 years ago)
Author:
sean@…
Message:

compilers-1.0: factor out logic for choosing compilers for a fortran-only mode

File:
1 edited

Legend:

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

    r116293 r116294  
    4545default compilers.require_fortran 0
    4646default compilers.setup_done 0
     47
     48set compilers.list {cc cxx cpp objc fc f77 f90}
    4749
    4850# build database of gcc 4{4..9} compiler attributes
     
    135137set cdb(llvm,f90)      ""
    136138
    137 # and lastly we add a gfortran and g95 variant for use with clang*
     139# and lastly we add a gfortran and g95 variant for use with clang*; note that
     140# we don't need gfortran when we are in an "only-fortran" mode
    138141set cdb(gfortran,variant)  gfortran
    139142set cdb(gfortran,compiler) gfortran
     
    186189proc compilers.setup_variants {args} {
    187190    global cdb compilers.variants compilers.clang_variants compilers.gcc_variants
    188     global compilers.dragonegg_variants compilers.fortran_variants
     191    global compilers.dragonegg_variants compilers.fortran_variants compilers.list
    189192
    190193    foreach variant [split $args] {
     
    241244            # compilers that aren't in macports portconfigure.tcl
    242245            set comp ""
    243             foreach compiler {cc cxx cpp objc fc f77 f90} {
     246            foreach compiler ${compilers.list} {
    244247                if {$cdb($variant,$compiler) ne ""} {
    245248                    append comp [subst {
     
    323326}
    324327
     328proc compilers.choose {args} {
     329    global compilers.list
     330
     331    # zero out the variable before and append args
     332    set compilers.list {}
     333    foreach v $args {
     334        lappend compilers.list $v
     335    }
     336}
     337
     338proc compilers.is_fortran_only {} {
     339    global compilers.list
     340
     341    foreach c {cc cxx cpp objc} {
     342        if {[lsearch -exact ${compilers.list} $c] >= 0} {
     343            return 0
     344        }
     345    }
     346
     347    return 1
     348}
     349
    325350proc compilers.setup {args} {
    326351    global cdb compilers.variants compilers.clang_variants compilers.gcc_variants
    327352    global compilers.dragonegg_variants compilers.fortran_variants
    328     global compilers.require_fortran compilers.setup_done
     353    global compilers.require_fortran compilers.setup_done compilers.list
    329354
    330355    if {!${compilers.setup_done}} {
    331356        set add_list {}
    332357        set remove_list ${compilers.variants}
     358
     359        # if we are only setting fortran compilers, then we are in "only fortran
     360        # mode", i.e. we just need +gccXY and +dragoneggXY for the fortran
     361        # compilers so we remove +clangXY and +llvm
     362        if {[compilers.is_fortran_only]} {
     363            # remove gfortran since that only exists to "complete" clang/llvm
     364            set remove_list [remove_from_list ${compilers.fortran_variants} gfortran]
     365        }
    333366
    334367        foreach v $args {
Note: See TracChangeset for help on using the changeset viewer.