Refactor dependencies in preparation for autotools symbol support
This commit is contained in:
parent
8a0c94d4e0
commit
e9dc02dbb6
@ -28,11 +28,20 @@ class DependencyCollector
|
|||||||
tag = nil
|
tag = nil
|
||||||
spec, tag = spec.shift if spec.is_a? Hash
|
spec, tag = spec.shift if spec.is_a? Hash
|
||||||
|
|
||||||
dep = case spec
|
dep = parse_spec(spec, tag)
|
||||||
when :x11, :libpng
|
# Some symbol specs are conditional, and resolve to nil if there is no
|
||||||
X11Dependency.new(tag)
|
# dependency needed for the current platform.
|
||||||
|
return if dep.nil?
|
||||||
|
# Add dep to the correct bucket
|
||||||
|
(dep.is_a?(Requirement) ? @external_deps : @deps) << dep
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def parse_spec spec, tag
|
||||||
|
case spec
|
||||||
when Symbol
|
when Symbol
|
||||||
raise "Unsupported special dependency #{spec}"
|
parse_symbol_spec(spec, tag)
|
||||||
when String
|
when String
|
||||||
if LANGUAGE_MODULES.include? tag
|
if LANGUAGE_MODULES.include? tag
|
||||||
LanguageModuleDependency.new(tag, spec)
|
LanguageModuleDependency.new(tag, spec)
|
||||||
@ -46,8 +55,15 @@ class DependencyCollector
|
|||||||
else
|
else
|
||||||
raise "Unsupported type #{spec.class} for #{spec}"
|
raise "Unsupported type #{spec.class} for #{spec}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
(dep.is_a?(Requirement) ? @external_deps : @deps) << dep
|
def parse_symbol_spec spec, tag
|
||||||
|
case spec
|
||||||
|
when :x11, :libpng
|
||||||
|
X11Dependency.new(tag)
|
||||||
|
else
|
||||||
|
raise "Unsupported special dependency #{spec}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user