Forcing compiler

Joshua Root jmr at macports.org
Sat Apr 3 17:28:35 PDT 2010


On 2010-4-4 09:55 , Jeremy Huddleston wrote:
> I need to force gcc-4.2 when building mesa on Leopard, but it doesn't seem to be working:
> 
> DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_Users_jeremy_src_macports-trunk_dports_x11_mesa/work/Mesa-7.8" && /usr/bin/make -j5 default INSTALL_DIR=/opt/local RC_CFLAGS="-arch ppc" CC="/usr/bin/gcc-4.0 -I/opt/local/include" CXX="/usr/bin/g++-4.0 -I/opt/local/include"'
> 
> 
> even though I have:
> 
> platform darwin 9 {
>     # http://trac.macports.org/ticket/24345
>     configure.compiler  apple-gcc-4.2
> }
> 
> build.args-append \
>     CC="${configure.cc} ${configure.cppflags}" \
>     CXX="${configure.cxx} ${configure.cppflags}"
> 
> I also tried
> configure.cc /usr/bin/gcc-4.2
> 
> but it's still using /usr/bin/gcc-4.0 when setting up build.args on Leopard...
> 
> What's wrong here? 

Two things: One, you actually want 'configure.compiler gcc-4.2' (since
apple-gcc-4.2 sets CC=${prefix}/bin/gcc-apple-4.2). Two, variant bodies
are evaluated after the main body of the portfile. You can get around
this by doing the build.args-append in pre-build, or by using "if
{${os.platform} == "darwin" && ${os.major} == 9}" instead of "platform
darwin 9".

- Josh


More information about the macports-dev mailing list