Ignore:
Timestamp:
Nov 3, 2003, 3:18:45 PM (15 years ago)
Author:
fkr
Message:

Bug:
Submitted by: wbb4@
Reviewed by:
Approved by:
Obtained from:

platform key support by wbb4@. see portfile(7) for syntax.

File:
1 edited

Legend:

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

    r3834 r3882  
    349349}
    350350
     351# platform <os> [<release>] [<arch>]
     352# Portfile level procedure to provide support for declaring platform-specifics
     353# Basically, just wrap 'variant', so that Portfiles' platform declarations can
     354# be more readable, and support arch and version specifics
     355proc platform {args} {
     356        global all_variants PortInfo os.platform os.arch os.version
     357        upvar $args upargs
     358
     359        set len [llength $args]
     360        set code [lindex $args end]
     361        set os [lindex $args 0]
     362        set args [lrange $args 1 [expr $len - 2]]
     363       
     364        set ditem [variant_new "temp-variant"]
     365
     366        foreach arg $args {
     367                if {[regexp {(^[0-9]$)} $arg match result]} {
     368                        set release $result
     369                } elseif {[regexp {([a-zA-Z0-9]*)} $arg match result]} {
     370                        set arch $result
     371                }
     372        }
     373
     374        # Add the variant for this platform
     375        set platform $os
     376        if {[info exists release]} { set platform ${platform}_${release} }
     377        if {[info exists arch]} { set platform ${platform}_${arch} }
     378
     379        variant $platform $code
     380
     381        # Set the variant if this platform matches the platform we're on
     382        if {[info exists os.platform] && ${os.platform} == $os} {
     383                set sel_platform $os
     384                if {[info exists os.version] && [info exists release]} {
     385                        regexp {([0-9]*)[0-9\.]?} ${os.version} match major
     386                        if {$major == $release } {
     387                                set sel_platform ${sel_platform}_${release}
     388                        }
     389                }
     390                if {[info exists os.arch] && [info exists arch] && ${os.arch} == $arch} {
     391                        set sel_platform $arch
     392                }
     393                variant_set $sel_platform
     394        }
     395       
     396}
     397
    351398########### Misc Utility Functions ###########
    352399
Note: See TracChangeset for help on using the changeset viewer.