diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index eb0677a597..7db2235ed5 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -81,7 +81,7 @@ class Build def expand_reqs f.recursive_requirements do |dependent, req| - if (req.optional? || req.recommended?) && dependent.build.without?(req.name) + if (req.optional? || req.recommended?) && dependent.build.without?(req) Requirement.prune elsif req.build? && dependent != f Requirement.prune @@ -94,7 +94,7 @@ class Build def expand_deps f.recursive_dependencies do |dependent, dep| - if (dep.optional? || dep.recommended?) && dependent.build.without?(dep.name) + if (dep.optional? || dep.recommended?) && dependent.build.without?(dep) Dependency.prune elsif dep.build? && dependent != f Dependency.prune diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index f352957582..1c410bf6fe 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -61,7 +61,13 @@ class BuildOptions args.include? '--' + name end - def with? name + def with? val + if val.respond_to?(:option_name) + name = val.option_name + else + name = val + end + if has_option? "with-#{name}" include? "with-#{name}" elsif has_option? "without-#{name}" diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index f492b9a6e5..e2a810cfe6 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -5,10 +5,10 @@ class Dependency include Dependable attr_reader :name, :tags - attr_accessor :env_proc + attr_accessor :env_proc, :option_name def initialize(name, tags=[]) - @name = name + @name = @option_name = name @tags = tags end @@ -97,7 +97,7 @@ class Dependency if block_given? yield dependent, dep elsif dep.optional? || dep.recommended? - prune unless dependent.build.with?(dep.name) + prune unless dependent.build.with?(dep) end end end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index b838f2d54d..1baa93c1e0 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -180,7 +180,7 @@ class FormulaInstaller def check_requirements unsatisfied = ARGV.filter_for_dependencies do f.recursive_requirements do |dependent, req| - if (req.optional? || req.recommended?) && dependent.build.without?(req.name) + if (req.optional? || req.recommended?) && dependent.build.without?(req) Requirement.prune elsif req.build? && install_bottle?(dependent) Requirement.prune @@ -208,7 +208,7 @@ class FormulaInstaller Dependency.expand(f, deps) do |dependent, dep| dep.universal! if f.build.universal? && !dep.build? - if (dep.optional? || dep.recommended?) && dependent.build.without?(dep.name) + if (dep.optional? || dep.recommended?) && dependent.build.without?(dep) Dependency.prune elsif dep.build? && dependent == f && pour_bottle Dependency.prune diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 58b8e57e47..9062d2d13a 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -10,12 +10,13 @@ class Requirement include Dependable extend BuildEnvironmentDSL - attr_reader :tags, :name + attr_reader :tags, :name, :option_name def initialize(tags=[]) @tags = tags @tags << :build if self.class.build @name ||= infer_name + @option_name = @name end # The message to show when the requirement is not met. @@ -70,6 +71,7 @@ class Requirement f = self.class.default_formula raise "No default formula defined for #{inspect}" if f.nil? dep = Dependency.new(f, tags) + dep.option_name = name dep.env_proc = method(:modify_build_environment) dep end @@ -174,7 +176,7 @@ class Requirement if block_given? yield dependent, req elsif req.optional? || req.recommended? - prune unless dependent.build.with?(req.name) + prune unless dependent.build.with?(req) end end end