2012-05-01 17:47:07 -04:00
|
|
|
require 'mkmf'
|
|
|
|
require 'libv8/arch'
|
2011-05-24 14:17:58 -04:00
|
|
|
module Libv8
|
2012-04-25 23:46:30 -04:00
|
|
|
|
|
|
|
module_function
|
|
|
|
|
2012-05-01 17:47:07 -04:00
|
|
|
def libv8_object(name)
|
|
|
|
"#{libv8_source_path}/out/#{Libv8::Arch.libv8_arch}.release/libv8_#{name}.#{$LIBEXT}"
|
2012-04-25 23:46:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_base
|
2012-05-01 17:47:07 -04:00
|
|
|
libv8_object :base
|
2012-04-25 23:46:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_snapshot
|
2012-05-01 17:47:07 -04:00
|
|
|
libv8_object :snapshot
|
2012-04-25 23:46:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_nosnapshot
|
2012-05-01 17:47:07 -04:00
|
|
|
libv8_object :nosnapshot
|
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_objects(*names)
|
|
|
|
names = [:base, :snapshot] if names.empty?
|
|
|
|
names.map do |name|
|
|
|
|
fail "no libv8 object #{name}" unless File.exists?(object = libv8_object(name))
|
|
|
|
object
|
|
|
|
end
|
2012-04-25 23:46:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_ldflags
|
2012-05-01 17:47:07 -04:00
|
|
|
"-L#{libv8_base} -L#{libv8_snapshot}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_include_flags
|
|
|
|
"-I#{libv8_include_path}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_include_path
|
|
|
|
"#{libv8_source_path}/include"
|
|
|
|
end
|
|
|
|
|
|
|
|
def libv8_source_path
|
|
|
|
File.expand_path "../../vendor/v8", __FILE__
|
2011-05-24 14:17:58 -04:00
|
|
|
end
|
|
|
|
end
|