[141134] trunk/base/src/port1.0/portconfigure.tcl

jeremyhu at macports.org jeremyhu at macports.org
Sun Oct 11 10:09:05 PDT 2015


Revision: 141134
          https://trac.macports.org/changeset/141134
Author:   jeremyhu at macports.org
Date:     2015-10-11 10:09:05 -0700 (Sun, 11 Oct 2015)
Log Message:
-----------
Refactor and update portconfigure::get_compiler_fallback

Separate out list generation into stages for easier updates in the future.
Use newer clang versions when using libc++ as our default C++ runtime.
Don't add legacy gcc fallbacks on El Capitan.

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

Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl	2015-10-11 16:15:20 UTC (rev 141133)
+++ trunk/base/src/port1.0/portconfigure.tcl	2015-10-11 17:09:05 UTC (rev 141134)
@@ -473,28 +473,58 @@
 
 # internal function to choose compiler fallback list based on platform
 proc portconfigure::get_compiler_fallback {} {
-    global xcodeversion macosx_deployment_target default_compilers configure.sdkroot
+    global xcodeversion macosx_deployment_target default_compilers configure.sdkroot configure.cxx_stdlib os.major
+
+    # Check our override
     if {[info exists default_compilers]} {
         return $default_compilers
-    } elseif {$xcodeversion eq "none" || $xcodeversion eq ""} {
+    }
+
+    # Check for platforms without Xcode
+    if {$xcodeversion eq "none" || $xcodeversion eq ""} {
         return {cc}
-    } elseif {[vercmp $xcodeversion 5.0] >= 0} {
-        return {clang macports-clang-3.4 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2}
+    }
+
+    # Legacy cases
+    if {[vercmp $xcodeversion 4.0] < 0} {
+        if {[vercmp $xcodeversion 3.2] >= 0} {
+            if {[string match *10.4u* ${configure.sdkroot}]} {
+                return {gcc-4.0}
+            }
+        } elseif {[vercmp $xcodeversion 3.0] >= 0} {
+            return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.4 macports-clang-3.3}
+        } else {
+            return {apple-gcc-4.2 gcc-4.0 gcc-3.3 macports-clang-3.3}
+        }
+    }
+
+    set compilers {}
+
+    # Set our preferred Xcode-provided compilers
+    if {[vercmp $xcodeversion 5.0] >= 0} {
+        lappend compilers clang
     } elseif {[vercmp $xcodeversion 4.3] >= 0} {
-        return {clang llvm-gcc-4.2 macports-clang-3.4 macports-clang-3.3 apple-gcc-4.2}
+        lappend compilers clang llvm-gcc-4.2
     } elseif {[vercmp $xcodeversion 4.0] >= 0} {
-        return {llvm-gcc-4.2 clang gcc-4.2 macports-clang-3.4 macports-clang-3.3 apple-gcc-4.2}
-    } elseif {[vercmp $xcodeversion 3.2] >= 0} {
-        if {[string match *10.4u* ${configure.sdkroot}]} {
-            return {gcc-4.0}
-        } else {
-            return {gcc-4.2 clang llvm-gcc-4.2 macports-clang-3.4 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2 gcc-4.0}
-        }
-    } elseif {[vercmp $xcodeversion 3.0] >= 0} {
-        return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.4 macports-clang-3.3}
+        lappend compilers llvm-gcc-4.2 clang
     } else {
-        return {apple-gcc-4.2 gcc-4.0 gcc-3.3 macports-clang-3.3}
+        lappend compilers gcc-4.2 clang llvm-gcc-4.2
     }
+
+    # Determine which versions of clang we prefer
+    if {${configure.cxx_stdlib} eq "libc++"} { # clang-3.5+ require libc++
+        lappend compilers macports-clang-3.7 macports-clang-3.6 macports-clang-3.5 macports-clang-3.4
+    } else {
+        lappend compilers macports-clang-3.4 macports-clang-3.3
+    }
+
+    # Determine if we have MacPorts-provided legacy gcc fallbacks
+    if {${os.major} < 15} {
+        lappend compilers macports-llvm-gcc-4.2 apple-gcc-4.2
+    }
+
+    ui_debug "Preferred compilers: $compilers"
+    return $compilers
 }
 
 # Find a developer tool
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151011/eec8a0a2/attachment.html>


More information about the macports-changes mailing list