diff options
Diffstat (limited to 'Library/Homebrew/software_spec.rb')
| -rw-r--r-- | Library/Homebrew/software_spec.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 97a97969c..fcede796c 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -2,6 +2,7 @@ require 'forwardable' require 'resource' require 'checksum' require 'version' +require 'options' require 'build_options' require 'dependency_collector' require 'bottles' @@ -11,7 +12,7 @@ class SoftwareSpec extend Forwardable attr_reader :name, :owner - attr_reader :build, :resources, :patches + attr_reader :build, :resources, :patches, :options attr_reader :dependency_collector attr_reader :bottle_specification @@ -23,10 +24,11 @@ class SoftwareSpec def initialize @resource = Resource.new @resources = {} - @build = BuildOptions.new(ARGV.options_only) @dependency_collector = DependencyCollector.new @bottle_specification = BottleSpecification.new @patches = [] + @options = Options.new + @build = BuildOptions.new(ARGV.options_only, options) end def owner= owner @@ -79,7 +81,7 @@ class SoftwareSpec def depends_on spec dep = dependency_collector.add(spec) - build.add_dep_option(dep) if dep + add_dep_option(dep) if dep end def deps @@ -99,6 +101,16 @@ class SoftwareSpec list.each { |p| p.owner = self } patches.concat(list) end + + def add_dep_option(dep) + name = dep.option_name + + if dep.optional? && !options.include?("with-#{name}") + options << Option.new("with-#{name}", "Build with #{name} support") + elsif dep.recommended? && !options.include?("without-#{name}") + options << Option.new("without-#{name}", "Build without #{name} support") + end + end end class HeadSoftwareSpec < SoftwareSpec |
