aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2016-01-10 18:17:54 +0000
committerMike McQuaid2016-01-17 20:05:32 +0000
commite7bffe4809908738685208e1a0077473208f0430 (patch)
tree3b79d128f6b6bbfcf83116258a749bec89c5b6a6 /Library/Homebrew
parent04a9b0022d42fea55f3435e461008525a7199a61 (diff)
downloadbrew-e7bffe4809908738685208e1a0077473208f0430.tar.bz2
formula_installed: tweak source build behaviour.
Currently `brew install —build-from-source wget` builds all the dependencies also from source. I can see people wanting to do this when `HOMEBREW_BUILD_FROM_SOURCE` is set by passing it on the command-line is mostly just annoying; it means you have to use `—build-bottle` and deal with the CFLAGS and `post_install` changes if you want to build from source. Tweak `formula_installer` so this behaviour is more intuitive. Closes Homebrew/homebrew#47889. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/fetch.rb12
-rw-r--r--Library/Homebrew/formula_installer.rb9
2 files changed, 16 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb
index fabe268e5..28a6c4211 100644
--- a/Library/Homebrew/cmd/fetch.rb
+++ b/Library/Homebrew/cmd/fetch.rb
@@ -42,9 +42,15 @@ module Homebrew
end
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 unless f.bottle
+ return true if ARGV.force_bottle?
+ return false unless f.pour_bottle?
+ # We want to behave different with `--build-from-source` and
+ # ENV["HOMEBREW_BUILD_FROM_SOURCE"] because the latter implies you want
+ # everything built from source and the prior that you want just the
+ # formulae you've requested built from source.
+ return false if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
+ return false if ARGV.build_bottle?
return false unless f.bottle.compatible_cellar?
true
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 3c0ab181d..af1922150 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -98,8 +98,13 @@ class FormulaInstaller
def install_bottle_for?(dep, build)
return pour_bottle? if dep == formula
- return false if build_from_source?
- return false unless dep.bottle && dep.pour_bottle?
+ # We want to behave different with `--build-from-source` and
+ # ENV["HOMEBREW_BUILD_FROM_SOURCE"] because the latter implies you want
+ # everything built from source and the prior that you want just the
+ # formulae you've requested built from source.
+ return false if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
+ return false unless dep.bottle
+ return false unless dep.pour_bottle?
return false unless build.used_options.empty?
return false unless dep.bottle.compatible_cellar?
true