If this was set at build-time (i.e. by the Ruby 1.8.7 buildsystem) then
`cc` could be passed arguments and fail to run.
ClosesHomebrew/homebrew#45890.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Removing all sysroot flags is ok until a non-OS X SDK is needed. In
that case, builds can fail due to the non-OS X SDK being overwritten or
overridden by the OS X SDK.
Sysroot flags are now only stripped if they are an OS X SDK. This is
reliant on only OS X SDKs containing the string "macosx", so this will
break if if the wrong SDK shows up. However, the chances of that
happening seem low, as Apple probably doesn't want to introduce
something OS X that doesn't work with OS X, so it should be robust for
the near future.
This could break in an environment without the command line tools. The
fix for that is a bit more involved, though, so that will have to go
later.
ClosesHomebrew/homebrew#44312.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This flag was supported in gcc-4.0, but not later GCCs or clang.
It pops up in older python-configs, and may also come up in other
contexts.
Fixesmistydemeo/tigerbrew#213.
I found the dual use of CMAKE_*_PATH variables to make it difficult to
reason about this code. Now a separate set of variables are used to
communicate with the cc wrapper, and less work is performed in the
wrapper itself.
We no longer pass the SDK include path as a -isystem directory on
Xcode-only setups. Doing so is redundant with `--sysroot` and has other
side effects, namely changing the include path search order, which can
break compilation of some software (e.g. qemu).
On Xcode-only 10.9, we can additionally omit `--sysroot`, as the correct
paths are built into the tools.
A new variable, HOMEBREW_SYSROOT, is used to this information to the
wrapper. It will be unset on Xcode-only 10.9. HOMEBREW_SDKROOT will
continue to be set, as it is used for other things besides setting the
include search path.
When the cc wrapper is in cxxld mode, -stdlib= is added by both cxxflags
and ldflags, but they are never used separately, so this results in
duplicate flags.