[54198] branches/images-and-archives/base

blb at macports.org blb at macports.org
Wed Jul 22 18:29:24 PDT 2009


Revision: 54198
          http://trac.macports.org/changeset/54198
Author:   blb at macports.org
Date:     2009-07-22 18:29:22 -0700 (Wed, 22 Jul 2009)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/port1.0/portconfigure.tcl
    branches/images-and-archives/base/src/port1.0/portutil.tcl

Property Changed:
----------------
    branches/images-and-archives/base/


Property changes on: branches/images-and-archives/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:50249-53831
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:50249-54197
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-22 23:43:07 UTC (rev 54197)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-23 01:29:22 UTC (rev 54198)
@@ -1096,11 +1096,9 @@
 
     $workername eval source Portfile
 
-    # add the default universal variant, but only if
-    # it will work and another one isn't already present
-    if {[$workername eval default_universal_variant_allowed]} {
-        $workername eval add_default_universal_variant
-    }
+    # add the default universal variant if appropriate, and set up flags that
+    # are conditional on whether universal is set
+    $workername eval universal_setup
 
     # evaluate the variants
     if {[$workername eval eval_variants variations] != 0} {

Modified: branches/images-and-archives/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portconfigure.tcl	2009-07-22 23:43:07 UTC (rev 54197)
+++ branches/images-and-archives/base/src/port1.0/portconfigure.tcl	2009-07-23 01:29:22 UTC (rev 54198)
@@ -139,10 +139,7 @@
 set_ui_prefix
 
 proc portconfigure::configure_start {args} {
-    global UI_PREFIX configure.compiler configure.optflags configure.archflags
-    global configure.march configure.mtune configure.universal_cflags
-    global configure.universal_cxxflags configure.universal_cppflags 
-    global configure.universal_ldflags configure.universal_args
+    global UI_PREFIX configure.compiler
     
     ui_msg "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option name]]"
 
@@ -167,28 +164,6 @@
         default { return -code error "Invalid value for configure.compiler" }
     }
     ui_debug "Using compiler '$name'"
-    
-    # add in extra CFLAGS etc
-    if {[variant_exists universal] && [variant_isset universal]} {
-        foreach flag {cflags objcflags fflags f90flags fcflags} {
-            eval configure.${flag}-append ${configure.universal_cflags}
-        }
-        eval configure.cxxflags-append ${configure.universal_cxxflags}
-        eval configure.cppflags-append ${configure.universal_cppflags}
-        eval configure.ldflags-append ${configure.universal_ldflags}
-        eval configure.pre_args-append ${configure.universal_args}
-    } else {
-        foreach flag {cflags cxxflags objcflags fflags f90flags fcflags} {
-            eval configure.${flag}-append ${configure.archflags}
-            if {${configure.march} != {}} {
-                configure.${flag}-append "-march=${configure.march}"
-            }
-            if {${configure.mtune} != {}} {
-                configure.${flag}-append "-mtune=${configure.mtune}"
-            }
-        }
-        eval configure.ldflags-append ${configure.archflags}
-    }
 }
 
 # internal function to determine the compiler flags to select an arch

Modified: branches/images-and-archives/base/src/port1.0/portutil.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-07-22 23:43:07 UTC (rev 54197)
+++ branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-07-23 01:29:22 UTC (rev 54198)
@@ -1630,28 +1630,40 @@
     flush $fd
 }
 
-# check_statefile_variants
+##
 # Check that recorded selection of variants match the current selection
