diff options
| author | samueljohn | 2012-02-26 21:04:15 +0100 |
|---|---|---|
| committer | Adam Vandenberg | 2012-06-24 19:11:06 -0700 |
| commit | 725feb3db1da1577a3e1b376934e16aedbd9ded9 (patch) | |
| tree | 442b4168dde06a09e242a0ab7d4204e274ad60ce /Library/Homebrew/cmd | |
| parent | 3147dd134a6e919c974b4a8abc93338d489cc31a (diff) | |
| download | brew-725feb3db1da1577a3e1b376934e16aedbd9ded9.tar.bz2 | |
Core change: XCode only install, with CLT or both
Allow XCode without the Command Line Tools to
work with homebrew, so it's not necessary
to register an Apple Dev ID and/or go to the
XCode prefs and download the CLT. Yay!
Further, this commit allows to use the CLT
solely (without the need for XCode).
Saves quite some megs.
(Some furmulae require xcodebuild)
Of course XCode together with the CLT is still
fine and has been tested on 10.7 and 10.6
with Xcode 4 and Xcode 3.
Only on Lion or above, tell the user about the options,
which are
- Xcode without CLT
- CLT without Xcode
- both (ok, it's not directly stated, but implicit)
So if no Xcode is found and we are on Lion or above,
we don't fail but check for the CLTs now.
For older Macs, the old message that Xcode is needed
and the installer should be run is still displayed.
If the CLT are not found but Xcode is, then we
print out about the experimental status of this setup.
Closes Homebrew/homebrew#10510.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/--config.rb | 21 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 60 |
2 files changed, 57 insertions, 24 deletions
diff --git a/Library/Homebrew/cmd/--config.rb b/Library/Homebrew/cmd/--config.rb index 5fb455d23..a4431eb5e 100644 --- a/Library/Homebrew/cmd/--config.rb +++ b/Library/Homebrew/cmd/--config.rb @@ -25,8 +25,21 @@ module Homebrew extend self @clang_build ||= MacOS.clang_build_version end - def xcode_version - @xcode_version || MacOS.xcode_version + def describe_xcode + @describe_xcode ||= begin + xcode = MacOS.xcode_version + if MacOS.xcode_installed? + xcode += " in '#{MacOS.xcode_prefix}'" unless MacOS.xcode_prefix.to_s == '/Applications/Xcode.app/Contents/Developer' + else + xcode += ' (guessed)' unless MacOS.xcode_installed? + end + xcode += ", CLT #{MacOS.clt_version}" if MacOS.clt_installed? + xcode + end + end + + def describe_default_sdk + @describe_default_sdk ||= if MacOS.sdk_path.nil? then "N/A" else MacOS.sdk_path end end def sha @@ -90,7 +103,7 @@ module Homebrew extend self puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.to_s != "#{HOMEBREW_PREFIX}/Cellar" puts hardware puts "MacOS: #{MACOS_FULL_VERSION}-#{kernel}" - puts "Xcode: #{xcode_version}" + puts "Xcode: #{describe_xcode}" puts "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby:\n #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" if RUBY_VERSION.to_f != 1.8 ponk = macports_or_fink_installed? @@ -108,7 +121,7 @@ module Homebrew extend self #{hardware} OS X: #{MACOS_FULL_VERSION} Kernel Architecture: #{kernel} - Xcode: #{xcode_version} + Xcode: #{describe_xcode} GCC-4.0: #{gcc_40 ? "build #{gcc_40}" : "N/A"} GCC-4.2: #{gcc_42 ? "build #{gcc_42}" : "N/A"} LLVM: #{llvm ? "build #{llvm}" : "N/A"} diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 8aa229b28..a19a2d17e 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -217,16 +217,31 @@ def check_for_broken_symlinks end def check_for_latest_xcode - if MacOS.xcode_version.nil? - if MacOS.version >= 10.7 then return <<-EOS.undent - We couldn't detect any version of Xcode. - The latest Xcode can be obtained from the Mac App Store. - Alternatively, the Command Line Tools package can be obtained from - http://connect.apple.com - EOS - else return <<-EOS.undent - We couldn't detect any version of Xcode. - The latest Xcode can be obtained from http://connect.apple.com + if not MacOS.xcode_installed? + # no Xcode, now it depends on the OS X version... + if MacOS.version >= 10.7 then + if not MacOS.clt_installed? + return <<-EOS.undent + No Xcode version found! + No compiler found in /usr/bin! + + To fix this, either: + - Install the "Command Line Tools for Xcode" from http://connect.apple.com/ + Homebrew does not require all of Xcode, you only need the CLI tools package! + (However, you need a (free) Apple Developer ID.) + - Install Xcode from the Mac App Store. (Normal Apple ID is sufficient, here) + EOS + else + return <<-EOS.undent + Experimental support for using the "Command Line Tools" without Xcode. + Some formulae need Xcode to be installed (for the Frameworks not in the CLT.) + EOS + end + else + # older Mac systems should just install their old Xcode. We don't advertize the CLT. + return <<-EOS.undent + We couldn't detect any version of Xcode. + If you downloaded Xcode from the App Store, you may need to run the installer. EOS end end @@ -236,21 +251,24 @@ def check_for_latest_xcode when 10.6 then "3.2.6" else "4.3" end - if MacOS.xcode_version < latest_xcode then <<-EOS.undent - You have Xcode #{MacOS.xcode_version}, which is outdated. + if MacOS.xcode_installed? and MacOS.xcode_version < latest_xcode then <<-EOS.undent + You have Xcode-#{MacOS.xcode_version}, which is outdated. Please install Xcode #{latest_xcode}. EOS end end def check_cc - unless File.exist? '/usr/bin/cc' then <<-EOS.undent - You have no /usr/bin/cc. - This means you probably can't build *anything*. You need to install the Command - Line Tools for Xcode. You can either download this from http://connect.apple.com - or install them from inside Xcode's Download preferences. Homebrew does not - require all of Xcode! You only need the Command Line Tools package! - EOS + unless MacOS.clt_installed? + if MacOS.xcode_version >= "4.3" + return <<-EOS.undent + Experimental support for using Xcode without the "Command Line Tools". + EOS + else + return <<-EOS.undent + No compiler found in /usr/bin! + EOS + end end end @@ -386,7 +404,9 @@ end def check_xcode_select_path path = `xcode-select -print-path 2>/dev/null`.chomp - unless File.directory? path and File.file? "#{path}/usr/bin/xcodebuild" + # with the advent of CLT-only support, we don't need xcode-select + return if MacOS.clt_installed? + unless File.directory? path and File.file? "#{path}/usr/bin/xcodebuild" and not MacOS.xctools_fucked? # won't guess at the path they should use because it's too hard to get right # We specify /Applications/Xcode.app/Contents/Developer even though # /Applications/Xcode.app should work because people don't install the new CLI |
