Avoid throwing unnecessary exceptions by checking for paths existing and
creating formulae as late as possible. Additionally use instance
variables for some caching.
In this case we need to handle the throwing on an exception when
attempting to initialize the gcc48 Formula object.
This initialization should be unnecessary if the core GCC is already
installed and rescued if not.
It is activated by the same mechanism as the Homebrew/versions compilers
which now check if the GCC formula uses the same, correct version.
References Homebrew/homebrew#28418.
If @compiler isn't set/checked by ENV.compiler and the ENV.clang/etc.
methods, ENV.compiler may return unexpected results after fails_with
picks a fallback compiler.
See Homebrew/homebrew#22674.
This moves the CompilerSelector fails_with logic into the build
environment setup, making the compiler selection available before
performing actions that depends on knowing what the compiler is, e.g.
setting up PATH.
ENV.setup_build_environment now optionally takes a Formula argument
to provide the information necessary to do the fails_with, and the new
ENV.validate_cc! extracts the fails_with logic from Build.install.
ENV.compiler is called outside setting up the build environment, where
values unsupported for user input might have been specified - for
example, GNU GCC executables.
This unifies the logic for selecting a compiler between superenv and
stdenv. A variation of superenv's `determine_cc`, which now returns a
symbol, has been moved into the shared ENV extension. Stdenv uses the
result of this directly (as it's always used symbols), while superenv
translates that back into a compiler string.
This also has the effect of disabling HOMEBREW_USE_(gcc|llvm|clang) in
stdenv, which have already been marked as deprecated for some time, and
enables the HOMEBREW_CC= environment variable syntax from superenv in
stdenv.
On Unix, the path separator is ':', whereas on Windows,
it is ';'. This is the first of a series of patch to bring
macbrew's and winbrew's codebases closer together.
The main places the magic constant ':' was being used were:
- the $PATH environment variable
- CMAKE-related environment variables
- pkg-config related environment variables
ClosesHomebrew/homebrew#21921.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>