Remove special X11 proxy deps
This commit is contained in:
parent
44dc21ca5d
commit
8bfcdf0bd8
@ -102,11 +102,9 @@ class DependencyCollector
|
||||
# Xcode no longer provides autotools or some other build tools
|
||||
autotools_dep(spec, tags)
|
||||
when :x11 then X11Dependency.new(spec.to_s, tags)
|
||||
when *X11Dependency::Proxy::PACKAGES
|
||||
x11_dep(spec, tags)
|
||||
when :cairo, :pixman
|
||||
# We no longer use X11 psuedo-deps for cairo or pixman,
|
||||
# so just return a standard formula dependency.
|
||||
when :cairo, :fontconfig, :freetype, :libpng, :pixman
|
||||
# We no longer use X11 proxy deps, but we support the symbols
|
||||
# for backwards compatibility.
|
||||
Dependency.new(spec.to_s, tags)
|
||||
when :xcode then XcodeDependency.new(tags)
|
||||
when :macos then MinimumMacOSRequirement.new(tags)
|
||||
@ -137,14 +135,6 @@ class DependencyCollector
|
||||
end
|
||||
end
|
||||
|
||||
def x11_dep(spec, tags)
|
||||
if MacOS.version >= :mountain_lion
|
||||
Dependency.new(spec.to_s, tags)
|
||||
else
|
||||
X11Dependency::Proxy.for(spec.to_s, tags)
|
||||
end
|
||||
end
|
||||
|
||||
def autotools_dep(spec, tags)
|
||||
return if MacOS::Xcode.provides_autotools?
|
||||
|
||||
|
||||
@ -150,21 +150,6 @@ class Requirement
|
||||
end
|
||||
end
|
||||
|
||||
# We special case handling of X11Dependency and its subclasses to
|
||||
# ensure the correct dependencies are present in the final list.
|
||||
# If an X11Dependency is present after filtering, we eliminate
|
||||
# all X11Dependency::Proxy objects from the list. If there aren't
|
||||
# any X11Dependency objects, then we eliminate all but one of the
|
||||
# proxy objects.
|
||||
proxy = unless reqs.any? { |r| r.instance_of?(X11Dependency) }
|
||||
reqs.find { |r| r.kind_of?(X11Dependency::Proxy) }
|
||||
end
|
||||
|
||||
reqs.reject! do |r|
|
||||
r.kind_of?(X11Dependency::Proxy)
|
||||
end
|
||||
|
||||
reqs << proxy unless proxy.nil?
|
||||
reqs
|
||||
end
|
||||
|
||||
|
||||
@ -39,44 +39,4 @@ class X11Dependency < Requirement
|
||||
min_version <=> other.min_version
|
||||
end
|
||||
end
|
||||
|
||||
# When X11Dependency is subclassed, the new class should
|
||||
# also inherit the information specified in the DSL above.
|
||||
def self.inherited(mod)
|
||||
instance_variables.each do |ivar|
|
||||
mod.instance_variable_set(ivar, instance_variable_get(ivar))
|
||||
end
|
||||
end
|
||||
|
||||
# X11Dependency::Proxy is a base class for the X11 pseudo-deps.
|
||||
# Rather than instantiate it directly, a separate class is built
|
||||
# for each of the packages that we proxy to X11Dependency.
|
||||
class Proxy < self
|
||||
PACKAGES = [:libpng, :freetype, :fontconfig]
|
||||
|
||||
class << self
|
||||
def defines_const?(const)
|
||||
if ::RUBY_VERSION >= "1.9"
|
||||
const_defined?(const, false)
|
||||
else
|
||||
const_defined?(const)
|
||||
end
|
||||
end
|
||||
|
||||
def for(name, tags=[])
|
||||
constant = name.capitalize
|
||||
|
||||
if defines_const?(constant)
|
||||
klass = const_get(constant)
|
||||
else
|
||||
klass = Class.new(self) do
|
||||
def initialize(name, tags) super end
|
||||
end
|
||||
|
||||
const_set(constant, klass)
|
||||
end
|
||||
klass.new(name, tags)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -101,16 +101,6 @@ class DependencyCollectorTests < Test::Unit::TestCase
|
||||
assert_nil @d.build(:libtool)
|
||||
end
|
||||
|
||||
def test_x11_proxy_dep_mountain_lion
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new("10.8"))
|
||||
assert_equal Dependency.new("libpng"), @d.build(:libpng)
|
||||
end
|
||||
|
||||
def test_x11_proxy_dep_lion_or_older
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new("10.7"))
|
||||
assert_equal X11Dependency::Proxy.new(:libpng), @d.build(:libpng)
|
||||
end
|
||||
|
||||
def test_ld64_dep_pre_leopard
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new("10.4"))
|
||||
assert_equal LD64Dependency.new, @d.build(:ld64)
|
||||
|
||||
@ -19,35 +19,6 @@ class X11DependencyTests < Test::Unit::TestCase
|
||||
assert !y.eql?(x)
|
||||
end
|
||||
|
||||
def test_proxy_for
|
||||
x = X11Dependency::Proxy.for("libpng")
|
||||
assert_instance_of X11Dependency::Proxy::Libpng, x
|
||||
assert_kind_of X11Dependency, x
|
||||
end
|
||||
|
||||
def test_proxy_eql_instances_are_eql
|
||||
x = X11Dependency::Proxy.for("libpng")
|
||||
y = X11Dependency::Proxy.for("libpng")
|
||||
assert x.eql?(y)
|
||||
assert y.eql?(x)
|
||||
assert x.hash == y.hash
|
||||
end
|
||||
|
||||
def test_proxy_not_eql_when_hashes_differ
|
||||
x = X11Dependency::Proxy.for("libpng")
|
||||
y = X11Dependency::Proxy.for("fontconfig")
|
||||
assert x.hash != y.hash
|
||||
assert !x.eql?(y)
|
||||
assert !y.eql?(x)
|
||||
end
|
||||
|
||||
def test_x_never_eql_to_proxy_x11_dep
|
||||
x = X11Dependency.new("libpng")
|
||||
p = X11Dependency::Proxy.for("libpng")
|
||||
assert !x.eql?(p)
|
||||
assert !p.eql?(x)
|
||||
end
|
||||
|
||||
def test_x_env
|
||||
x = X11Dependency.new
|
||||
x.stubs(:satisfied?).returns(true)
|
||||
@ -55,20 +26,3 @@ class X11DependencyTests < Test::Unit::TestCase
|
||||
x.modify_build_environment
|
||||
end
|
||||
end
|
||||
|
||||
class X11DepCollectionTests < Test::Unit::TestCase
|
||||
def setup
|
||||
@set = ComparableSet.new
|
||||
end
|
||||
|
||||
def test_x_can_coxist_with_proxy
|
||||
@set << X11Dependency.new << X11Dependency::Proxy.for("libpng")
|
||||
assert_equal 2, @set.count
|
||||
end
|
||||
|
||||
def test_multiple_proxies_can_coexist
|
||||
@set << X11Dependency::Proxy.for("libpng")
|
||||
@set << X11Dependency::Proxy.for("fontconfig")
|
||||
assert_equal 2, @set.count
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user