diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 3a39566070..1dd6da4b35 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -64,7 +64,7 @@ module Homebrew def fetch_bottle?(f) return true if ARGV.force_bottle? && f.bottle return false unless f.bottle && f.pour_bottle? - return false if ARGV.build_from_source? || ARGV.build_bottle? + return false if ARGV.build_formula_from_source?(f) return false unless f.bottle.compatible_cellar? true end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 22be53ad01..d41ef66d45 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -24,8 +24,13 @@ #: `gcc-4.2` for Apple's GCC 4.2, or `gcc-4.9` for a Homebrew-provided GCC #: 4.9. #: -#: If `--build-from-source` is passed, compile from source even if a bottle -#: is provided for . +#: If `--build-from-source` or `-s` is passed, compile the specified from +#: source even if a bottle is provided. Dependencies will still be installed +#: from bottles if they are available. +#: +#: If `HOMEBREW_BUILD_FROM_SOURCE` is set, regardless of whether `--build-from-source` was +#: passed, then both and the dependencies installed as part of this process +#: are built from source even if bottles are available. #: #: If `--force-bottle` is passed, install from a bottle if it exists #: for the current version of OS X, even if custom options are given. @@ -259,7 +264,7 @@ module Homebrew fi.ignore_deps = ARGV.ignore_deps? fi.only_deps = ARGV.only_deps? fi.build_bottle = ARGV.build_bottle? - fi.build_from_source = ARGV.build_from_source? + fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? fi.force_bottle = ARGV.force_bottle? fi.interactive = ARGV.interactive? fi.git = ARGV.git? diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 8cf81fb619..4a23c00ec6 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -26,7 +26,7 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = options fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && tab.build_bottle?) - fi.build_from_source = ARGV.build_from_source? + fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? fi.force_bottle = ARGV.force_bottle? fi.interactive = ARGV.interactive? fi.git = ARGV.git? diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 2f8407feb2..c296e77577 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -71,7 +71,7 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = tab.used_options fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && tab.build_bottle?) - fi.build_from_source = ARGV.build_from_source? + fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? fi.verbose = ARGV.verbose? fi.quieter = ARGV.quieter? fi.debug = ARGV.debug? diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index eec2172a2b..bb26d453fb 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -185,7 +185,19 @@ module HomebrewArgvExtension end def build_from_source? - switch?("s") || include?("--build-from-source") || !!ENV["HOMEBREW_BUILD_FROM_SOURCE"] + switch?("s") || include?("--build-from-source") + end + + def build_all_from_source? + !!ENV["HOMEBREW_BUILD_FROM_SOURCE"] + end + + # Whether a given formula should be built from source during the current + # installation run. + def build_formula_from_source?(f) + return true if build_all_from_source? + return false unless (build_from_source? || build_bottle?) + formulae.any? { |argv_f| argv_f.full_name == f.full_name } end def flag?(flag) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index afeb3ec27a..a25a78f444 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -794,6 +794,8 @@ class Formula opt_prefix+"Frameworks" end + # Indicates that this formula supports bottles. (Not necessarily that one + # should be used in the current installation run.) # Can be overridden to selectively disable bottles from formulae. # Defaults to true so overridden version does not have to check if bottles # are supported. diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 4de4a79dc7..4b8dcf202e 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -428,7 +428,7 @@ class FormulaInstaller fi.options |= tab.used_options fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options) fi.options |= inherited_options - fi.build_from_source = build_from_source? + fi.build_from_source = ARGV.build_formula_from_source?(df) fi.verbose = verbose? && !quieter? fi.debug = debug? fi.prelude diff --git a/share/doc/homebrew/brew.1.html b/share/doc/homebrew/brew.1.html index daf613eb3d..ca2230308b 100644 --- a/share/doc/homebrew/brew.1.html +++ b/share/doc/homebrew/brew.1.html @@ -145,7 +145,7 @@ For tarballs, also print SHA-256 checksums.

If --HEAD or --devel is passed, fetch that version instead of the stable version.

-

If -v is passed, do a verbose VCS checkout, if the URL represents a CVS. +

If -v is passed, do a verbose VCS checkout, if the URL represents a VCS. This is useful for seeing if an existing VCS cache has been updated.

If --force is passed, remove a previously cached version and re-fetch.

@@ -196,8 +196,13 @@ options but do not install the specified formula.

gcc-4.2 for Apple's GCC 4.2, or gcc-4.9 for a Homebrew-provided GCC 4.9.

-

If --build-from-source is passed, compile from source even if a bottle -is provided for formula.

+

If --build-from-source or -s is passed, compile the specified formula from +source even if a bottle is provided. Dependencies will still be installed +from bottles if they are available.

+ +

If HOMEBREW_BUILD_FROM_SOURCE is set, regardless of whether --build-from-source was +passed, then both formula and the dependencies installed as part of this process +are built from source even if bottles are available.

If --force-bottle is passed, install from a bottle if it exists for the current version of OS X, even if custom options are given.

diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index acadd5de28..201e45a7de 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -196,7 +196,7 @@ Download the source packages for the given \fIformulae\fR\. For tarballs, also p If \fB\-\-HEAD\fR or \fB\-\-devel\fR is passed, fetch that version instead of the stable version\. . .IP -If \fB\-v\fR is passed, do a verbose VCS checkout, if the URL represents a CVS\. This is useful for seeing if an existing VCS cache has been updated\. +If \fB\-v\fR is passed, do a verbose VCS checkout, if the URL represents a VCS\. This is useful for seeing if an existing VCS cache has been updated\. . .IP If \fB\-\-force\fR is passed, remove a previously cached version and re\-fetch\. @@ -265,7 +265,10 @@ If \fB\-\-only\-dependencies\fR is passed, install the dependencies with specifi If \fB\-\-cc=\fR\fIcompiler\fR is passed, attempt to compile using \fIcompiler\fR\. \fIcompiler\fR should be the name of the compiler\'s executable, for instance \fBgcc\-4\.2\fR for Apple\'s GCC 4\.2, or \fBgcc\-4\.9\fR for a Homebrew\-provided GCC 4\.9\. . .IP -If \fB\-\-build\-from\-source\fR is passed, compile from source even if a bottle is provided for \fIformula\fR\. +If \fB\-\-build\-from\-source\fR or \fB\-s\fR is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. +. +.IP +If HOMEBREW_BUILD_FROM_SOURCE is set, regardless of whether \fB\-\-build\-from\-source\fR was passed, then both \fIformula\fR and the dependencies installed as part of this process are built from source even if bottles are available\. . .IP If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current version of OS X, even if custom options are given\.