aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorSamuel John2013-03-20 18:20:18 +0100
committerSamuel John2013-03-21 17:10:32 +0100
commitc6b0b563e8a5b39c1e1a433446e00c28d15548df (patch)
tree496e167784e8da6d350103b978e8058e57c0efc0 /Library
parent29af53d451e128b690a63bb6774441fe3dd2998b (diff)
downloadbrew-c6b0b563e8a5b39c1e1a433446e00c28d15548df.tar.bz2
Better superenv support for Xcode elsewhere
- The Library/ENV/4.3/xcrun shim now respects ENV['DEVELOPER_DIR'] instead assuming the location of /Applications/Xcode.app/Contents/Developer. - The env var DEVELOPER_DIR is set if it is not already. So, during superenv this var is always set and we no longer have to care about people with unset or wrongly set xcode-select stuff. This has been a major PITA in the past. - determine_developer_dir (which is used to set the DEVELOPER_DIR var) now uses MacOS::Xcode.prefix which is proven and very capable and uses splotlight correctly. - Replace (and remove) MacSystem.xcode43_developer_dir with Xcode.prefix Closes Homebrew/homebrew#18618
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/xcrun4
-rw-r--r--Library/Homebrew/os/mac/xcode.rb2
-rw-r--r--Library/Homebrew/superenv.rb15
-rw-r--r--Library/Homebrew/superenv/macsystem.rb12
4 files changed, 8 insertions, 25 deletions
diff --git a/Library/ENV/4.3/xcrun b/Library/ENV/4.3/xcrun
index 14176a5a7..6afb6cf16 100755
--- a/Library/ENV/4.3/xcrun
+++ b/Library/ENV/4.3/xcrun
@@ -19,8 +19,8 @@ end
arg0 = ARGV.shift
try `/usr/bin/xcrun --find #{arg0}`.chomp
# Nuts, Xcode is not setup properly or something. Try to find the tools anyway!
-try "/Applications/Xcode.app/Contents/Developer/usr/bin/#{arg0}"
-try "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/#{arg0}"
+try "#{ENV['DEVELOPER_DIR']}/usr/bin/#{arg0}"
+try "#{ENV['DEVELOPER_DIR']}/Toolchains/XcodeDefault.xctoolchain/usr/bin/#{arg0}"
try "/usr/bin/#{arg0}"
abort <<-EOS
diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb
index 40bc1e87d..a89faa002 100644
--- a/Library/Homebrew/os/mac/xcode.rb
+++ b/Library/Homebrew/os/mac/xcode.rb
@@ -76,7 +76,7 @@ module MacOS::Xcode extend self
# this shortcut makes version work for people who don't realise you
# need to install the CLI tools
- xcode43build = V4_BUNDLE_PATH/'Contents/Developer/usr/bin/xcodebuild'
+ xcode43build = prefix/'usr/bin/xcodebuild'
if xcode43build.file?
`#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
return $1 if $1
diff --git a/Library/Homebrew/superenv.rb b/Library/Homebrew/superenv.rb
index fb494c10e..0fd597391 100644
--- a/Library/Homebrew/superenv.rb
+++ b/Library/Homebrew/superenv.rb
@@ -18,10 +18,7 @@ end
def superenv?
not (MacSystem.xcode43_without_clt? and
- MacOS.sdk_path.nil?) and # because superenv will fail to find stuff
- not (MacSystem.xcode43_without_clt? and
- !MacSystem.xcode43_developer_dir) and # because superenv's logic might not find it
- not MacOS::Xcode.folder.nil? and # because xcrun won't work
+ MacOS.sdk_path.nil?) and # because superenv will fail to find stuff
superbin and superbin.directory? and
not ARGV.include? "--env=std"
rescue # blanket rescue because there are naked raises
@@ -112,8 +109,8 @@ class << ENV
def determine_path
paths = [superbin]
if MacSystem.xcode43_without_clt?
- paths << "#{MacSystem.xcode43_developer_dir}/usr/bin"
- paths << "#{MacSystem.xcode43_developer_dir}/Toolchains/XcodeDefault.xctoolchain/usr/bin"
+ paths << "#{MacOS::Xcode.prefix}/usr/bin"
+ paths << "#{MacOS::Xcode.prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin"
end
paths += deps.map{|dep| "#{HOMEBREW_PREFIX}/opt/#{dep}/bin" }
paths << "#{HOMEBREW_PREFIX}/opt/python/bin" if brewed_python?
@@ -197,11 +194,7 @@ class << ENV
# If Xcode path is fucked then this is basically a fix. In the case where
# nothing is valid, it still fixes most usage to supply a valid path that
# is not "/".
- if MacOS::Xcode.bad_xcode_select_path?
- (MacOS::Xcode.prefix || HOMEBREW_PREFIX).to_s
- elsif ENV['DEVELOPER_DIR']
- ENV['DEVELOPER_DIR']
- end
+ MacOS::Xcode.prefix || ENV['DEVELOPER_DIR']
end
def brewed_python?
diff --git a/Library/Homebrew/superenv/macsystem.rb b/Library/Homebrew/superenv/macsystem.rb
index 5f16b8fad..7d2a7880f 100644
--- a/Library/Homebrew/superenv/macsystem.rb
+++ b/Library/Homebrew/superenv/macsystem.rb
@@ -1,7 +1,7 @@
# new code because I don't really trust the Xcode code now having researched it more
module MacSystem extend self
def xcode_clt_installed?
- File.executable? "/usr/bin/clang" and File.executable? "/usr/bin/lldb"
+ File.executable? "/usr/bin/clang" and File.executable? "/usr/bin/lldb" and File.executable? "/usr/bin/make"
end
def xcode43_without_clt?
@@ -13,16 +13,6 @@ module MacSystem extend self
#{MacOS.sdk_path}/usr/X11].find{|path| File.directory? "#{path}/include" }
end
- def xcode43_developer_dir
- @xcode43_developer_dir ||=
- tst(ENV['DEVELOPER_DIR']) ||
- tst(`xcode-select -print-path 2>/dev/null`) ||
- tst("/Applications/Xcode.app/Contents/Developer") ||
- MacOS.mdfind("com.apple.dt.Xcode").find{|path| tst(path) }
- raise unless @xcode43_developer_dir
- @xcode43_developer_dir
- end
-
private
def tst prefix