mirror of
https://github.com/rubyjs/libv8
synced 2023-03-27 23:21:48 -04:00
Allow compilation directly from git.
Fixes #89. Make sure to add submodules: true to your Gemfile.
This commit is contained in:
parent
87fbcb12a1
commit
0f386d326f
4 changed files with 27 additions and 19 deletions
|
@ -7,5 +7,3 @@ notifications:
|
|||
recipients:
|
||||
- cowboyd@thefrontside.net
|
||||
- bordjukov@gmail.com
|
||||
before_install:
|
||||
- sudo apt-get install subversion
|
||||
|
|
20
Rakefile
20
Rakefile
|
@ -15,31 +15,17 @@ V8_Source = File.expand_path '../vendor/v8', __FILE__
|
|||
require File.expand_path '../ext/libv8/make.rb', __FILE__
|
||||
include Libv8::Make
|
||||
|
||||
desc "setup the vendored v8 source to correspond to the libv8 gem version and prepare deps"
|
||||
desc "setup the vendored v8 source to correspond to the libv8 gem version"
|
||||
task :checkout do
|
||||
sh "git submodule update --init"
|
||||
Dir.chdir(V8_Source) do
|
||||
sh "git fetch"
|
||||
sh "git checkout #{V8_Version} -f"
|
||||
sh "#{make} dependencies"
|
||||
end
|
||||
end
|
||||
|
||||
desc "apply the libv8 gem patches to the vendored v8 source"
|
||||
task :patch do
|
||||
File.open("#{V8_Source}/.applied_patches", File::RDWR|File::CREAT) do |f|
|
||||
available_patches = Dir.glob('patches/*.patch').sort
|
||||
applied_patches = f.readlines.map(&:chomp)
|
||||
|
||||
(available_patches - applied_patches).each do |patch|
|
||||
sh "patch -p1 -N -d vendor/v8 < #{patch}"
|
||||
f.puts patch
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "compile v8 via the ruby extension mechanism"
|
||||
task :compile => :patch do
|
||||
task :compile do
|
||||
sh "ruby ext/libv8/extconf.rb"
|
||||
end
|
||||
|
||||
|
@ -103,4 +89,4 @@ task :vulcan => directory("tmp/vulcan") do
|
|||
end
|
||||
|
||||
task :default => [:checkout, :compile, :spec]
|
||||
task :build => [:clean, :checkout, :patch]
|
||||
task :build => [:clean, :checkout]
|
||||
|
|
|
@ -34,6 +34,8 @@ module Libv8
|
|||
def build_libv8!
|
||||
Dir.chdir(File.expand_path '../../../vendor/v8', __FILE__) do
|
||||
setup_python!
|
||||
setup_build_deps!
|
||||
apply_patches!
|
||||
print_build_info
|
||||
puts `env CXX=#{compiler} LINK=#{compiler} #{make} #{make_flags}`
|
||||
end
|
||||
|
@ -54,6 +56,25 @@ module Libv8
|
|||
end
|
||||
end
|
||||
|
||||
def setup_build_deps!
|
||||
# This uses the Git mirror of the svn repository used by
|
||||
# "make dependencies", instead of calling that make target
|
||||
`rm -rf build/gyp`
|
||||
`ln -fs #{File.expand_path '../../../vendor/gyp', __FILE__} build/gyp`
|
||||
end
|
||||
|
||||
def apply_patches!
|
||||
File.open(".applied_patches", File::RDWR|File::CREAT) do |f|
|
||||
available_patches = Dir.glob(File.expand_path '../../../patches/*.patch', __FILE__).sort
|
||||
applied_patches = f.readlines.map(&:chomp)
|
||||
|
||||
(available_patches - applied_patches).each do |patch|
|
||||
`patch -p1 -N < #{patch}`
|
||||
f.puts patch
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def python_version
|
||||
|
|
|
@ -21,6 +21,9 @@ Gem::Specification.new do |s|
|
|||
`git ls-files`.split("\n").reject {|f| f =~ /^out/}.map {|f| "vendor/v8/#{f}"}
|
||||
end
|
||||
s.files += Dir['vendor/v8/build/**/*']
|
||||
s.files += Dir.chdir("vendor/gyp") do
|
||||
`git ls-files`.split("\n").map {|f| "vendor/gyp/#{f}"}
|
||||
end
|
||||
|
||||
s.extensions = ["ext/libv8/extconf.rb"]
|
||||
s.require_paths = ["lib", "ext"]
|
||||
|
|
Loading…
Reference in a new issue