Stop warning about CLT w/o Xcode

Also made the latest_versions checks smarter. Hopefully correct too.
This commit is contained in:
Max Howell 2012-08-17 17:18:17 -04:00
parent 01bf892ef8
commit 6ffe27fa98
2 changed files with 32 additions and 36 deletions

View File

@ -206,49 +206,27 @@ end
def check_for_latest_xcode def check_for_latest_xcode
if not MacOS::Xcode.installed? if not MacOS::Xcode.installed?
# no Xcode, now it depends on the OS X version... if MacOS.version >= 10.7
if MacOS.version >= 10.7 then
if not MacOS::CLT.installed? if not MacOS::CLT.installed?
return <<-EOS.undent <<-EOS.undent
No Xcode version found! No developer tools installed
No compiler found in /usr/bin! You should install the Command Line Tools: http://connect.apple.com
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 EOS
else elsif not MacOS::CLT.latest_version?
return <<-EOS.undent <<-EOS.undent
Experimental support for using the "Command Line Tools" without Xcode. A newer Command Line Tools for Xcode release is avaliable
Some formulae need Xcode to be installed (for the Frameworks not in the CLT.) You should install the latest version from: http://connect.apple.com
EOS EOS
end end
else else
# older Mac systems should just install their old Xcode. We don't advertize the CLT. <<-EOS.undent
return <<-EOS.undent Xcode not installed
We couldn't detect any version of Xcode. Most stuff needs Xcode to build: http://developer.apple.com/xcode/
If you downloaded Xcode from the App Store, you may need to run the installer.
EOS EOS
end end
end elsif MacOS::Xcode.version < MacOS::Xcode.latest_version then <<-EOS.undent
Your Xcode (#{MacOS::Xcode.version}) is outdated
latest_xcode = case MacOS.version Please install Xcode #{MacOS::Xcode.latest_version}.
when 10.5 then "3.1.4"
when 10.6 then "3.2.6"
when 10.7 then "4.3.3"
when 10.8 then "4.4"
else nil
end
if latest_xcode.nil?
return <<-EOS.undent
Not sure what version of Xcode is the latest for OS X #{MacOS.version}.
EOS
end
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 EOS
end end
end end

View File

@ -16,6 +16,19 @@ module MacOS::Xcode extend self
folder == "/" folder == "/"
end end
def latest_version
case MacOS.version
when 10.5 then "3.1.4"
when 10.6 then "3.2.6"
else
if MacOS.version >= 10.7
"4.4.1"
else
raise "Mac OS X `#{MacOS.version}' is invalid"
end
end
end
def prefix def prefix
@prefix ||= begin @prefix ||= begin
path = Pathname.new folder path = Pathname.new folder
@ -144,6 +157,11 @@ module MacOS::CLT extend self
MacOS.dev_tools_path == Pathname.new("/usr/bin") MacOS.dev_tools_path == Pathname.new("/usr/bin")
end end
def latest_version?
`/usr/bin/clang -v` =~ %r{tags/Apple/clang-(\d+).(\d+).(\d+)}
$1 >= 421 and $3 >= 57
end
def version def version
# Version string (a pretty damn long one) of the CLT package. # Version string (a pretty damn long one) of the CLT package.
# Note, that different ways to install the CLTs lead to different # Note, that different ways to install the CLTs lead to different