Changeset 3882


Ignore:
Timestamp:
Nov 3, 2003, 3:18:45 PM (17 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.

Location:
trunk/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/doc/portfile.7

    r3674 r3882  
    715715                                depends_lib-append              lib:gnome-session:gnome-session }
    716716.El
     717.Ss PLATFORM OPTIONS
     718DarwinPorts allows for platform-specific conditional modification to be specified in a Portfile, much like variants, for handling differences between platforms and versions of the same platform.
     719.Bl -tag -width lc
     720.It Ic platform
     721The platform key is used to begin the darwin platform definitions as shown in the example from the databases/db4 Portfile.
     722.br
     723.Sy Type:
     724.Em optional
     725.br
     726.Sy Example:
     727.Dl platform darwin 6 { configure.args-append   --enable-tcl \
     728                                --with-tcl=/System/Library/Tcl/8.3 }
     729.br
     730The platform version is optional, and an optional architecture can be specified after the version.
     731.El
    717732.Sh AUTHORS
    718733.An "Landon Fuller" Aq landonf@opendarwin.org
  • 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.