Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 #18618
  • Loading branch information...
commit 06935cd77d28a4447ea33384263d23076e4a518a 1 parent 05fb7cf
@samueljohn samueljohn authored
View
4 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
View
2  Library/Homebrew/os/mac/xcode.rb
@@ -76,7 +76,7 @@ def uncached_version
# 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
View
15 Library/Homebrew/superenv.rb
@@ -18,10 +18,7 @@ def superbin
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 @@ def determine_cc
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 @@ def determine_developer_dir
# 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?
View
12 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 @@ def x11_prefix
#{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
Please sign in to comment.
Something went wrong with that request. Please try again.