diff options
| author | Max Howell | 2011-09-02 11:53:41 +0100 |
|---|---|---|
| committer | Max Howell | 2011-09-02 12:12:30 +0100 |
| commit | dba935707cbb0286c8d0bdbbb47c3a6dbc9a8778 (patch) | |
| tree | eb79c8cff26d4e27d44e3979181bb71ffce3b2df /Library/Homebrew/utils.rb | |
| parent | 8e88b22fd1ec65a344ce6e4facd6dad4b415b2ad (diff) | |
| download | homebrew-dba935707cbb0286c8d0bdbbb47c3a6dbc9a8778.tar.bz2 | |
Guess Xcode version if `xcodebuild` doesn't exist
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 2a5a3a178..43c83c14d 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -297,8 +297,30 @@ module MacOS extend self def xcode_version @xcode_version ||= begin + raise unless system "/usr/bin/which -s xcodebuild" `xcodebuild -version 2>&1` =~ /Xcode (\d(\.\d)*)/ $1 + rescue + # for people who don't have xcodebuild installed due to using + # some variety of minimal installer, let's try and guess their + # Xcode version + case llvm_build_version.to_i + when 0..2063 then "3.1.0" + when 2064..2065 then "3.1.4" + when 2366..2325 + # we have no data for this range so we are guessing + "3.2.0" + when 2326 + # also applies to "3.2.3" + "3.2.4" + when 2327..2333 then "3.2.5" + when 2335 + # this build number applies to 3.2.6, 4.0 and 4.1 + # https://github.com/mxcl/homebrew/wiki/Xcode + "4.0" + else + "4.2" + end end end |
