[109893] branches/release_2_2/base/src/port1.0/portconfigure.tcl

larryv at macports.org larryv at macports.org
Wed Aug 21 07:37:40 PDT 2013


Revision: 109893
          https://trac.macports.org/changeset/109893
Author:   larryv at macports.org
Date:     2013-08-21 07:37:40 -0700 (Wed, 21 Aug 2013)
Log Message:
-----------
Merge r108037, r108039, r108040 from trunk, supporting
"macports-dragonegg-X.Y-gcc-A.B" compiler values.

Revision Links:
--------------
    https://trac.macports.org/changeset/108037
    https://trac.macports.org/changeset/108039
    https://trac.macports.org/changeset/108040

Modified Paths:
--------------
    branches/release_2_2/base/src/port1.0/portconfigure.tcl

Property Changed:
----------------
    branches/release_2_2/base/src/port1.0/portconfigure.tcl

Modified: branches/release_2_2/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/release_2_2/base/src/port1.0/portconfigure.tcl	2013-08-21 14:31:06 UTC (rev 109892)
+++ branches/release_2_2/base/src/port1.0/portconfigure.tcl	2013-08-21 14:37:40 UTC (rev 109893)
@@ -207,37 +207,37 @@
 set_ui_prefix
 
 proc portconfigure::configure_start {args} {
-    global UI_PREFIX configure.compiler
-    
+    global UI_PREFIX
+
     ui_notice "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option subport]]"
 
-    set name ""
-    switch -exact ${configure.compiler} {
-        cc { set name "System cc" }
-        gcc { set name "System GCC" }
-        gcc-3.3 { set name "Mac OS X GCC 3.3" }
-        gcc-4.0 { set name "Mac OS X GCC 4.0" }
-        gcc-4.2 { set name "Mac OS X GCC 4.2" }
-        llvm-gcc-4.2 { set name "Mac OS X LLVM-GCC 4.2" }
-        clang { set name "Mac OS X Clang" }
-        apple-gcc-4.0 { set name "MacPorts Apple GCC 4.0" }
-        apple-gcc-4.2 { set name "MacPorts Apple GCC 4.2" }
-        macports-gcc     { set name "MacPorts GCC (port select)" }
-        macports-llvm-gcc-4.2 { set name "MacPorts LLVM-GCC 4.2" }
-        macports-clang { set name "MacPorts Clang (port select)" }
-        default {
-            if {[regexp {macports-clang-(.*)\.(.*)} ${configure.compiler} -> major minor]} {
-                set name "MacPorts Clang ${major}.${minor}"
-            } elseif {[regexp {macports-dragonegg-(.*)\.(.*)} ${configure.compiler} -> major minor]} {
-                set name "MacPorts DragonEgg ${major}.${minor}"
-            } elseif {[regexp {macports-gcc-(.*)\.(.*)} ${configure.compiler} -> major minor]} {
-                set name "MacPorts GCC ${major}.${minor}"
-            } else {
-                return -code error "Invalid value for configure.compiler: ${configure.compiler}"
-            }
+    set compiler [option configure.compiler]
+    set valid_compilers {
+        {^apple-gcc-(4\.[02])$}             {MacPorts Apple GCC %s}
+        {^cc$}                              {System cc}
+        {^clang$}                           {Xcode Clang}
+        {^gcc$}                             {System GCC}
+        {^gcc-(3\.3|4\.[02])$}              {Xcode GCC %s}
+        {^llvm-gcc-4\.2$}                   {Xcode LLVM-GCC 4.2}
+        {^macports-clang$}                  {MacPorts Clang (port select}
+        {^macports-clang-(\d+\.\d+)$}       {MacPorts Clang %s}
+        {^macports-dragonegg-(\d+\.\d+)$}   {MacPorts DragonEgg %s}
+        {^macports-dragonegg-(\d+\.\d+)-gcc-(\d+\.\d+)$}
+            {MacPorts DragonEgg %s with GCC %s}
+        {^macports-gcc$}                    {MacPorts GCC (port select)}
+        {^macports-gcc-(\d+\.\d+)$}         {MacPorts GCC %s}
+        {^macports-llvm-gcc-4\.2$}          {MacPorts LLVM-GCC 4.2}
+    }
+    foreach {re fmt} $valid_compilers {
+        if {[set matches [regexp -inline $re $compiler]] ne {}} {
+            set compiler_name [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
+            break
         }
     }
-    ui_debug "Using compiler '$name'"
+    if {![info exists compiler_name]} {
+        return -code error "Invalid value for configure.compiler: $compiler"
+    }
+    ui_debug "Using compiler '$compiler_name'"
 
     # Additional ccache directory setup
     global configure.ccache ccache_dir ccache_size macportsuser
@@ -400,20 +400,22 @@
         macports-dragonegg-3.3  dragonegg-3.3
 }
 
+# Mapping from compiler names to compiler ports, for private use by
+# compiler_port_name. Do not access directly.
+set portconfigure::valid_compiler_ports {
+    {^apple-gcc-(\d+)\.(\d+)$}                          {apple-gcc%s%s}
+    {^macports-clang-(\d+\.\d+)$}                       {clang-%s}
+    {^macports-dragonegg-(\d+\.\d+)(-gcc-\d+\.\d+)?$}   {dragonegg-%s%s}
+    {^macports-(llvm-)?gcc-(\d+)\.(\d+)$}               {%sgcc%s%s}
+}
+
 proc portconfigure::compiler_port_name {compiler} {
-    if {[regexp {apple-gcc-(.*)\.(.*)} ${compiler} -> major minor]} {
-        return "apple-gcc${major}${minor}"
-    } elseif {[regexp {macports-clang-(.*)\.(.*)} ${compiler} -> major minor]} {
-        return "clang-${major}.${minor}"
-    } elseif {[regexp {macports-dragonegg-(.*)\.(.*)} ${compiler} -> major minor]} {
-        return "dragonegg-${major}.${minor}"
-    } elseif {[regexp {macports-gcc-(.*)\.(.*)} ${compiler} -> major minor]} {
-        return "gcc${major}${minor}"
-    } elseif {[regexp {macports-llvm-gcc-(.*)\.(.*)} ${compiler} -> major minor]} {
-        return "llvm-gcc${major}${minor}"
+    foreach {re fmt} $portconfigure::valid_compiler_ports {
+        if {[set matches [regexp -inline $re $compiler]] ne {}} {
+            return [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
+        }
     }
-
-    return ""
+    return {}
 }
 
 proc portconfigure::compiler_is_port {compiler} {
@@ -505,9 +507,34 @@
         set compiler ${configure.compiler}
     }
     # Tcl 8.4's switch doesn't support -matchvar.
-    if {[regexp {^gcc(-3\.3|-4\.0|-4\.2)?$} $compiler -> suffix]} {
+    if {[regexp {^apple-gcc(-4\.[02])$} $compiler -> suffix]} {
         switch $type {
             cc      -
+            objc    { return ${prefix}/bin/gcc-apple${suffix} }
+            cxx     -
+            objcxx  {
+                if {$suffix == "-4.2"} {
+                    return ${prefix}/bin/g++-apple${suffix}
+                }
+            }
+            cpp     { return ${prefix}/bin/cpp-apple${suffix} }
+        }
+    } elseif {[regexp {^clang$} $compiler]} {
+        switch $type {
+            cc      -
+            objc    { return [find_developer_tool clang] }
+            cxx     -
+            objcxx  {
+                set clangpp [find_developer_tool clang++]
+                if {[file executable $clangpp]} {
+                    return $clangpp
+                }
+                return [find_developer_tool llvm-g++-4.2]
+            }
+        }
+    } elseif {[regexp {^gcc(-3\.3|-4\.[02])?$} $compiler -> suffix]} {
+        switch $type {
+            cc      -
             objc    { return [find_developer_tool "gcc${suffix}"] }
             cxx     -
             objcxx  { return [find_developer_tool "g++${suffix}"] }
@@ -521,33 +548,33 @@
             objcxx  { return [find_developer_tool llvm-g++-4.2] }
             cpp     { return [find_developer_tool llvm-cpp-4.2] }
         }
-    } elseif {[regexp {^clang$} $compiler]} {
+    } elseif {[regexp {^macports-clang(-\d+\.\d+)?$} $compiler -> suffix]} {
+        if {$suffix ne {}} {
+            set suffix "-mp${suffix}"
+        }
         switch $type {
             cc      -
-            objc    { return [find_developer_tool clang] }
+            objc    { return ${prefix}/bin/clang${suffix} }
             cxx     -
-            objcxx  {
-                set clangpp [find_developer_tool clang++]
-                if {[file executable $clangpp]} {
-                    return $clangpp
-                }
-                return [find_developer_tool llvm-g++-4.2]
-            }
+            objcxx  { return ${prefix}/bin/clang++${suffix} }
         }
-    } elseif {[regexp {^apple-gcc(-4\.0|-4\.2)$} $compiler -> suffix]} {
+    } elseif {[regexp {^macports-dragonegg(-\d+\.\d+)(?:-gcc(-\d+\.\d+))?$} $compiler \
+                -> infix suffix]} {
+        if {$suffix ne {}} {
+            set suffix "-mp${suffix}"
+        }
         switch $type {
             cc      -
-            objc    { return ${prefix}/bin/gcc-apple${suffix} }
+            objc    { return ${prefix}/bin/dragonegg${infix}-gcc${suffix} }
             cxx     -
-            objcxx  {
-                if {$suffix == "-4.2"} {
-                    return ${prefix}/bin/g++-apple${suffix}
-                }
-            }
-            cpp     { return ${prefix}/bin/cpp-apple${suffix} }
+            objcxx  { return ${prefix}/bin/dragonegg${infix}-g++${suffix} }
+            cpp     { return ${prefix}/bin/dragonegg${infix}-cpp${suffix} }
+            fc      -
+            f77     -
+            f90     { return ${prefix}/bin/dragonegg${infix}-gfortran${suffix} }
         }
     } elseif {[regexp {^macports-gcc(-\d+\.\d+)?$} $compiler -> suffix]} {
-        if {[string length $suffix]} {
+        if {$suffix ne {}} {
             set suffix "-mp${suffix}"
         }
         switch $type {
@@ -568,27 +595,6 @@
             objcxx  { return ${prefix}/bin/llvm-g++-4.2 }
             cpp     { return ${prefix}/bin/llvm-cpp-4.2 }
         }
-    } elseif {[regexp {^macports-clang(-\d+\.\d+)?$} $compiler -> suffix]} {
-        if {[string length $suffix]} {
-            set suffix "-mp${suffix}"
-        }
-        switch $type {
-            cc      -
-            objc    { return ${prefix}/bin/clang${suffix} }
-            cxx     -
-            objcxx  { return ${prefix}/bin/clang++${suffix} }
-        }
-    } elseif {[regexp {^macports-dragonegg(-\d+\.\d+)$} $compiler -> infix]} {
-        switch $type {
-            cc      -
-            objc    { return ${prefix}/bin/dragonegg${infix}-gcc }
-            cxx     -
-            objcxx  { return ${prefix}/bin/dragonegg${infix}-g++ }
-            cpp     { return ${prefix}/bin/dragonegg${infix}-cpp }
-            fc      -
-            f77     -
-            f90     { return ${prefix}/bin/dragonegg${infix}-gfortran }
-        }
     }
     # Fallbacks
     switch $type {


Property changes on: branches/release_2_2/base/src/port1.0/portconfigure.tcl
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src/port1.0/portconfigure.tcl:37343-46937
/branches/gsoc09-logging/base/src/port1.0/portconfigure.tcl:51231-60371
/branches/gsoc11-rev-upgrade/base/src/port1.0/portconfigure.tcl:78828-88375
/branches/universal-sanity/base/src/port1.0/portconfigure.tcl:51872-52323
/branches/variant-descs-14482/base/src/port1.0/portconfigure.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/port1.0/portconfigure.tcl:106802,106807,106809-106810,107106,107465,107527,107674,107753-108026,108406,109869
/users/perry/base-bugs_and_notes/src/port1.0/portconfigure.tcl:45682-46060
/users/perry/base-select/src/port1.0/portconfigure.tcl:44044-44692
   + /branches/gsoc08-privileges/base/src/port1.0/portconfigure.tcl:37343-46937
/branches/gsoc09-logging/base/src/port1.0/portconfigure.tcl:51231-60371
/branches/gsoc11-rev-upgrade/base/src/port1.0/portconfigure.tcl:78828-88375
/branches/universal-sanity/base/src/port1.0/portconfigure.tcl:51872-52323
/branches/variant-descs-14482/base/src/port1.0/portconfigure.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/port1.0/portconfigure.tcl:106802,106807,106809-106810,107106,107465,107527,107674,107753-108040,108406,109869
/users/perry/base-bugs_and_notes/src/port1.0/portconfigure.tcl:45682-46060
/users/perry/base-select/src/port1.0/portconfigure.tcl:44044-44692
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130821/4055593e/attachment-0001.html>


More information about the macports-changes mailing list