Changes between Version 7 and Version 8 of UsingTheRightCompiler


Ignore:
Timestamp:
Apr 30, 2010, 2:47:42 AM (14 years ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

refinements

Legend:

Unmodified
Added
Removed
Modified
  • UsingTheRightCompiler

    v7 v8  
    1616or on Tiger to downgrade to gcc 3.3 to compile old software that is not compatible with gcc 4.
    1717
    18 Software by default builds using "`gcc`" and this can be a problem if the user has changed what "`gcc`" is.
     18Software by default builds using "`gcc`" (or, equivalently, "`cc`") and this can be a problem if the user has changed what this is.
    1919On the one hand, gcc 4 may be too new to compile some very old software,
    2020but on the other hand gcc 3.3 is probably too old to compile a lot of modern software.
     
    5151unless that compiler doesn't work with that port for some reason.
    5252In that case,
    53 you can select a different compiler for that port by overwriting ${configure.cc} and friends,
     53the maintainer can select a different compiler for that port by overwriting ${configure.cc} and friends,
    5454but what you probably want to do instead is overwrite the ${configure.compiler} variable,
    55 which sets everything for you as a group.
     55which sets all the related variables for you simultaneously.
    5656MacPorts knows about a handful of compilers:
    5757
     
    7878(e.g. "apple-gcc-4.0" corresponds to the apple-gcc40 port).
    7979The remaining compiler names refer to compilers installed by Xcode
    80 (e.g. "gcc-4.0" is the gcc 4.0.1 compiler installed by Xcode
    81 which is the default compiler on Mac OS X 10.4 and 10.5).
     80(e.g. "gcc-4.0" is the gcc 4.0.1 compiler installed by Xcode).
    8281Note that if you set ${configure.compiler} to a compiler provided by a MacPorts port,
    83 you must also declare a build dependency on that port.
     82you must also declare a library dependency on that port.
    8483
    8584For the MacPorts gcc 4 compilers,
     
    10099Setting the CC, CXX and CPP environment variables at configure time
    101100is all that most software needs in order to use the compiler we want.
    102 But some ports have unusual configure scripts that don't obey these settings.
    103 Some ports don't have a configure phase at all.
     101But some ports have unusual configure scripts that don't obey these settings,
     102and some ports don't have a configure script at all.
    104103For such ports, it can be necessary to set the variables at build time:
    105104
    106105{{{
    107 build.env-append        CC=${configure.cc} \
     106build.args-append       CC=${configure.cc} \
    108107                        CXX=${configure.cxx} \
    109108                        CPP=${configure.cpp}
     
    113112In these cases, patches are needed.
    114113For example, "`gcc`" or "`cc`" can be replaced with "$(CC)" in the Makefile,
    115 possibly in combination with setting ${build.env} as above.
     114possibly in combination with setting ${build.args} as above.
    116115Such patches should usually be sent upstream for inclusion in the next version of the software.
    117116