diff --git a/src/port1.0/portutil.tcl b/src/port1.0/portutil.tcl
index 1b010331..fd538d3e 100644
a
|
b
|
proc variant_desc {porturl variant} { |
769 | 769 | # Portfile level procedure to provide support for declaring platform-specifics |
770 | 770 | # Basically, just a fancy 'if', so that Portfiles' platform declarations can |
771 | 771 | # be more readable, and support arch and version specifics |
772 | | proc platform {args} { |
| 772 | proc platform {os args} { |
773 | 773 | global os.platform os.subplatform os.arch os.major |
774 | 774 | |
775 | | set len [llength $args] |
776 | | if {$len < 2} { |
| 775 | if {[llength $args] < 1} { |
777 | 776 | return -code error "Malformed platform specification" |
778 | 777 | } |
779 | | set code [lindex $args end] |
780 | | set os [lindex $args 0] |
781 | | set args [lrange $args 1 [expr {$len - 2}]] |
| 778 | set len 1 |
| 779 | if {[lindex $args end-1] eq "else"} { |
| 780 | set code [lindex $args end-2] |
| 781 | set altcode [lindex $args end] |
| 782 | set consumed 3 |
| 783 | } else { |
| 784 | set code [lindex $args end] |
| 785 | set altcode "" |
| 786 | set consumed 1 |
| 787 | } |
782 | 788 | |
783 | | foreach arg $args { |
| 789 | foreach arg [lrange $args 0 end-$consumed] { |
784 | 790 | if {[regexp {(^[0-9]+$)} $arg match result]} { |
785 | 791 | set release $result |
| 792 | set len [expr $len + 1] |
786 | 793 | } elseif {[regexp {([a-zA-Z0-9]*)} $arg match result]} { |
787 | 794 | set arch $result |
| 795 | set len [expr $len + 1] |
788 | 796 | } |
789 | 797 | } |
790 | 798 | |
791 | 799 | set match 0 |
792 | 800 | # 'os' could be a platform or an arch when it's alone |
793 | | if {$len == 2 && ($os eq ${os.platform} || $os eq ${os.subplatform} || $os eq ${os.arch})} { |
| 801 | if {$len == 1 && ($os eq ${os.platform} || $os eq ${os.subplatform} || $os eq ${os.arch})} { |
794 | 802 | set match 1 |
795 | 803 | } elseif {($os eq ${os.platform} || $os eq ${os.subplatform}) |
796 | 804 | && (![info exists release] || ${os.major} == $release) |
… |
… |
proc platform {args} { |
801 | 809 | # Execute the code if this platform matches the platform we're on |
802 | 810 | if {$match} { |
803 | 811 | uplevel 1 $code |
| 812 | } elseif {${altcode} ne ""} { |
| 813 | uplevel 1 $altcode |
804 | 814 | } |
805 | 815 | } |
806 | 816 | |