Ignore:
Timestamp:
Sep 11, 2014, 10:12:06 PM (5 years ago)
Author:
pixilla@…
Message:

_resources/port1.0/group:

  • Move perl5.setup subport creation to new perl5.create_subport proc.
  • Add perl5.create_variants proc for creating perl variants.
  • See ticket #43193
File:
1 edited

Legend:

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

    r123724 r125264  
    6666}
    6767
     68# Create perl subports
     69proc perl5.create_subports {branches rootname} {
     70    foreach v ${branches} {
     71        subport p${v}-${rootname} {
     72            depends_lib port:perl${v}
     73            perl5.major ${v}
     74        }
     75    }
     76}
     77
     78# Set perl variant options and defaults
     79options perl5.default_variant perl5.variant perl5.set_default_variant perl5.conflict_variants
     80default perl5.default_variant [string map {. _} perl${perl5.default_branch}]
     81default perl5.variant {[string map {. _} perl${perl5.major}]}
     82default perl5.set_default_variant {true}
     83default perl5.conflict_variants {true}
     84# Get variant names from branches
     85proc perl5.get_variant_names {branches} {
     86    set ret {}
     87    foreach branch ${branches} {
     88        lappend ret "perl[string map {. _} ${branch}]"
     89    }
     90    return $ret
     91}
     92# Create perl variants
     93proc perl5.create_variants {branches} {
     94    global perl5.major perl5.default_variant perl5.variant perl5.set_default_variant perl5.conflict_variants
     95    set variants [perl5.get_variant_names ${branches}]
     96    foreach branch ${branches} {
     97        set index [lsearch ${branches} ${branch}]
     98        set variant [lindex ${variants} ${index}]
     99# Add conflicts
     100        set conflicts {}
     101        if {${perl5.conflict_variants}} {
     102            set conflicts "conflicts {[lreplace ${variants} ${index} ${index}]}"
     103        }
     104        eval "variant ${variant} ${conflicts} description Use MacPorts perl${branch} {}"
     105        if {[variant_isset ${variant}]} {
     106            perl5.variant ${variant}
     107        }
     108    }
     109# Set default perl variant
     110    if {${perl5.default_variant} eq ${perl5.variant} && ${perl5.set_default_variant}} {
     111        default_variants-append +${perl5.variant}
     112    }
     113# Set perl version and deps
     114    foreach branch ${branches} {
     115        set index [lsearch ${branches} ${branch}]
     116        set variant [lindex ${variants} ${index}]
     117        if {[variant_isset ${variant}]} {
     118            perl5.major ${branch}
     119            depends_lib port:perl${branch}
     120        }
     121    }
     122}
     123
    68124# Set some variables.
    69125options perl5.version perl5.major perl5.arch perl5.lib perl5.bindir perl5.archlib perl5.bin
     
    125181    if {[string match p5-* $name]} {
    126182        set rootname        [string range $name 3 end]
    127 
    128         foreach v ${perl5.branches} {
    129             subport p${v}-${rootname} {
    130                 depends_lib port:perl${v}
    131                 perl5.major ${v}
    132             }
    133         }
     183        perl5.create_subports ${perl5.branches} ${rootname}
    134184
    135185        if {$subport eq $name} {
Note: See TracChangeset for help on using the changeset viewer.