forked from rubyjs/libv8
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Logan Lowell
committed
May 24, 2011
0 parents
commit da58b23
Showing
211 changed files
with
70,333 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "ext/libv8/v8"] | ||
path = ext/libv8/v8 | ||
url = https://github.com/v8/v8.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in libv8.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'bundler' | ||
require 'bundler/setup' | ||
|
||
# require "rake/extensiontask" | ||
|
||
Bundler::GemHelper.install_tasks | ||
|
||
# desc "remove all generated artifacts except built v8 objects" | ||
# task :clean do | ||
# sh "rm -rf pkg" | ||
# sh "rm -rf ext/v8/Makefile" | ||
# sh "rm -rf ext/v8/*.bundle ext/v8/*.so" | ||
# sh "rm -rf lib/v8/*.bundle lib/v8/*.so" | ||
# end | ||
# | ||
# desc "build v8 with debugging symbols (much slower)" | ||
# task "v8:debug" do | ||
# sh "cd ext/v8/upstream && make debug" | ||
# end | ||
|
||
# Rake::ExtensionTask.new("libv8", eval(File.read("libv8.gemspec"))) do |ext| | ||
# ext.lib_dir = "lib/libv8" | ||
# end | ||
|
||
desc "Compile the V8 JavaScript engine" | ||
task "compile" do | ||
Dir.chdir(File.join('lib', 'libv8')) do | ||
puts "Compiling V8..." | ||
$stdout.flush | ||
`make` | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'mkmf' | ||
require 'pathname' | ||
|
||
puts "Compiling V8..." | ||
|
||
Dir.chdir(Pathname(__FILE__).dirname.join('..', '..', 'lib', 'libv8')) do | ||
`make` | ||
end | ||
|
||
create_makefile('libv8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'pathname' | ||
|
||
require 'libv8/version' | ||
|
||
module Libv8 | ||
def self.LIB_PATH | ||
Pathname(__FILE__).dirname.join('libv8', 'build', 'v8', 'libv8.a') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
SCONS=build/scons/install/bin/scons | ||
SCONSSRC=build/scons | ||
V8SRC=build/v8 | ||
LIBV8=build/v8/libv8.a | ||
LIBV8_G=build/v8/libv8_g.a | ||
GCC_VERSION=$(shell ruby -e 'puts %x{gcc --version} =~ /(\d)\.(\d)\.\d/ ? $$1 + $$2 : "UNKNOWN"') | ||
ARCH=$(shell ruby detect_cpu.rb) | ||
|
||
all: $(LIBV8) | ||
|
||
debug: $(LIBV8_G) | ||
cp $(LIBV8_G) $(LIBV8) | ||
|
||
$(LIBV8): $(SCONS) $(V8SRC) | ||
cd build/v8 && GCC_VERSION=$(GCC_VERSION) ../scons/install/bin/scons arch=$(ARCH) | ||
|
||
$(LIBV8_G): $(SCONS) $(V8SRC) | ||
cd build/v8 && GCC_VERSION=$(GCC_VERSION) ../scons/install/bin/scons arch=$(ARCH) mode=debug | ||
|
||
$(SCONS): $(SCONSSRC) | ||
mkdir -p $(SCONSSRC)/install | ||
python build/scons/setup.py install --prefix=install | ||
|
||
$(V8SRC): build | ||
cp -r v8 build | ||
|
||
$(SCONSSRC): build | ||
cp -r scons build | ||
|
||
build: | ||
mkdir -p build | ||
|
||
scons: $(SCONS) | ||
|
||
clean: | ||
rm -rf build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'rbconfig' | ||
|
||
def x86_64_from_build_cpu | ||
RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64' | ||
end | ||
|
||
def x86_64_from_byte_length | ||
['foo'].pack('p').size == 8 | ||
end | ||
|
||
def x86_64_from_arch_flag | ||
RbConfig::MAKEFILE_CONFIG['ARCH_FLAG'] =~ /x86_64/ | ||
end | ||
|
||
def rubinius? | ||
Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == "rbx" | ||
end | ||
|
||
def x64? | ||
if rubinius? | ||
x86_64_from_build_cpu || x86_64_from_arch_flag | ||
else | ||
x86_64_from_byte_length | ||
end | ||
end | ||
|
||
puts x64? ? "x64" : "ia32" |
Oops, something went wrong.