Changes between Version 29 and Version 30 of PortfileRecipes


Ignore:
Timestamp:
Sep 30, 2011, 10:44:16 PM (13 years ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

add compiler-based-on-Xcode section

Legend:

Unmodified
Added
Removed
Modified
  • PortfileRecipes

    v29 v30  
    256256If you modify a port to remove `-arch` flags from its *-config scripts and/or *.pc files, don't forget to also increase the port's revision (unless you're already increasing its version).
    257257
     258== Specifying which compiler to use based on the version of Xcode == #compiler
     259
     260As of MacPorts 2, the default value of configure.compiler is chosen based on Xcode version instead of OS X version. If a certain compiler won't build your port, test whether that compiler has been chosen, and then set a different compiler that does work. When choosing an alternate compiler, keep in mind that as of Xcode 4, we would prefer ports build with clang. If that's not possible, use llvm-gcc-4.2. If neither work, use gcc-4.2, but provide a fallback to apple-gcc-4.2.
     261
     262If your port works with clang but not llvm-gcc-4.2, do this:
     263
     264{{{
     265if {${configure.compiler} == "llvm-gcc-4.2"} {
     266    configure.compiler clang
     267}
     268}}}
     269
     270If your port works with llvm-gcc-4.2 but not clang, do this:
     271
     272{{{
     273if {${configure.compiler} == "clang"} {
     274    configure.compiler llvm-gcc-4.2
     275}
     276}}}
     277
     278If your port works with neither clang nor llvm-gcc-4.2, use gcc-4.2 and add a fallback to apple-gcc-4.2. This should be considered a temporary stopgap measure. Please file a bug report with the upstream developers of the software so they can fix it to work with clang and llvm-gcc-4.2. Put a reference to the upstream bug report in the Portfile.
     279
     280{{{
     281if {${configure.compiler} == "clang" ||
     282    ${configure.compiler} == "llvm-gcc-4.2"} {
     283    configure.compiler gcc-4.2
     284    if {![file executable ${configure.cc}]} {
     285        depends_build-append port:apple-gcc42
     286        configure.compiler apple-gcc-4.2
     287    }
     288}
     289}}}
     290
     291These snippets are taken from [http://lists.macosforge.org/pipermail/macports-dev/2011-July/015263.html this message on macports-dev].
     292
    258293== Providing compiler variants == #gcc
    259294