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



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

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

  begin
    make_sure_scons_installed!
    defaults, ENV['CCFLAGS'] = ENV['CCFLAGS'], flags
    puts "-"*30
    compile_cmd = "cd #{dir} && scons mode=release snapshot=off library=static arch=#{arch}"
    puts compile_cmd
    system compile_cmd
    puts "-"*30
  ensure
    ENV['CCFLAGS'] = defaults
  end
end

#cpu_x64?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
# File 'ext/v8/extconf.rb', line 12

def cpu_x64?
  if rubinius?
    !!(RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64' ||
       RbConfig::MAKEFILE_CONFIG['ARCH_FLAG'] =~ /x86_64/)
  else
    ['foo'].pack('p').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



21
22
23
24
25
# File 'ext/v8/extconf.rb', line 21

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

#rubinius?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'ext/v8/extconf.rb', line 8

def rubinius?
  defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'  
end