Changeset 1017 for trunk/base


Ignore:
Timestamp:
Oct 9, 2002, 10:11:27 AM (22 years ago)
Author:
kevin
Message:

Added variants.default to specify default variants. These do not override any
variants set by the client (command line).
Syntax:
variants.default +x11

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r1015 r1017  
    3333package require Pextlib 1.0
    3434
    35 global targets target_uniqid variants
     35global targets target_uniqid all_variants
    3636
    3737set targets [list]
    3838set target_uniqid 0
    3939
    40 set variants [list]
     40set all_variants [list]
    4141
    4242########### External High Level Procedures ###########
     
    207207# Portfile level procedure to provide support for declaring variants
    208208proc variant {args} {
    209     global variants PortInfo
     209    global all_variants PortInfo
    210210    upvar $args upargs
    211211   
     
    236236    $obj append requires $requires
    237237    $obj set code $code
    238     lappend variants $obj
     238    lappend all_variants $obj
    239239   
    240240    # Export provided variant to PortInfo
     
    380380# thought of any other way to do this.
    381381proc makeuserproc {name body} {
    382     regsub -- "^\{(.*)" $body "\{ \n foreach g \[info globals\] \{ \n global \$g \n \} \n \\1 " body
     382    regsub -- "^\{(.*?)" $body "\{ \n eval \"global \[info globals\]\" \n \\1" body
    383383    eval "proc $name {} $body"
    384384}
     
    743743    set name [$this get name]
    744744    ui_debug "Executing $name provides [$this get provides]"
    745     makeuserproc $name-code "\{[$this get code]\}"
    746     if ([catch $name-code result]) {
     745    makeuserproc ${name}-code "[$this get code]"
     746    if ([catch ${name}-code result]) {
    747747        ui_error "Error executing $name: $result"
    748748        return 1
     
    752752
    753753proc eval_variants {variations} {
    754     global variants
    755     set dlist $variants
     754    global all_variants
     755    set dlist $all_variants
    756756    upvar $variations upvariations
    757757    set chosen [choose_variants $dlist upvariations]
     
    995995}
    996996
    997 
     997options variants.default
     998option_proc variants.default handle_variants.default
     999proc handle_variants.default {option action args} {
     1000        global variations
     1001    switch -regex $action {
     1002                set|append {
     1003                        foreach v $args {
     1004                                if {[regexp {([-+])([-A-Za-z0-9_]+)} $v whole val variant]} {
     1005                                        if {![info exists variations($variant)]} {
     1006                                                set variations($variant) $val
     1007                                        }
     1008                                }
     1009                        }
     1010                }
     1011                delete {
     1012                        # xxx
     1013                }
     1014    }
     1015}
    9981016
    9991017##### portfile depspec subclass #####
Note: See TracChangeset for help on using the changeset viewer.