Add :ld64 dependency
This allows formulae which won't build with Tiger's ld to conditionally request a dependency on the ld64 formula. This modifies the build environment appropriately, and will only be active on Tiger.
This commit is contained in:
parent
aff66c3b86
commit
c9c5e56363
@ -2,6 +2,7 @@ require 'dependency'
|
|||||||
require 'dependencies'
|
require 'dependencies'
|
||||||
require 'requirement'
|
require 'requirement'
|
||||||
require 'requirements'
|
require 'requirements'
|
||||||
|
require 'requirements/ld64_dependency'
|
||||||
require 'set'
|
require 'set'
|
||||||
|
|
||||||
## A dependency is a formula that another formula needs to install.
|
## A dependency is a formula that another formula needs to install.
|
||||||
@ -95,6 +96,8 @@ class DependencyCollector
|
|||||||
when :python then PythonInstalled.new(tags)
|
when :python then PythonInstalled.new(tags)
|
||||||
when :python2 then PythonInstalled.new("2", tags)
|
when :python2 then PythonInstalled.new("2", tags)
|
||||||
when :python3 then PythonInstalled.new("3", tags)
|
when :python3 then PythonInstalled.new("3", tags)
|
||||||
|
# Tiger's ld is too old to properly link some software
|
||||||
|
when :ld64 then LD64Dependency.new if MacOS.version < :leopard
|
||||||
else
|
else
|
||||||
raise "Unsupported special dependency #{spec}"
|
raise "Unsupported special dependency #{spec}"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -375,6 +375,13 @@ module HomebrewEnvExtension
|
|||||||
Hardware.processor_count
|
Hardware.processor_count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ld64 is a newer linker provided for Xcode 2.5
|
||||||
|
def ld64
|
||||||
|
ld64 = Formula.factory('ld64')
|
||||||
|
self['LD'] = ld64.bin/'ld'
|
||||||
|
append "LDFLAGS", "-B#{ld64.bin.to_s+"/"}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class << ENV
|
class << ENV
|
||||||
|
|||||||
11
Library/Homebrew/requirements/ld64_dependency.rb
Normal file
11
Library/Homebrew/requirements/ld64_dependency.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
require 'dependency'
|
||||||
|
|
||||||
|
# This special dependency ensures that the Tigerbrew ld64
|
||||||
|
# formula is used as gcc's ld in place of the old version
|
||||||
|
# that comes with the OS.
|
||||||
|
class LD64Dependency < Dependency
|
||||||
|
def initialize(name='ld64', tags=[:build])
|
||||||
|
@env_proc = proc { ENV.ld64 }
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -111,6 +111,16 @@ class DependencyCollectorTests < Test::Unit::TestCase
|
|||||||
assert_equal X11Dependency::Proxy.new(:libpng), @d.build(:libpng)
|
assert_equal X11Dependency::Proxy.new(:libpng), @d.build(:libpng)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_ld64_dep_pre_leopard
|
||||||
|
MacOS.stubs(:version).returns(MacOS::Version.new(10.4))
|
||||||
|
assert_equal LD64Dependency.new, @d.build(:ld64)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_ld64_dep_leopard_or_newer
|
||||||
|
MacOS.stubs(:version).returns(MacOS::Version.new(10.5))
|
||||||
|
assert_nil @d.build(:ld64)
|
||||||
|
end
|
||||||
|
|
||||||
def test_raises_typeerror_for_unknown_classes
|
def test_raises_typeerror_for_unknown_classes
|
||||||
assert_raises(TypeError) { @d.add(Class.new) }
|
assert_raises(TypeError) { @d.add(Class.new) }
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user