aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/build_options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/build_options.rb')
-rw-r--r--Library/Homebrew/build_options.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb
index 24c49931f..077a8b3d8 100644
--- a/Library/Homebrew/build_options.rb
+++ b/Library/Homebrew/build_options.rb
@@ -85,4 +85,19 @@ class BuildOptions
def unused_options
Options.new(@options - @args)
end
+
+ # Some options are implicitly ON because they are not explictly turned off
+ # by their counterpart option. This applies only to with-/without- options.
+ # implicit_options are needed because `depends_on 'spam' => 'with-stuff'`
+ # complains if 'spam' has stuff as default and only defines `--without-stuff`.
+ def implicit_options
+ implicit = unused_options.map do |o|
+ if o.name =~ /^with-(.+)$/ && without?($1)
+ Option.new("without-#{$1}") # we loose the description, but that's ok
+ elsif o.name =~ /^without-(.+)$/ && with?($1)
+ Option.new("with-#{$1}")
+ end
+ end.compact
+ Options.new(implicit)
+ end
end