Ignore:
Timestamp:
Nov 11, 2015, 5:07:45 AM (4 years ago)
Author:
dstrubbe@…
Message:

compilers portgroup:

  • Add proc 'set_variants_conflict' which can be used for setting some compilers variants outside the portgroup.
  • Add proc 'c_variant_isset'.
  • Add variable 'compilers.libfortran' for use in linking Fortran code with C or C++.
File:
1 edited

Legend:

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

    r141376 r142409  
    4545#   A list of which of these compilers you want to be set by the variants (e.g. ${configure.cc}).
    4646#   The default is all of them. Must come before compilers.setup in the Portfile to have an effect.
     47# compilers.set_variants_conflict {args}
     48#   Add specified variants to the conflicts list of all variants created by this PortGroup.
     49#   Useful if another compiler variant is created explicitly in the Portfile.
    4750# compilers.setup {args}
    4851#   Possible arguments: any compiler variant name with a minus removes it from the list of variants, e.g. -llvm.
     
    5255#   This procedure must be in the Portfile to create all the compiler variants and set the default.
    5356#   Appropriate conflicts, dependencies, etc. are created too.
     57#   If a variant is declared already in the Portfile before this line, it will not be redefined.
    5458# c_active_variant_name {depspec}: which C variant a dependency has set
    5559# c_variant_name {}: which C variant is set
     60# c_variant_isset {}: is a C variant set
    5661# fortran_active_variant_name {depspec}: which Fortran variant a dependency has set
    5762# fortran_variant_name {}: which Fortran variant is set
     
    6772# The compilers.gcc_default variable may be useful for setting a default compiler variant
    6873# even in ports that do not use this PortGroup's automatic creation of variants.
     74# compilers.libfortran is for use in linking Fortran code with the C or C++ compiler
    6975
    7076PortGroup active_variants 1.1
     
    8086default compilers.required_c {}
    8187default compilers.required_f {}
     88default compilers.variants_conflict {}
     89default compilers.libfortran {}
    8290
    8391# also set a default gcc version
     
    100108    set cdb(gcc$v,depends)  port:gcc$v
    101109    set cdb(gcc$v,dependsl) path:lib/libgcc/libgcc_s.1.dylib:libgcc
     110    set cdb(gcc$v,libfortran) ${prefix}/lib/gcc$v/libgfortran.dylib
     111    # note: above is ultimately a symlink to ${prefix}/lib/libgcc/libgfortran.3.dylib
    102112    set cdb(gcc$v,dependsd) port:g95
    103113    set cdb(gcc$v,dependsa) gcc$v
     
    125135    set cdb(clang$v,depends)  port:clang-$version
    126136    set cdb(clang$v,dependsl) ""
     137    set cdb(clang$v,libfortran) ""
    127138    set cdb(clang$v,dependsd) ""
    128139    set cdb(clang$v,dependsa) clang-$version
     
    146157    set cdb(dragonegg3$v,depends)  path:bin/dragonegg-3.$v-gcc:dragonegg-3.$v
    147158    set cdb(dragonegg3$v,dependsl) path:lib/libgcc/libgcc_s.1.dylib:libgcc
     159    set cdb(dragonegg3$v,libfortran) ${prefix}/lib/gcc46/libgfortran.dylib
    148160    set cdb(dragonegg3$v,dependsd) port:g95
    149161    set cdb(dragonegg3$v,dependsa) dragonegg-3.$v
     
    163175set cdb(llvm,depends)  bin:llvm-gcc-4.2:llvm-gcc42
    164176set cdb(llvm,dependsl) ""
     177set cdb(llvm,libfortran) ""
    165178set cdb(llvm,dependsd) ""
    166179set cdb(llvm,dependsa) ""
     
    181194set cdb(gfortran,depends)  $cdb(${compilers.gcc_default},depends)
    182195set cdb(gfortran,dependsl) $cdb(${compilers.gcc_default},dependsl)
     196set cdb(gfortran,libfortran) $cdb(${compilers.gcc_default},libfortran)
    183197set cdb(gfortran,dependsd) $cdb(${compilers.gcc_default},dependsd)
    184198set cdb(gfortran,dependsa) $cdb(${compilers.gcc_default},dependsa)
     
    197211set cdb(g95,depends)  port:g95
    198212set cdb(g95,dependsl) ""
     213set cdb(g95,libfortran) ${prefix}/lib/g95/x86_64-apple-darwin14/4.2.4/libf95.a
    199214set cdb(g95,dependsd) ""
    200215set cdb(g95,dependsa) g95
     
    218233}
    219234
     235proc compilers.set_variants_conflict {args} {
     236    global compilers.variants_conflict
     237
     238    lappend compilers.variants_conflict $args
     239}
     240
    220241proc compilers.setup_variants {args} {
    221242    global cdb compilers.variants compilers.clang_variants compilers.gcc_variants
    222243    global compilers.dragonegg_variants compilers.fortran_variants compilers.list
     244    global compilers.variants_conflict
    223245
    224246    foreach variant [split $args] {
     
    259281            # compilers that aren't in macports portconfigure.tcl
    260282            set comp ""
    261             foreach compiler ${compilers.list} {
     283            foreach compiler ${compilers.list} {               
    262284                if {$cdb($variant,$compiler) ne ""} {
    263285                    append comp [subst {
     
    276298                variant ${variant} description \
    277299                    {Build using the $cdb($variant,descrip) compiler} \
    278                     conflicts $c {
     300                    conflicts $c ${compilers.variants_conflict} {
    279301
    280302                    depends_build-append   $cdb($variant,depends)
     
    283305                    depends_skip_archcheck $cdb($variant,dependsa)
    284306
     307                    set compilers.libfortran $cdb($variant,libfortran)
    285308                    $comp
    286309                }
     
    324347
    325348    return ""
     349}
     350
     351proc c_variant_isset {} {
     352    return [expr {[c_variant_name] ne ""}]
    326353}
    327354
Note: See TracChangeset for help on using the changeset viewer.