From 71055aa073dc7583f0f4b6267f0663088d8f28d1 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 1 May 2014 18:36:46 -0500 Subject: [PATCH] Move xctoolchain_path to Xcode module, where it belongs --- Library/Homebrew/extend/ENV/std.rb | 4 +--- Library/Homebrew/extend/ENV/super.rb | 2 +- Library/Homebrew/os/mac.rb | 10 ---------- Library/Homebrew/os/mac/xcode.rb | 4 ++++ 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index fb2741b53f..663be4ff01 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -71,9 +71,7 @@ module Stdenv macosxsdk MacOS.version if MacOS::Xcode.without_clt? - # Some tools (clang, etc.) are in the xctoolchain dir of Xcode - append_path 'PATH', "#{MacOS.xctoolchain_path}/usr/bin" if MacOS.xctoolchain_path - # Others are now at /Applications/Xcode.app/Contents/Developer/usr/bin + append_path "PATH", "#{MacOS::Xcode.toolchain_path}/usr/bin" append_path 'PATH', MacOS.dev_tools_path end end diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 940cc36d2a..76d26836b4 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -117,7 +117,7 @@ module Superenv paths = [Superenv.bin] if MacOS::Xcode.without_clt? paths << "#{MacOS::Xcode.prefix}/usr/bin" - paths << "#{MacOS::Xcode.prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin" + paths << "#{MacOS::Xcode.toolchain_path}/usr/bin" end paths += deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}/bin" } paths << MacOS::X11.bin if x11? diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 37939264d8..6ed35440d4 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -56,16 +56,6 @@ module OS %w{cc make}.all? { |tool| File.executable? "#{prefix}/usr/bin/#{tool}" } end - def xctoolchain_path - # As of Xcode 4.3, some tools are located in the "xctoolchain" directory - @xctoolchain_path ||= begin - path = Pathname.new("#{Xcode.prefix}/Toolchains/XcodeDefault.xctoolchain") - # If only the CLT are installed, all tools will be under dev_tools_path, - # this path won't exist, and xctoolchain_path will be nil. - path if path.exist? - end - end - def sdk_path(v = version) (@sdk_path ||= {}).fetch(v.to_s) do |key| opts = [] diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 41f8098357..4c79e39659 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -61,6 +61,10 @@ module OS end end + def toolchain_path + Pathname.new("#{prefix}/Toolchains/XcodeDefault.xctoolchain") if installed? && version >= "4.3" + end + # Ask Spotlight where Xcode is. If the user didn't install the # helper tools and installed Xcode in a non-conventional place, this # is our only option. See: http://superuser.com/questions/390757