Class: Libv8::Node::Location::Vendor

Inherits:
Libv8::Node::Location show all
Defined in:
ext/libv8-node/location.rb

Defined Under Namespace

Classes: ArchiveNotFound, HeaderNotFound

Instance Method Summary collapse

Methods inherited from Libv8::Node::Location

load!

Instance Method Details

#configure(context = MkmfContext.new) ⇒ Object



40
41
42
43
# File 'ext/libv8-node/location.rb', line 40

def configure(context = MkmfContext.new)
  context.incflags.insert(0, Libv8::Node::Paths.include_paths.map { |p| "-I#{p}" }.join(' ') << ' ')
  context.ldflags.insert(0, Libv8::Node::Paths.object_paths.join(' ') << ' ')
end

#install!Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'ext/libv8-node/location.rb', line 26

def install!
  require File.expand_path('builder', __dir__)

  builder = Libv8::Node::Builder.new
  exit_status = builder.build_libv8!
  builder.remove_intermediates!

  super if exit_status == 0

  verify_installation!

  exit_status
end

#verify_installation!Object



45
46
47
48
49
50
51
52
53
54
55
# File 'ext/libv8-node/location.rb', line 45

def verify_installation!
  include_paths = Libv8::Node::Paths.include_paths

  unless include_paths.detect { |p| Pathname(p).join('v8.h').exist? } # rubocop:disable Style/IfUnlessModifier
    raise(HeaderNotFound, "Unable to locate 'v8.h' in the libv8 header paths: #{include_paths.inspect}")
  end

  Libv8::Node::Paths.object_paths.each do |p|
    raise(ArchiveNotFound, p) unless File.exist?(p)
  end
end