From fa837edcbbde0d921090aa54660fa4628252f581 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 19 Mar 2012 11:26:39 -0500 Subject: [PATCH] Update Xcode version checks Closes Homebrew/homebrew#11044. Signed-off-by: Jack Nagel --- Library/Homebrew/cmd/doctor.rb | 37 ++++----------------------------- Library/Homebrew/cmd/install.rb | 20 +++++------------- Library/Homebrew/global.rb | 4 ---- 3 files changed, 9 insertions(+), 52 deletions(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 4db70cb32b..caa9d3191e 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -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" diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index bfc5d3e7b9..e4ffe32682 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -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 diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 04ef525bf7..b29ab0ff9f 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -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