That looks good to me, but I would very much like to know what ports fall into
this category, so I can check if this is still the case with top-of-tree clang
and file a bug against the compiler if necessary.
I know wine falls into this category, but most "normal" ports should be fine
with clang (or llvm-gcc if clang doesn't work for some reason, but again please
file compiler bugs or poke me to do so).
Also, as clang gets fixed for these issues in future XCodes, we should change
that ${configure.compiler} == "clang" to ${configure.compiler} == "clang" &&
[vercmp $xcodeversion Fixed.Version] < 0
--Jeremy
On Jan 14, 2012, at 8:14 PM, Ryan Schmidt wrote:
> On this page:
>
> https://trac.macports.org/wiki/PortfileRecipes#compiler
>
> We have this block of code we recommend portfile authors use when neither
> clang nor llvm-gcc-4.2 will work, to fall back to gcc-4.2 if that exists, or
> install and use apple-gcc42 if not:
>
> if {${configure.compiler} == "clang" ||
> ${configure.compiler} == "llvm-gcc-4.2"} {
> configure.compiler gcc-4.2
> if {![file executable ${configure.cc}]} {
> depends_build-append port:apple-gcc42
> configure.compiler apple-gcc-4.2
> # base (as of 2.0.3) doesn't set cxx for apple-gcc-4.2
> configure.cxx ${prefix}/bin/g++-apple-4.2
> }
> }
>
> The hope of this code is that on Xcode 4.0 and 4.1, Xcode's gcc-4.2 compiler
> will be used, and on Xcode 4.2 and up, where gcc is no longer included, the
> apple-gcc42 port will be built and used.
>
> The problem, we're discovering, is that upgrading to Xcode 4.2 does not
> remove the gcc compilers previous Xcode versions might have installed. So, a
> user with Xcode 4.2 might very well have a copy of gcc-4.2 that came from,
> say, Xcode 3.2. In some cases this will not work and will cause bug reports
> like this:
>
> https://trac.macports.org/ticket/32811
>
> I suggest we change the recommended block so that we check not for the
> executability of configure.cc, but for the Xcode version; on Xcode 4.2 and
> up, we should use apple-gcc42, even if an old gcc-4.2 is still there.
>
> So instead of:
>
> if {![file executable ${configure.cc}]} {
>
> We should use:
>
> if {[vercmp $xcodeversion 4.2] >= 0} {
>
> Comments?
>
>
> _______________________________________________
> macports-dev mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev
>
_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev