Class: Libv8::Builder
Constant Summary
Constants included
from Patcher
Patcher::PATCH_DIRECTORY
Constants included
from Checkout
Checkout::GYP_SVN, Checkout::GYP_Source, Checkout::V8_Source
Instance Method Summary
collapse
Methods included from Patcher
patch!
Methods included from Checkout
check_git_svn!, checkout!, git?
Methods included from Make
make
Methods included from Arch
arm?, libv8_arch, rubinius?, x64?, x86_64_from_arch_flag, x86_64_from_build_cpu, x86_64_from_byte_length
Constructor Details
Returns a new instance of Builder.
15
16
17
|
# File 'ext/libv8/builder.rb', line 15
def initialize
@compiler = choose_compiler
end
|
Instance Method Details
#build_libv8! ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'ext/libv8/builder.rb', line 51
def build_libv8!
checkout!
setup_python!
Dir.chdir(V8_Source) do
setup_build_deps!
fail 'No compilers available' if @compiler.nil?
patch!
print_build_info
puts 'Beginning compilation. This will take some time.'
command = "env CXX=#{@compiler} LINK=#{@compiler}"
case RUBY_PLATFORM
when /mingw/
system "env CXX=#{@compiler} LINK=#{@compiler} bash #{PATCH_DIRECTORY}/mingw-generate-makefiles.sh"
command += " make #{make_target}"
else
command += " #{make} #{make_flags}"
end
puts "Building v8 with #{command}"
system command
end
return $?.exitstatus
end
|
#make_flags(*flags) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'ext/libv8/builder.rb', line 24
def make_flags(*flags)
flags << "strictaliasing=off" if @compiler.is_a?(Compiler::GCC) and @compiler.version < '4.4'
flags << "vfp2=off vfp3=on" if @compiler.target.include? "arm"
flags << "hardfp=on" if @compiler.target.include? "arm"
flags << "ARFLAGS.target=crs"
flags << "CFLAGS=-G" if @compiler.target =~ /solaris/
flags << 'werror=no'
"#{make_target} #{flags.join ' '}"
end
|
#make_target ⇒ Object
19
20
21
22
|
# File 'ext/libv8/builder.rb', line 19
def make_target
profile = enable_config('debug') ? 'debug' : 'release'
"#{libv8_arch}.#{profile}"
end
|
#setup_build_deps! ⇒ Object
93
94
95
96
97
98
|
# File 'ext/libv8/builder.rb', line 93
def setup_build_deps!
`rm -rf build/gyp`
`ln -fs #{GYP_Source} build/gyp`
end
|
#setup_python! ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'ext/libv8/builder.rb', line 79
def setup_python!
if python_version !~ /^2/
unless system 'which python2 2>&1 > /dev/null'
fail "libv8 requires python 2 to be installed in order to build, but it is currently #{python_version}"
end
`ln -fs #{`which python2`.chomp} python`
ENV['PATH'] = "#{File.expand_path '.'}:#{ENV['PATH']}"
end
end
|