mirror of
https://github.com/rubyjs/libv8
synced 2023-03-27 23:21:48 -04:00
Isolate printing of build info in a method
Conflicts: ext/libv8/compiler.rb ext/libv8/paths.rb
This commit is contained in:
parent
b8879a01b7
commit
548160f3b8
2 changed files with 16 additions and 5 deletions
ext/libv8
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue