[53860] trunk/base/src

jmr at macports.org jmr at macports.org
Wed Jul 15 16:22:47 PDT 2009


Revision: 53860
          http://trac.macports.org/changeset/53860
Author:   jmr at macports.org
Date:     2009-07-15 16:22:46 -0700 (Wed, 15 Jul 2009)
Log Message:
-----------
Move conditionally adding the default universal variant and setting up the flags that depend on whether universal is set into a universal_setup proc. This avoids problems when the configure phase is skipped as well as making the flags available earlier (in variant bodies).

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/port1.0/portconfigure.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-07-15 21:53:08 UTC (rev 53859)
+++ trunk/base/src/macports1.0/macports.tcl	2009-07-15 23:22:46 UTC (rev 53860)
@@ -1121,11 +1121,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: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl	2009-07-15 21:53:08 UTC (rev 53859)
+++ trunk/base/src/port1.0/portconfigure.tcl	2009-07-15 23:22:46 UTC (rev 53860)
@@ -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: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2009-07-15 21:53:08 UTC (rev 53859)
+++ trunk/base/src/port1.0/portutil.tcl	2009-07-15 23:22:46 UTC (rev 53860)
@@ -1854,33 +1854,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/20090715/27c0d87d/attachment.html>


More information about the macports-changes mailing list