Changes between Version 38 and Version 39 of PortfileRecipes
- Timestamp:
- May 23, 2012, 12:17:15 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PortfileRecipes
v38 v39 298 298 In these cases you can use `configure.compiler` to specify an alternate compiler, for example one provided by a MacPorts gcc port. 299 299 More commonly, a port specifies such a compiler because it needs gcj or gfortran, which Apple does not provide any version of at all. 300 301 On the one hand, such ports should prefer to use the newest suitable stable version of gcc they can. 302 On the other hand, a user may already have an older gcc port installed and may not want to spend the time to compile a newer one right now, or may have other reasons for preferring a particular version of gcc. 300 Another reason to want compiler variants is if the software installs a library, or uses a library built with a different gcc. 301 Subtle and difficult-to-find errors can occur if a library and the program using it are not both compiled with the same compiler. 302 303 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. 304 On the other hand, a user may want to use a different gcc version. 303 305 Therefore, ports that need to use a gcc port, but aren't picky about exactly which one, are encouraged to offer variants: 304 306 305 307 {{{ 306 variant gcc43 conflicts gcc44 gcc45 description {Compile with gcc 4.3} {308 variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 description {Compile with gcc 4.3} { 307 309 configure.compiler macports-gcc-4.3 308 310 depends_lib-append port:gcc43 309 311 } 310 312 311 variant gcc44 conflicts gcc43 gcc45 description {Compile with gcc 4.4} {313 variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 description {Compile with gcc 4.4} { 312 314 configure.compiler macports-gcc-4.4 313 315 depends_lib-append port:gcc44 314 316 } 315 317 316 variant gcc45 conflicts gcc43 gcc44 description {Compile with gcc 4.5} {318 variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 description {Compile with gcc 4.5} { 317 319 configure.compiler macports-gcc-4.5 318 320 depends_lib-append port:gcc45 319 321 } 320 322 321 if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45]} { 323 variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 description {Compile with gcc 4.6} { 324 configure.compiler macports-gcc-4.6 325 depends_lib-append port:gcc46 326 } 327 328 variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 description {Compile with gcc 4.7} { 329 configure.compiler macports-gcc-4.7 330 depends_lib-append port:gcc47 331 } 332 333 if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47]} { 322 334 default_variants +gcc45 323 335 } 324 336 }}} 325 337 326 Note that the variants are all marked as conflicting with one another, and that the newestone is chosen by default if the user has not picked one.338 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. 327 339 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.). 328 340 … … 337 349 } 338 350 }}} 339 340 Another reason to want compiler variants is if the software installs a library, or uses a library built with a different gcc.341 Subtle and difficult-to-find errors can occur if a library and the program using it are not both compiled with the same compiler.342 343 351 344 352