Module: Libv8

Defined in:
lib/libv8.rb,
lib/libv8/version.rb,
ext/libv8/arch.rb,
ext/libv8/make.rb,
ext/libv8/compiler.rb

Defined Under Namespace

Modules: Arch, Compiler, Make

Constant Summary collapse

VERSION =
"3.11.8.3"

Class Method Summary collapse

Class Method Details

.configObject



8
9
10
# File 'lib/libv8.rb', line 8

def config
  Config::MAKEFILE_CONFIG
end

.libv8_baseObject



26
27
28
# File 'lib/libv8.rb', line 26

def libv8_base
  libv8_object :base
end

.libv8_include_flagsObject



50
51
52
# File 'lib/libv8.rb', line 50

def libv8_include_flags
  "-I#{libv8_include_path}"
end

.libv8_include_pathObject



54
55
56
# File 'lib/libv8.rb', line 54

def libv8_include_path
  "#{libv8_source_path}/include"
end

.libv8_ldflagsObject



46
47
48
# File 'lib/libv8.rb', line 46

def libv8_ldflags
  "-L#{libv8_base} -L#{libv8_snapshot}"
end

.libv8_nosnapshotObject



34
35
36
# File 'lib/libv8.rb', line 34

def libv8_nosnapshot
  libv8_object :nosnapshot
end

.libv8_object(name) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/libv8.rb', line 12

def libv8_object(name)
  filename = "#{libv8_profile}/libv8_#{name}.#{config['LIBEXT']}"
  unless File.exists? filename
    filename = "#{libv8_profile}/obj.target/tools/gyp/libv8_#{name}.#{config['LIBEXT']}"
  end
  return filename
end

.libv8_objects(*names) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/libv8.rb', line 38

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
end

.libv8_profileObject



20
21
22
23
24
# File 'lib/libv8.rb', line 20

def libv8_profile
  base = "#{libv8_source_path}/out/#{Libv8::Arch.libv8_arch}"
  debug = "#{base}.debug"
  File.exists?(debug) ? debug : "#{base}.release"
end

.libv8_snapshotObject



30
31
32
# File 'lib/libv8.rb', line 30

def libv8_snapshot
  libv8_object :snapshot
end

.libv8_source_pathObject



58
59
60
# File 'lib/libv8.rb', line 58

def libv8_source_path
  File.expand_path "../../vendor/v8", __FILE__
end