aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/build_options.rb11
-rw-r--r--Library/Homebrew/formula.rb15
-rw-r--r--Library/Homebrew/software_spec.rb14
3 files changed, 19 insertions, 21 deletions
diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb
index 8ea321772..28fbb959c 100644
--- a/Library/Homebrew/build_options.rb
+++ b/Library/Homebrew/build_options.rb
@@ -20,17 +20,6 @@ class BuildOptions
@args = other.args.dup
end
- def add(name, description)
- description ||= case name
- when "universal" then "Build a universal binary"
- when "32-bit" then "Build 32-bit only"
- when "c++11" then "Build using C++11 mode"
- else ""
- end
-
- @options << Option.new(name, description)
- end
-
def empty?
@options.empty?
end
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index ab5b00fa2..dc9b680f2 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -16,7 +16,7 @@ class Formula
include Utils::Inreplace
extend Enumerable
- attr_reader :name, :path, :homepage, :build
+ attr_reader :name, :path, :homepage
attr_reader :stable, :devel, :head, :active_spec
attr_reader :pkg_version, :revision
@@ -38,9 +38,8 @@ class Formula
@active_spec = determine_active_spec(spec)
validate_attributes :url, :name, :version
- @build = determine_build_options
+ active_spec.add_legacy_options(options)
@pkg_version = PkgVersion.new(version, revision)
-
@pin = FormulaPin.new(self)
end
@@ -65,12 +64,6 @@ class Formula
end
end
- def determine_build_options
- build = active_spec.build
- options.each { |opt, desc| build.add(opt, desc) }
- build
- end
-
def bottle
Bottle.new(self, active_spec.bottle_specification) if active_spec.bottled?
end
@@ -110,6 +103,10 @@ class Formula
active_spec.option_defined?(name)
end
+ def build
+ active_spec.build
+ end
+
# if the dir is there, but it's empty we consider it not installed
def installed?
(dir = installed_prefix).directory? && dir.children.length > 0
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index fe0277adb..390f31e17 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -80,7 +80,15 @@ class SoftwareSpec
name = name.to_s if Symbol === name
raise ArgumentError, "option name is required" if name.empty?
raise ArgumentError, "options should not start with dashes" if name.start_with?("-")
- build.add(name, description)
+
+ description ||= case name
+ when "universal" then "Build a universal binary"
+ when "32-bit" then "Build 32-bit only"
+ when "c++11" then "Build using C++11 mode"
+ else ""
+ end
+
+ options << Option.new(name, description)
end
def depends_on spec
@@ -115,6 +123,10 @@ class SoftwareSpec
options << Option.new("without-#{name}", "Build without #{name} support")
end
end
+
+ def add_legacy_options(list)
+ list.each { |opt, desc| options << Option.new(opt[/^--(.+)$/, 1], desc) }
+ end
end
class HeadSoftwareSpec < SoftwareSpec