Move MacOS.xcode43_without_clt? into Xcode module
This commit is contained in:
		
							parent
							
								
									bcaa823538
								
							
						
					
					
						commit
						755c786040
					
				| @ -38,6 +38,10 @@ module MacOS::Xcode extend self | |||||||
|     version < latest_version |     version < latest_version | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def without_clt? | ||||||
|  |     version >= "4.3" and not MacOS::CLT.installed? | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|   def prefix |   def prefix | ||||||
|     @prefix ||= begin |     @prefix ||= begin | ||||||
|       path = Pathname.new(folder) |       path = Pathname.new(folder) | ||||||
|  | |||||||
| @ -11,18 +11,12 @@ require 'macos' | |||||||
| # 7) Simpler formula that *just work* | # 7) Simpler formula that *just work* | ||||||
| # 8) Build-system agnostic configuration of the tool-chain | # 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 | def superbin | ||||||
|   @bin ||= (HOMEBREW_REPOSITORY/"Library/ENV").children.reject{|d| d.basename.to_s > MacOS::Xcode.version }.max |   @bin ||= (HOMEBREW_REPOSITORY/"Library/ENV").children.reject{|d| d.basename.to_s > MacOS::Xcode.version }.max | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| def superenv? | 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 unless superbin && superbin.directory? | ||||||
|   return false if ARGV.include? "--env=std" |   return false if ARGV.include? "--env=std" | ||||||
|   true |   true | ||||||
| @ -59,7 +53,7 @@ class << ENV | |||||||
|     ENV['HOMEBREW_CC'] = determine_cc |     ENV['HOMEBREW_CC'] = determine_cc | ||||||
|     ENV['HOMEBREW_CCCFG'] = determine_cccfg |     ENV['HOMEBREW_CCCFG'] = determine_cccfg | ||||||
|     ENV['HOMEBREW_BREW_FILE'] = HOMEBREW_BREW_FILE |     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['HOMEBREW_DEVELOPER_DIR'] = determine_developer_dir # used by our xcrun shim | ||||||
|     ENV['CMAKE_PREFIX_PATH'] = determine_cmake_prefix_path |     ENV['CMAKE_PREFIX_PATH'] = determine_cmake_prefix_path | ||||||
|     ENV['CMAKE_FRAMEWORK_PATH'] = determine_cmake_frameworks_path |     ENV['CMAKE_FRAMEWORK_PATH'] = determine_cmake_frameworks_path | ||||||
| @ -151,7 +145,7 @@ class << ENV | |||||||
| 
 | 
 | ||||||
|   def determine_path |   def determine_path | ||||||
|     paths = [superbin] |     paths = [superbin] | ||||||
|     if MacOS.xcode43_without_clt? |     if MacOS::Xcode.without_clt? | ||||||
|       paths << "#{MacOS::Xcode.prefix}/usr/bin" |       paths << "#{MacOS::Xcode.prefix}/usr/bin" | ||||||
|       paths << "#{MacOS::Xcode.prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin" |       paths << "#{MacOS::Xcode.prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin" | ||||||
|     end |     end | ||||||
| @ -176,32 +170,30 @@ class << ENV | |||||||
|   def determine_cmake_prefix_path |   def determine_cmake_prefix_path | ||||||
|     paths = keg_only_deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}" } |     paths = keg_only_deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}" } | ||||||
|     paths << HOMEBREW_PREFIX.to_s # put ourselves ahead of everything else |     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 |     paths.to_path_s | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def determine_cmake_frameworks_path |   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!! |     # 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 = 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 |     paths.to_path_s | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def determine_cmake_include_path |   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 = [] | ||||||
|     paths << "#{MacOS::X11.include}/freetype2" if x11? |     paths << "#{MacOS::X11.include}/freetype2" if x11? | ||||||
|     paths << "#{sdk}/usr/include/libxml2" unless deps.include? 'libxml2' |     paths << "#{sdk}/usr/include/libxml2" unless deps.include? 'libxml2' | ||||||
|     if MacOS.xcode43_without_clt? |     paths << "#{sdk}/usr/include/apache2" if MacOS::Xcode.without_clt? | ||||||
|       paths << "#{sdk}/usr/include/apache2" |  | ||||||
|     end |  | ||||||
|     paths << "#{sdk}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/" unless x11? |     paths << "#{sdk}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/" unless x11? | ||||||
|     paths << MacOS::X11.include if x11? |     paths << MacOS::X11.include if x11? | ||||||
|     paths.to_path_s |     paths.to_path_s | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def determine_cmake_library_path |   def determine_cmake_library_path | ||||||
|     sdk = MacOS.sdk_path if MacOS.xcode43_without_clt? |     sdk = MacOS.sdk_path if MacOS::Xcode.without_clt? | ||||||
|     paths = [] |     paths = [] | ||||||
|     # things expect to find GL headers since X11 used to be a default, so we add them |     # 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? |     paths << "#{sdk}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries" unless x11? | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jack Nagel
						Jack Nagel