Changeset 141134 for trunk/base


Ignore:
Timestamp:
Oct 11, 2015, 5:09:05 PM (4 years ago)
Author:
jeremyhu@…
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portconfigure.tcl

    r139270 r141134  
    474474# internal function to choose compiler fallback list based on platform
    475475proc portconfigure::get_compiler_fallback {} {
    476     global xcodeversion macosx_deployment_target default_compilers configure.sdkroot
     476    global xcodeversion macosx_deployment_target default_compilers configure.sdkroot configure.cxx_stdlib os.major
     477
     478    # Check our override
    477479    if {[info exists default_compilers]} {
    478480        return $default_compilers
    479     } elseif {$xcodeversion eq "none" || $xcodeversion eq ""} {
     481    }
     482
     483    # Check for platforms without Xcode
     484    if {$xcodeversion eq "none" || $xcodeversion eq ""} {
    480485        return {cc}
    481     } elseif {[vercmp $xcodeversion 5.0] >= 0} {
    482         return {clang macports-clang-3.4 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2}
     486    }
     487
     488    # Legacy cases
     489    if {[vercmp $xcodeversion 4.0] < 0} {
     490        if {[vercmp $xcodeversion 3.2] >= 0} {
     491            if {[string match *10.4u* ${configure.sdkroot}]} {
     492                return {gcc-4.0}
     493            }
     494        } elseif {[vercmp $xcodeversion 3.0] >= 0} {
     495            return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.4 macports-clang-3.3}
     496        } else {
     497            return {apple-gcc-4.2 gcc-4.0 gcc-3.3 macports-clang-3.3}
     498        }
     499    }
     500
     501    set compilers {}
     502
     503    # Set our preferred Xcode-provided compilers
     504    if {[vercmp $xcodeversion 5.0] >= 0} {
     505        lappend compilers clang
    483506    } elseif {[vercmp $xcodeversion 4.3] >= 0} {
    484         return {clang llvm-gcc-4.2 macports-clang-3.4 macports-clang-3.3 apple-gcc-4.2}
     507        lappend compilers clang llvm-gcc-4.2
    485508    } elseif {[vercmp $xcodeversion 4.0] >= 0} {
    486         return {llvm-gcc-4.2 clang gcc-4.2 macports-clang-3.4 macports-clang-3.3 apple-gcc-4.2}
    487     } elseif {[vercmp $xcodeversion 3.2] >= 0} {
    488         if {[string match *10.4u* ${configure.sdkroot}]} {
    489             return {gcc-4.0}
    490         } else {
    491             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}
    492         }
    493     } elseif {[vercmp $xcodeversion 3.0] >= 0} {
    494         return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.4 macports-clang-3.3}
     509        lappend compilers llvm-gcc-4.2 clang
    495510    } else {
    496         return {apple-gcc-4.2 gcc-4.0 gcc-3.3 macports-clang-3.3}
    497     }
     511        lappend compilers gcc-4.2 clang llvm-gcc-4.2
     512    }
     513
     514    # Determine which versions of clang we prefer
     515    if {${configure.cxx_stdlib} eq "libc++"} { # clang-3.5+ require libc++
     516        lappend compilers macports-clang-3.7 macports-clang-3.6 macports-clang-3.5 macports-clang-3.4
     517    } else {
     518        lappend compilers macports-clang-3.4 macports-clang-3.3
     519    }
     520
     521    # Determine if we have MacPorts-provided legacy gcc fallbacks
     522    if {${os.major} < 15} {
     523        lappend compilers macports-llvm-gcc-4.2 apple-gcc-4.2
     524    }
     525
     526    ui_debug "Preferred compilers: $compilers"
     527    return $compilers
    498528}
    499529
Note: See TracChangeset for help on using the changeset viewer.