Top Level Namespace

Defined Under Namespace

Modules: Delegated, Mustang Classes: Class, Object, Symbol

Constant Summary collapse

V8_DIR =
File.expand_path("../../../vendor/v8", __FILE__)

Instance Method Summary collapse

Instance Method Details

#compile_vendor_v8!(dir) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'ext/v8/extconf.rb', line 25

def compile_vendor_v8!(dir)
  arch = cpu_x64? ? 'x64' : 'ia32' 
  flags = '-fPIC -fno-builtin-memcpy -shared'

  Dir.chdir dir do 
    if Dir["**/libv8.a"].empty?
      begin
        make_sure_scons_installed!
        defaults, ENV['CCFLAGS'] = ENV['CCFLAGS'], flags
        build_cmd = "scons mode=release snapshot=off library=static arch=#{arch}"
        puts build_cmd
        system build_cmd
      ensure
        ENV['CCFLAGS'] = defaults
      end
    end
  end
end

#cpu_x64?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
17
# File 'ext/v8/extconf.rb', line 8

def cpu_x64?
  if defined?(RUBY_ENGINE) and RUBY_ENGINE != 'rbx'
    !!(RbConfig::MAKEFILE_CONFIG['arch'] =~ /x86_64/ ||
       RbConfig::MAKEFILE_CONFIG['target_cpu'] == 'x86_64' ||
       RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64' ||
       RbConfig::MAKEFILE_CONFIG['ARCH_FLAG'] =~ /x86_64/)
  else
    ['x'].pack('y').size == 8
  end
end

#darwin?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'ext/v8/extconf.rb', line 4

def darwin?
  RUBY_PLATFORM =~ /darwin/
end

#make_sure_scons_installed!Object



19
20
21
22
23
# File 'ext/v8/extconf.rb', line 19

def make_sure_scons_installed!
  unless `hash scons; echo $?`.to_i == 0
    raise RuntimeError, "ERROR: To compile V8 engine you need to install the Scons library!"
  end
end