diff options
| -rw-r--r-- | Library/Homebrew/compilers.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/development_tools.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 17 | ||||
| -rwxr-xr-x | Library/Homebrew/shims/super/cc | 6 | ||||
| l--------- | Library/Homebrew/shims/super/llvm_clang | 1 | ||||
| l--------- | Library/Homebrew/shims/super/llvm_clang++ | 1 | ||||
| -rw-r--r-- | Library/Homebrew/test/install_test.rb | 23 |
7 files changed, 57 insertions, 7 deletions
diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index fdfcab817..9ee847db0 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -3,9 +3,10 @@ module CompilerConstants GNU_GCC_VERSIONS = %w[4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 6 7].freeze GNU_GCC_REGEXP = /^gcc-(4\.[3-9]|[5-7])$/ COMPILER_SYMBOL_MAP = { - "gcc-4.0" => :gcc_4_0, - "gcc-4.2" => :gcc, - "clang" => :clang, + "gcc-4.0" => :gcc_4_0, + "gcc-4.2" => :gcc, + "clang" => :clang, + "llvm_clang" => :llvm_clang, }.freeze COMPILERS = COMPILER_SYMBOL_MAP.values + @@ -86,7 +87,7 @@ class CompilerSelector Compiler = Struct.new(:name, :version) COMPILER_PRIORITY = { - clang: [:clang, :gcc, :gnu, :gcc_4_0], + clang: [:clang, :gcc, :gnu, :gcc_4_0, :llvm_clang], gcc: [:gcc, :gnu, :clang, :gcc_4_0], gcc_4_0: [:gcc_4_0, :gcc, :gnu, :clang], }.freeze diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb index 62f9b3d71..d081067a8 100644 --- a/Library/Homebrew/development_tools.rb +++ b/Library/Homebrew/development_tools.rb @@ -86,6 +86,13 @@ class DevelopmentTools end end + def llvm_clang_build_version + @llvm_clang_build_version ||= if Tab.for_name "llvm" + path = Formulary.factory("llvm").opt_prefix/"bin/clang" + `#{path} --version`[/clang version (\d\.\d\.\d)/, 1] + end + end + def non_apple_gcc_version(cc) (@non_apple_gcc_version ||= {}).fetch(cc) do path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index c05b0da60..19b619625 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -52,6 +52,7 @@ class FormulaInstaller @debug = false @options = Options.new @invalid_option_names = [] + @requirement_messages = [] @@attempted ||= Set.new @@ -251,6 +252,7 @@ class FormulaInstaller opoo "Bottle installation failed: building from source." raise BuildToolsError, [formula] unless DevelopmentTools.installed? else + puts_requirement_messages @poured_bottle = true end end @@ -260,6 +262,7 @@ class FormulaInstaller unless @poured_bottle not_pouring = !pour_bottle || @pour_failed compute_and_install_dependencies if not_pouring && !ignore_deps? + puts_requirement_messages build clean @@ -334,17 +337,21 @@ class FormulaInstaller end def check_requirements(req_map) + @requirement_messages = [] fatals = [] req_map.each_pair do |dependent, reqs| next if dependent.installed? reqs.each do |req| - puts "#{dependent}: #{req.message}" + @requirement_messages << "#{dependent}: #{req.message}" fatals << req if req.fatal? end end - raise UnsatisfiedRequirements, fatals unless fatals.empty? + return if fatals.empty? + + puts_requirement_messages + raise UnsatisfiedRequirements, fatals end def install_requirement_default_formula?(req, dependent, build) @@ -831,4 +838,10 @@ class FormulaInstaller @@locked.clear @hold_locks = false end + + def puts_requirement_messages + return unless @requirement_messages + return if @requirement_messages.empty? + puts @requirement_messages + end end diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc index 1552f412d..167fe8c21 100755 --- a/Library/Homebrew/shims/super/cc +++ b/Library/Homebrew/shims/super/cc @@ -58,6 +58,8 @@ class Cmd @tool ||= case @arg0 when "ld" then "ld" when "cpp" then "cpp" + when /llvm_(clang(\+\+)?)/ + "#{ENV["HOMEBREW_PREFIX"]}/opt/llvm/bin/#{$1}" when /\w\+\+(-\d(\.\d)?)?$/ case ENV["HOMEBREW_CC"] when /clang/ @@ -154,7 +156,7 @@ class Cmd /^-O[0-9zs]?$/, "-fast", "-no-cpp-precomp", "-pedantic", "-pedantic-errors", "-Wno-long-double", "-Wno-unused-but-set-variable" - when "-fopenmp", "-lgomp", "-mno-fused-madd", "-fforce-addr", "-fno-defer-pop", + when "-mno-fused-madd", "-fforce-addr", "-fno-defer-pop", "-mno-dynamic-no-pic", "-fearly-inlining", /^-f(?:no-)?inline-functions-called-once/, /^-finline-limit/, /^-f(?:no-)?check-new/, "-fno-delete-null-pointer-checks", "-fcaller-saves", "-fthread-jumps", "-fno-reorder-blocks", "-fcse-skip-blocks", @@ -163,6 +165,8 @@ class Cmd "-fuse-linker-plugin", "-frounding-math" # clang doesn't support these flags args << arg unless tool =~ /^clang/ + when "-fopenmp", "-lgomp" + args << arg if tool =~ /^llvm_clang/ when "--fast-math" arg = "-ffast-math" if tool =~ /^clang/ args << arg diff --git a/Library/Homebrew/shims/super/llvm_clang b/Library/Homebrew/shims/super/llvm_clang new file mode 120000 index 000000000..2652f5f42 --- /dev/null +++ b/Library/Homebrew/shims/super/llvm_clang @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/Library/Homebrew/shims/super/llvm_clang++ b/Library/Homebrew/shims/super/llvm_clang++ new file mode 120000 index 000000000..2652f5f42 --- /dev/null +++ b/Library/Homebrew/shims/super/llvm_clang++ @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/Library/Homebrew/test/install_test.rb b/Library/Homebrew/test/install_test.rb index fa1057a02..9fe5fff0e 100644 --- a/Library/Homebrew/test/install_test.rb +++ b/Library/Homebrew/test/install_test.rb @@ -27,4 +27,27 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase assert_match "testball1: this formula has no --with-fo option so it will be ignored!", cmd("install", "testball1", "--with-fo") end + + def test_install_with_nonfatal_requirement + setup_test_formula "testball1", <<-EOS.undent + class NonFatalRequirement < Requirement + satisfy { false } + end + depends_on NonFatalRequirement + EOS + message = "NonFatalRequirement unsatisfied!" + assert_equal 1, cmd("install", "testball1").scan(message).size + end + + def test_install_with_fatal_requirement + setup_test_formula "testball1", <<-EOS.undent + class FatalRequirement < Requirement + fatal true + satisfy { false } + end + depends_on FatalRequirement + EOS + message = "FatalRequirement unsatisfied!" + assert_equal 1, cmd_fail("install", "testball1").scan(message).size + end end |