-proc check_statefile_variants {variations fd} {
+#
+# @param variations input array name of new variants
+# @param oldvariations output array name of old variants
+# @param fd file descriptor of the state file
+# @return 0 if variants match, 1 otherwise
+proc check_statefile_variants {variations oldvariations fd} {
     upvar $variations upvariations
+    upvar $oldvariations upoldvariations
 
+    array set upoldvariations {}
+
+    seek $fd 0 end
+    if {[tell $fd] == 0} {
+        # Statefile is empty, skipping further tests
+        return 0
+    }
+
     seek $fd 0
     while {[gets $fd line] >= 0} {
         if {[regexp "variant: (.*)" $line match name]} {
-            set oldvariations([string range $name 1 end]) [string range $name 0 0]
+            set upoldvariations([string range $name 1 end]) [string range $name 0 0]
         }
     }
 
     set mismatch 0
-    if {[array size oldvariations] > 0} {
-        if {[array size oldvariations] != [array size upvariations]} {
-            set mismatch 1
-        } else {
-            foreach key [array names upvariations *] {
-                if {![info exists oldvariations($key)] || $upvariations($key) != $oldvariations($key)} {
+    if {[array size upoldvariations] != [array size upvariations]} {
+        set mismatch 1
+    } else {
+        foreach key [array names upvariations *] {
+            if {![info exists upoldvariations($key)] || $upvariations($key) != $upoldvariations($key)} {
                 set mismatch 1
                 break
-                }
             }
         }
     }
@@ -1838,8 +1850,9 @@
 
         set state_fd [open_statefile]
 
-        if {[check_statefile_variants upvariations $state_fd]} {
-            ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
+        array set oldvariations {}
+        if {[check_statefile_variants upvariations oldvariations $state_fd]} {
+            ui_error "Requested variants \"[canonicalize_variants [array get upvariations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean $portname' or specify the force option (-f)."
             set result 1
         } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
             # Write variations out to the statefile
@@ -1854,33 +1867,51 @@
     return $result
 }
 
-proc default_universal_variant_allowed {args} {
-
+# add the default universal variant if appropriate, and set up flags that are
+# conditional on whether universal is set
+proc universal_setup {args} {
+    global configure.archflags
+    global configure.march configure.mtune configure.universal_cflags
+    global configure.universal_cxxflags configure.universal_cppflags 
+    global configure.universal_ldflags configure.universal_args
+    
     if {[variant_exists universal]} {
         ui_debug "universal variant already exists, so not adding the default one"
-        return no
     } elseif {[exists universal_variant] && ![option universal_variant]} {
         ui_debug "'universal_variant no' specified, so not adding the default universal variant"
-        return no
     } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
         ui_debug "using xmkmf, so not adding the default universal variant"
-        return no
     } elseif {[exists use_configure] && ![option use_configure] && ![exists xcode.project]} {
         # Allow +universal if port uses xcode portgroup.
         ui_debug "not using configure, so not adding the default universal variant"
-        return no
     } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
         ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
-        return no
     } else {
         ui_debug "adding the default universal variant"
-        return yes
+        variant universal {}
     }
-}
 
-proc add_default_universal_variant {args} {
-    # Declare default universal variant (all the magic happens in portconfigure now)
-    variant universal {}
+    # add in extra CFLAGS etc
+    if {[variant_exists universal] && [variant_isset universal]} {
+        foreach flag {cflags objcflags fflags f90flags fcflags} {
+            eval configure.${flag}-append ${configure.universal_cflags}
+        }
+        eval configure.cxxflags-append ${configure.universal_cxxflags}
+        eval configure.cppflags-append ${configure.universal_cppflags}
+        eval configure.ldflags-append ${configure.universal_ldflags}
+        eval configure.pre_args-append ${configure.universal_args}
+    } else {
+        foreach flag {cflags cxxflags objcflags fflags f90flags fcflags} {
+            eval configure.${flag}-append ${configure.archflags}
+            if {${configure.march} != {}} {
+                configure.${flag}-append "-march=${configure.march}"
+            }
+            if {${configure.mtune} != {}} {
+                configure.${flag}-append "-mtune=${configure.mtune}"
+            }
+        }
+        eval configure.ldflags-append ${configure.archflags}
+    }
 }
 
 # Target class definition.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090722/4008ac77/attachment.html>


More information about the macports-changes mailing list