MacOS module cleanups

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
MacOS: avoid checking clt_version in clt_installed?

Checking "not clt_version.empty?" is unnecessary if we are also checking
that dev_tools_path is /usr/bin.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Split Xcode and CLT methods into separate modules

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Move Xcode and CLT modules to a new file

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Add MacOS::Xcode.provides_autotools?

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Use new Xcode module

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Add MacOS::Xcode.provides_gcc?

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Rename xctools_fucked?

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Fix brew doctor warnings and spurious newline.

Fixes the problems discussed in 34c970 to ensure that `brew doctor`
does not look like it is broken on user setup problems but still
returns a sensible exit code for e.g. BrewBot.
Revamp fish completion

The fish completion hadn't been updated since 2009; this brings it up
to date. Changes include:

* Create the list of commands the same way as in bash completion
* Add every option for every current command, with descriptions
* Fixes a bug in fish_complete_brew_command
* Allow fish_complete_brew_command to take multiple commands
* Expand functionality of fish_complete_homebrew_formula to support
  other commands and taps, and change name to reflect new functionality

Tested on fishfish, but should be compatible with fish.
Further improve brew doctor issue wiki text.

Following feedback from @mxcl on bcda0d.
Un-break MacOS.sdk_path

MacOS.sdk_path is meant to return the SDK path that matches the version
argument, so store the result in a hash.

Fixes #13623.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Requirement: add modify_build_environment method

Rather than doing type introspection in build.rb, just define a method
to perform the necessary environment setup for Requirements.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Deduplicate requirements

Because of some quirks in how formulae are loaded, DSL methods invoked
in the class definition are called multiple times. This results in, for
example, duplicate dependencies and requirements.

Code that iterates over requirements and takes some action for each can
thus repeat things that shouldn't be repeated, like appending to
environment variables.

Make DependencyCollector's external_deps a Set, and define eql? and hash
on Requirement to prevent these duplicates.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
dependencies.rb: Add MPI compiler Requirement

All versions of OS X prior to Lion shipped with some version of Open-MPI, but
without working compiler wrappers for Fortran. Homebrew currently has two
formulae that can supply this software: open-mpi and mpich2.

This commit adds a `MPIDependency` Requirement that can be passed one of four
values when constructed:

    :cc, :cxx, :f90, :f77

This will ensure the `mpi<value>` compiler is available and working. For
example, if `depends_on MPIDependency.new(:cc, :f90)` is used, the Requirement
will search for working `mpicc` and `mpif90` wrappers.

If the required wrappers cannot be found, an error message will be displayed
that prompts the user to install one of the Homebrew formulae that provides
MPI.

For each language passed to a MPIDependency Requirement, environment variables
be will set that point to the compilers.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
brew-audit: Warn against depending on MPI

Depending on `open-mpi` or `mpich2` will cause problems since both formulae
install components with the same names. `brew audit` now recommends using
MPIDependency.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>