rust-lang/cargo — pull request #1004 by jmesmon (2014-12-03 06:30:31+00:00)
Title: custom_build: map the CFLAGS and CC variables for HOST builds

If a build.rs script uses gcc-rs, CC and CFLAGS are used to find the
c compiler and flags. Often, host & target will have different flags
and compilers.

Without this mapping (which allows the use of HOST_CC and HOST_CFLAGS),
it was imposible to specify the compiler and cflags to use for the host
while doing cross builds, and gcc-rs would attempt to use the target
compiler and cflags, typically failing.

We preserve the previous behavoir when the HOST_CC and HOST_CFLAGS
variables are unset, though I'm not sure if this is a good idea unless
host happens to equal target. We may want to restrict the fallback in
the future.