From 548160f3b890a3f5cdce494d3452ee62fc8fa243 Mon Sep 17 00:00:00 2001 From: ignisf Date: Thu, 7 Feb 2013 03:19:47 +0200 Subject: [PATCH] Isolate printing of build info in a method Conflicts: ext/libv8/compiler.rb ext/libv8/paths.rb --- ext/libv8/builder.rb | 16 ++++++++++++++-- ext/libv8/compiler.rb | 5 ++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ext/libv8/builder.rb b/ext/libv8/builder.rb index 4c228c4..e7292e1 100644 --- a/ext/libv8/builder.rb +++ b/ext/libv8/builder.rb @@ -27,6 +27,7 @@ module Libv8 def build_libv8! Dir.chdir(File.expand_path '../../../vendor/v8', __FILE__) do setup_python! + print_build_info puts `env CXX=#{compiler} LINK=#{compiler} #{make} #{make_flags}` end return $?.exitstatus @@ -44,17 +45,28 @@ module Libv8 `ln -fs #{`which python2`.chomp} python` ENV['PATH'] = "#{File.expand_path '.'}:#{ENV['PATH']}" end - puts "using python #{python_version}" end private def python_version if system 'which python 2>&1 > /dev/null' - `python -c 'import platform; print platform.python_version()'`.chomp + `python -c 'import platform; print(platform.python_version())'`.chomp else "not available" end end + + def print_build_info + puts "Compiling v8 for #{libv8_arch}" + + puts "Using python #{python_version}" + + puts "Using compiler: #{compiler}" + unless check_gcc_compiler compiler + warn "Unable to find a compiler officially supported by v8." + warn "It is recommended to use GCC v4.4 or higher" + end + end end end diff --git a/ext/libv8/compiler.rb b/ext/libv8/compiler.rb index cb873a4..63b6d1f 100644 --- a/ext/libv8/compiler.rb +++ b/ext/libv8/compiler.rb @@ -19,7 +19,6 @@ module Libv8 @compiler = cc = 'g++' end - puts "Using compiler: #{cc}" @compiler = cc end @@ -27,7 +26,7 @@ module Libv8 end def check_gcc_compiler(name) - compiler = `which #{name}` + compiler = `which #{name} 2> /dev/null` return nil unless $?.success? compiler.chomp! @@ -38,7 +37,7 @@ module Libv8 end def check_clang_compiler(name) - compiler = `which #{name}` + compiler = `which #{name} 2> /dev/null` return nil unless $?.success? compiler.chomp end