18 Commits

Author SHA1 Message Date
Jack Nagel
dd331245ab Remove unused accessor 2014-07-30 20:19:43 -05:00
Jack Nagel
938110961d Use Dependency#option_name in BuildOptions#add_dep_option 2014-02-28 11:16:55 -06:00
Jack Nagel
08055e1776 Ensure option names are consistent for default formula requirements 2013-12-09 14:36:10 -06:00
Jack Nagel
55e9908799 Fix typo 2013-12-05 22:17:56 -06:00
Jack Nagel
b2b0f711b1 Only coerce to Option when needed
Fixes Homebrew/homebrew#24833.
2013-12-05 22:17:01 -06:00
Xiyue Deng
f2132c47bd C++11 support.
* Add options and ENV method to specify building in C++11 mode.
  - Set C++ compiler flags to enable C++11 mode.
  - To add options to support C++11 mode, a formula can now use

      option :cxx11

    to provide "--c++11" option, and detect and enable C++11 support in
    install method using

      ENV.cxx11 if build.cxx11?

Closes Homebrew/homebrew#22453.
2013-10-26 22:17:04 -07:00
Mike McQuaid
8ec2d4594e BuildOptions: detect if building a bottle. 2013-10-08 10:13:03 +01:00
Jack Nagel
7531dfc219 Allow explicitly requiring universal deps
Previously, instructing Homebrew that all dependencies should be built
universal could be accomplished by redefining BuildOptions#universal? in
the class body:

  def build.universal?
    true
  end

However, the build object is no longer shared by all specs, so this is
insufficient. Instead, a new DSL method, "require_universal_deps", can
be used.

This feature is almost exclusively for wine, which requires universal
deps but does not itself have a universal option, since it is always
built 32-bit.
2013-09-21 19:27:24 -05:00
Jack Nagel
71b21c920f Copies of BuildOptions should not share underlying collections 2013-09-14 17:03:56 -05:00
Jack Nagel
a871baadf5 Fix breakage in option recognition
Fixes Homebrew/homebrew#22347.
2013-09-05 18:51:27 -05:00
Samuel John
59a0c1e1b5 Improve python tests for brew bots
Allow `build.with?` and similar methods to be used during the test
phase. The BuildOptions (`build`) are initialized with the
`Tab.used_options` unless explicitly overwritten on the command line.

So basically `build.with?` works in `def install` and in `test do` as
one would naively expect. (For the test, gramatically it should be
`built.with?` but who cares)

If a formula was installed `--with-python`, now the tests are also
run `--with-python`. This enables us to use the `python do ... end` in
a meaningful manner.

Using `python do ... end` blocks for the tests, because the bot.brew.sh has
system python per default and we need to set the PYTHONPATH for the test.
Potentially to different values for Python 2.x and 3.x.
2013-09-05 15:26:57 +02:00
Jack Nagel
0c75f2d280 Push dependency option generation into BuildOptions 2013-08-31 16:16:54 -05:00
Adam Vandenberg
a90ec1ae80 fix comment typo 2013-07-09 09:06:12 -07:00
Samuel John
c524895666 Python 2.x and 3.x support
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.

To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.

The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:

python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.

Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.

python do
  system python, 'setup.py', "--prefix=#{prefix}"
end

Read more in the Homebrew wiki.
2013-06-03 17:29:43 +02:00
Jack Nagel
cf08b71bf8 FormulaInstaller: construct new ARGV from an Options collection
The array of options that is passed to the spawned build process is a
combination of the current ARGV, options passed in by a dependent
formula, and an existing install receipt. The objects that are
interacting here each expect the resulting collection to have certain
properties, and the expectations are not consistent.

Clear up this confusing mess by only dealing with Options collections.
This keeps our representation of options uniform across the codebase.

We can remove BuildOptions dependency on HomebrewArgvExtension, which
allows us to pass any Array-like collection to Tab.create. The only
other site inside of FormulaInstaller that uses the array is the #exec
call, and there it is splatted and thus we can substitute our Options
collection there as well.
2013-01-26 12:14:47 -06:00
Jack Nagel
046d802d09 FormulaInstaller: allow formulae to pass options to deps
Formulae can now pass build options to dependencies. The following
syntax is supported:

  depends_on 'foo' => 'with-bar'
  depends_on 'foo' => ['with-bar', 'with-baz']

If a dependency is already installed but lacks the required build
options, an exception is raised. Eventually we may be able to just stash
the existing keg and reinstall it with the combined set of used_options
and passed options, but enabling that is left for another day.
2013-01-26 12:14:46 -06:00
Adam Vandenberg
6193167f58 Add support for optional and recommended deps
Optional deps are not installed by default but generate a corresponding
"with-foo" option for the formula. Recommended deps _are_ installed by
default, and generate a corresponding "without-foo" option.
2013-01-26 12:14:45 -06:00
Jack Nagel
5088fdd543 Move BuildOptions to a separate file 2013-01-26 11:37:02 -06:00