Move MacOS.xcode43_without_clt? into Xcode module

This commit is contained in:
Jack Nagel 2013-08-09 20:47:28 -05:00
parent bcaa823538
commit 755c786040
2 changed files with 12 additions and 16 deletions

View File

@ -38,6 +38,10 @@ module MacOS::Xcode extend self
version < latest_version
end
def without_clt?
version >= "4.3" and not MacOS::CLT.installed?
end
def prefix
@prefix ||= begin
path = Pathname.new(folder)

View File

@ -11,18 +11,12 @@ require 'macos'
# 7) Simpler formula that *just work*
# 8) Build-system agnostic configuration of the tool-chain
module MacOS
def xcode43_without_clt?
MacOS::Xcode.version >= "4.3" and not MacOS::CLT.installed?
end
end
def superbin
@bin ||= (HOMEBREW_REPOSITORY/"Library/ENV").children.reject{|d| d.basename.to_s > MacOS::Xcode.version }.max
end
def superenv?
return false if MacOS.xcode43_without_clt? && MacOS.sdk_path.nil?
return false if MacOS::Xcode.without_clt? && MacOS.sdk_path.nil?
return false unless superbin && superbin.directory?
return false if ARGV.include? "--env=std"
true
@ -59,7 +53,7 @@ class << ENV
ENV['HOMEBREW_CC'] = determine_cc
ENV['HOMEBREW_CCCFG'] = determine_cccfg
ENV['HOMEBREW_BREW_FILE'] = HOMEBREW_BREW_FILE
ENV['HOMEBREW_SDKROOT'] = "#{MacOS.sdk_path}" if MacOS.xcode43_without_clt?
ENV['HOMEBREW_SDKROOT'] = "#{MacOS.sdk_path}" if MacOS::Xcode.without_clt?
ENV['HOMEBREW_DEVELOPER_DIR'] = determine_developer_dir # used by our xcrun shim
ENV['CMAKE_PREFIX_PATH'] = determine_cmake_prefix_path
ENV['CMAKE_FRAMEWORK_PATH'] = determine_cmake_frameworks_path
@ -151,7 +145,7 @@ class << ENV
def determine_path
paths = [superbin]
if MacOS.xcode43_without_clt?
if MacOS::Xcode.without_clt?
paths << "#{MacOS::Xcode.prefix}/usr/bin"
paths << "#{MacOS::Xcode.prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin"
end
@ -176,32 +170,30 @@ class << ENV
def determine_cmake_prefix_path
paths = keg_only_deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}" }
paths << HOMEBREW_PREFIX.to_s # put ourselves ahead of everything else
paths << "#{MacOS.sdk_path}/usr" if MacOS.xcode43_without_clt?
paths << "#{MacOS.sdk_path}/usr" if MacOS::Xcode.without_clt?
paths.to_path_s
end
def determine_cmake_frameworks_path
# XXX: keg_only_deps perhaps? but Qt does not link its Frameworks because of Ruby's Find.find ignoring symlinks!!
paths = deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}/Frameworks" }
paths << "#{MacOS.sdk_path}/System/Library/Frameworks" if MacOS.xcode43_without_clt?
paths << "#{MacOS.sdk_path}/System/Library/Frameworks" if MacOS::Xcode.without_clt?
paths.to_path_s
end
def determine_cmake_include_path
sdk = MacOS.sdk_path if MacOS.xcode43_without_clt?
sdk = MacOS.sdk_path if MacOS::Xcode.without_clt?
paths = []
paths << "#{MacOS::X11.include}/freetype2" if x11?
paths << "#{sdk}/usr/include/libxml2" unless deps.include? 'libxml2'
if MacOS.xcode43_without_clt?
paths << "#{sdk}/usr/include/apache2"
end
paths << "#{sdk}/usr/include/apache2" if MacOS::Xcode.without_clt?
paths << "#{sdk}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/" unless x11?
paths << MacOS::X11.include if x11?
paths.to_path_s
end
def determine_cmake_library_path
sdk = MacOS.sdk_path if MacOS.xcode43_without_clt?
sdk = MacOS.sdk_path if MacOS::Xcode.without_clt?
paths = []
# things expect to find GL headers since X11 used to be a default, so we add them
paths << "#{sdk}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries" unless x11?