Changes between Version 59 and Version 60 of PortfileRecipes


Ignore:
Timestamp:
Mar 24, 2013, 8:44:23 PM (11 years ago)
Author:
larryv (Lawrence Velázquez)
Comment:

update default GCC variant; add gcc48; remove some line breaks

Legend:

Unmodified
Added
Removed
Modified
  • PortfileRecipes

    v59 v60  
    308308== Providing compiler variants == #gcc
    309309
    310 By default, a port will compile using Apple's gcc compiler.
    311 For most ports this is fine, but some require a newer version of gcc, or are for some reason incompatible with Apple's version.
    312 In these cases you can use `configure.compiler` to specify an alternate compiler, for example one provided by a MacPorts gcc port.
    313 More commonly, a port specifies such a compiler because it needs gcj or gfortran, which Apple does not provide any version of at all.
    314 Another reason to want compiler variants is if the software installs a library, or uses a library built with a different gcc.
    315 Subtle and difficult-to-find errors can occur if a library and the program using it are not both compiled with the same compiler.
    316 
    317 So on the one hand, all such ports should default to using a particular common version of gcc; the version we are currently using as the default version in MacPorts is gcc45.
    318 On the other hand, a user may want to use a different gcc version.
    319 Therefore, ports that need to use a gcc port, but aren't picky about exactly which one, are encouraged to offer variants:
    320 
    321 {{{
    322 variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 description {Compile with gcc 4.3} {
     310By default, a port will compile using Apple's Clang or GCC compiler. For most ports this is fine, but some require a recent version of GCC, or are for some reason incompatible with Apple's version. In these cases you can use `configure.compiler` to specify an alternate compiler, for example one provided by a MacPorts GCC port. More commonly, a port specifies such a compiler because it needs GCJ or GFortran, which Apple does not provide. The software may also install a library or use a library built with a different GCC; subtle and difficult-to-find errors can occur if a library and the program using it are not both compiled with the same compiler.
     311
     312So on the one hand, all such ports should default to using a particular common version of GCC; the version we are currently using as the default version in MacPorts is `gcc47`. On the other hand, a user may want to choose their GCC version. Therefore, ports that need to use a GCC port, but aren't picky about exactly which one, are encouraged to offer variants:
     313
     314{{{
     315variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 description {Compile with gcc 4.3} {
    323316    configure.compiler macports-gcc-4.3
    324317    depends_lib-append port:gcc43
    325318}
    326319
    327 variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 description {Compile with gcc 4.4} {
     320variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 description {Compile with gcc 4.4} {
    328321    configure.compiler macports-gcc-4.4
    329322    depends_lib-append port:gcc44
    330323}
    331324
    332 variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 description {Compile with gcc 4.5} {
     325variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 description {Compile with gcc 4.5} {
    333326    configure.compiler macports-gcc-4.5
    334327    depends_lib-append port:gcc45
    335328}
    336329
    337 variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 description {Compile with gcc 4.6} {
     330variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 description {Compile with gcc 4.6} {
    338331    configure.compiler macports-gcc-4.6
    339332    depends_lib-append port:gcc46
    340333}
    341334
    342 variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 description {Compile with gcc 4.7} {
     335variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 description {Compile with gcc 4.7} {
    343336    configure.compiler macports-gcc-4.7
    344337    depends_lib-append port:gcc47
    345338}
    346339
    347 if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47]} {
    348     default_variants +gcc45
    349 }
    350 }}}
    351 
    352 Note that the variants are all marked as conflicting with one another, and that one is chosen by default if the user has not picked one.
    353 Note also that the compiler dependencies are library dependencies because programs compiled using these compilers will generally end up linked to at least one of the compiler's libraries (i.e. libgcc_s.dylib, libgfortran.dylib, etc.).
    354 
    355 Setting `configure.compiler` changes the values MacPorts puts in variables like ${configure.cc}, ${configure.cxx}, ${configure.f77}, etc., which MacPorts automatically sets as environment variables during the configure phase.
    356 If the software in question doesn't use the configure phase, and you therefore need to pass these variables to the build phase, you must do so in a pre-build block;
    357 if you try to do so directly in the portfile body, you'll pick up the original values, before the variant changed them.
     340variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 description {Compile with gcc 4.8} {
     341    configure.compiler macports-gcc-4.8
     342    depends_lib-append port:gcc48
     343}
     344
     345if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] &&
     346    ![variant_isset gcc46] && ![variant_isset gcc48]
     347} then {
     348    default_variants +gcc47
     349}
     350}}}
     351
     352Note that the variants are all marked as conflicting with one another, and that one is chosen by default if the user has not picked one. Note also that the dependencies are library dependencies because programs compiled using these compilers will generally end up linked to at least one of the compiler's libraries (i.e. `libgcc_s.dylib`, `libgfortran.dylib`, etc.).
     353
     354Setting `configure.compiler` changes the values MacPorts puts in variables like `configure.cc`, `configure.cxx`, `configure.f77`, etc., which MacPorts automatically sets as environment variables during the configure phase. If the software in question doesn't use the configure phase, and you therefore need to pass these variables to the build phase, you must do so in a `pre-build` block; if you try to do so directly in the portfile body, you'll pick up the original values, before the variant changed them.
    358355
    359356{{{