Skip to content
Permalink
Browse files

Bug:

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

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

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@3882 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Felix Kronlage
Felix Kronlage committed Nov 3, 2003
1 parent 24b85e5 commit a79dc46bc7b9018e94d365342c977c51a2fad94e
Showing with 62 additions and 0 deletions.
  1. +15 −0 doc/portfile.7
  2. +47 −0 src/port1.0/portutil.tcl
@@ -714,6 +714,21 @@ The key variant is used to begin the gnome variant as shown in the example.
.Dl variant gnome { configure.args-append --with-gnome \
depends_lib-append lib:gnome-session:gnome-session }
.El
.Ss PLATFORM OPTIONS
DarwinPorts 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.
.Bl -tag -width lc
.It Ic platform
The platform key is used to begin the darwin platform definitions as shown in the example from the databases/db4 Portfile.
.br
.Sy Type:
.Em optional
.br
.Sy Example:
.Dl platform darwin 6 { configure.args-append --enable-tcl \
--with-tcl=/System/Library/Tcl/8.3 }
.br
The platform version is optional, and an optional architecture can be specified after the version.
.El
.Sh AUTHORS
.An "Landon Fuller" Aq landonf@opendarwin.org
.An "Kevin Van Vechten" Aq kevin@opendarwin.org
@@ -348,6 +348,53 @@ proc variant_unset {name} {
set variations($name) -
}

# platform <os> [<release>] [<arch>]
# Portfile level procedure to provide support for declaring platform-specifics
# Basically, just wrap 'variant', so that Portfiles' platform declarations can
# be more readable, and support arch and version specifics
proc platform {args} {
global all_variants PortInfo os.platform os.arch os.version
upvar $args upargs

set len [llength $args]
set code [lindex $args end]
set os [lindex $args 0]
set args [lrange $args 1 [expr $len - 2]]

set ditem [variant_new "temp-variant"]

foreach arg $args {
if {[regexp {(^[0-9]$)} $arg match result]} {
set release $result
} elseif {[regexp {([a-zA-Z0-9]*)} $arg match result]} {
set arch $result
}
}

# Add the variant for this platform
set platform $os
if {[info exists release]} { set platform ${platform}_${release} }
if {[info exists arch]} { set platform ${platform}_${arch} }

variant $platform $code

# Set the variant if this platform matches the platform we're on
if {[info exists os.platform] && ${os.platform} == $os} {
set sel_platform $os
if {[info exists os.version] && [info exists release]} {
regexp {([0-9]*)[0-9\.]?} ${os.version} match major
if {$major == $release } {
set sel_platform ${sel_platform}_${release}
}
}
if {[info exists os.arch] && [info exists arch] && ${os.arch} == $arch} {
set sel_platform $arch
}
variant_set $sel_platform
}

}

########### Misc Utility Functions ###########

# tbool (testbool)

0 comments on commit a79dc46

Please sign in to comment.
You can’t perform that action at this time.