Update Xcode version checks

Closes Homebrew/homebrew#11044.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-03-19 11:26:39 -05:00
parent f00099a179
commit fa837edcbb
3 changed files with 9 additions and 52 deletions

View File

@ -181,41 +181,12 @@ def check_for_broken_symlinks
end
end
def check_gcc_42
if MacOS.gcc_42_build_version == nil
# Don't show this warning on Xcode 4.2+
if MacOS.xcode_version < "4.2"
"We couldn't detect gcc 4.2.x. Some formulae require this compiler."
end
elsif MacOS.gcc_42_build_version < RECOMMENDED_GCC_42
<<-EOS.undent
Your gcc 4.2.x version is older than the recommended version.
It may be advisable to upgrade to the latest release of Xcode.
def check_for_latest_xcode
if MacOS.xcode_version.nil? then 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
def check_xcode_exists
if MacOS.xcode_version == nil
<<-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
elsif MacOS.xcode_version < "4.0"
if MacOS.gcc_40_build_version == nil
"We couldn't detect gcc 4.0.x. Some formulae require this compiler."
elsif MacOS.gcc_40_build_version < RECOMMENDED_GCC_40
<<-EOS.undent
Your gcc 4.0.x version is older than the recommended version.
It may be advisable to upgrade to the latest release of Xcode.
EOS
end
end
end
def check_for_latest_xcode
# the check_xcode_exists check is enough
return if MacOS.xcode_version.nil?
latest_xcode = case MacOS.version
when 10.5 then "3.1.4"

View File

@ -34,20 +34,10 @@ module Homebrew extend self
raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable? or HOMEBREW_PREFIX.to_s == '/usr/local'
end
def check_cc
if MacOS.snow_leopard?
if MacOS.llvm_build_version < RECOMMENDED_LLVM
opoo "You should upgrade to Xcode 3.2.6"
end
else
if (MacOS.gcc_40_build_version < RECOMMENDED_GCC_40) or (MacOS.gcc_42_build_version < RECOMMENDED_GCC_42)
opoo "You should upgrade to Xcode 3.1.4"
end
end
rescue
# the reason we don't abort is some formula don't require Xcode
# TODO allow formula to declare themselves as "not needing Xcode"
opoo "Xcode is not installed! Builds may fail!"
def check_xcode
require 'cmd/doctor'
xcode = Checks.new.check_for_latest_xcode
opoo xcode unless xcode.nil?
end
def check_macports
@ -70,7 +60,7 @@ module Homebrew extend self
def perform_preinstall_checks
check_ppc
check_writable_install_location
check_cc
check_xcode
check_macports
check_cellar
end

View File

@ -76,10 +76,6 @@ HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY
HOMEBREW_CURL_ARGS = '-qf#LA'
RECOMMENDED_LLVM = 2326
RECOMMENDED_GCC_40 = (MACOS_VERSION >= 10.6) ? 5494 : 5493
RECOMMENDED_GCC_42 = (MACOS_VERSION >= 10.6) ? 5664 : 5577
require 'fileutils'
module Homebrew extend self
include FileUtils