From b46d5de49233fde8a89891053a089f96a8749c15 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Tue, 2 Jun 2015 15:47:08 -0400 Subject: [PATCH] Requirements: add CctoolsRequirement Install it as a dependency unless already satisfied by Xcode. require cctools_requirement cctools_requirement should be satisfied by cctools present in opt add build_env => false to the satify block options in CctoolsRequirement --- Library/Homebrew/cmd/install.rb | 6 +++--- Library/Homebrew/formula_installer.rb | 7 +++++-- Library/Homebrew/requirements/cctools_requirement.rb | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index b2f1f195d0..fa9507fb3c 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -122,13 +122,13 @@ module Homebrew end def check_xcode - # TODO: reinstate check_for_bad_install_name_tool + # TODO: reinstate check_for_bad_install_name_tool and check_for_installed_developer_tools # currently check_for_bad_install_name_tool fails because it tries to call # the /usr/bin/otool stub program on systems without XCode/CLT + # check_for_installed_developer_tools doesn't fail, but produces a warning + # when one is no longer required checks = Checks.new %w[ - check_for_unsupported_osx - check_for_installed_developer_tools check_xcode_license_approved check_for_osx_gcc_installer ].each do |check| diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index ed02abb9a7..8377e25f6d 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -13,6 +13,7 @@ require "cmd/postinstall" require "hooks/bottles" require "debrew" require "sandbox" +require "requirements/cctools_requirement" class FormulaInstaller include FormulaCellarChecks @@ -328,8 +329,10 @@ class FormulaInstaller end def install_relocation_tools - ohai "placeholder" - true + cctools = CctoolsRequirement.new + return if cctools.satisfied? + + install_dependency(cctools.to_dependency, inherited_options_for(cctools)) end class DependencyInstaller < FormulaInstaller diff --git a/Library/Homebrew/requirements/cctools_requirement.rb b/Library/Homebrew/requirements/cctools_requirement.rb index a9f807d74b..37be3207bc 100644 --- a/Library/Homebrew/requirements/cctools_requirement.rb +++ b/Library/Homebrew/requirements/cctools_requirement.rb @@ -2,7 +2,7 @@ class CctoolsRequirement < Requirement fatal true default_formula 'cctools' - satisfy do - MacOS::XCode.installed? || MacOS::CLT.installed? + satisfy(:build_env => false) do + MacOS::Xcode.installed? || MacOS::CLT.installed? || Formula['cctools'].installed? end end