Module: Libv8

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

Defined Under Namespace

Modules: Arch

Constant Summary collapse

VERSION =
"3.11.8.2"

Class Method Summary collapse

Class Method Details

.libv8_baseObject



23
24
25
# File 'lib/libv8.rb', line 23

def libv8_base
  libv8_object :base
end

.libv8_include_flagsObject



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

def libv8_include_flags
  "-I#{libv8_include_path}"
end

.libv8_include_pathObject



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

def libv8_include_path
  "#{libv8_source_path}/include"
end

.libv8_ldflagsObject



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

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

.libv8_nosnapshotObject



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

def libv8_nosnapshot
  libv8_object :nosnapshot
end

.libv8_object(name) ⇒ Object



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

def libv8_object(name)
  filename = "#{libv8_source_path}/out/#{Libv8::Arch.libv8_arch}.release/libv8_#{name}.#{$LIBEXT}"
  unless File.exists? filename
    filename = "#{libv8_source_path}/out/#{Libv8::Arch.libv8_arch}.release/obj.target/tools/gyp/libv8_#{name}.#{$LIBEXT}"
  end
  unless File.exists? filename
    # SCons build
    filename = "#{libv8_source_path}/#{name}.#{$LIBEXT}"
  end
  filename
end

.libv8_objects(*names) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/libv8.rb', line 35

def libv8_objects(*names)
  if names.empty?
    names = if mingw?
      # SCons build
      [:libv8]
    else
      [:base, :snapshot]
    end
  end
  names.map do |name|
    fail "no libv8 object #{name}" unless File.exists?(object = libv8_object(name))
    object
  end
end

.libv8_snapshotObject



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

def libv8_snapshot
  libv8_object :snapshot
end

.libv8_source_pathObject



62
63
64
# File 'lib/libv8.rb', line 62

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

.mingw?Boolean

Returns:

  • (Boolean)


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

def mingw?
  RUBY_PLATFORM =~ /mingw/
end