1
0
Fork 0
mirror of https://github.com/rubyjs/libv8 synced 2023-03-27 23:21:48 -04:00
libv8/Rakefile

58 lines
1.5 KiB
Text
Raw Normal View History

2011-05-24 14:17:58 -04:00
require 'bundler/setup'
Bundler::GemHelper.install_tasks
2012-04-25 23:46:30 -04:00
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
2011-05-24 14:17:58 -04:00
2012-04-25 23:46:30 -04:00
V8_Version = Libv8::VERSION.gsub(/\.\d$/,'')
V8_Source = File.expand_path '../vendor/v8', __FILE__
2011-05-24 14:17:58 -04:00
desc "setup the vendored v8 source to correspond to the libv8 gem version and prepare deps"
2012-04-25 23:46:30 -04:00
task :checkout do
sh "git submodule update --init"
Dir.chdir(V8_Source) do
sh "git fetch"
sh "git checkout #{V8_Version}"
2012-04-26 10:52:47 -04:00
sh "make dependencies"
2011-05-25 16:41:01 -04:00
end
end
desc "compile v8 via the ruby extension mechanism"
2012-04-25 23:46:30 -04:00
task :compile do
sh "ruby ext/libv8/extconf.rb"
end
desc "manually invoke the GYP compile. Useful for seeing debug output"
task :manual_compile do
2012-05-01 17:47:07 -04:00
require File.expand_path '../ext/libv8/arch.rb', __FILE__
include Libv8::Arch
2012-04-25 23:46:30 -04:00
Dir.chdir(V8_Source) do
2012-05-09 16:06:57 -04:00
sh "make -j2 #{libv8_arch}.release"
2011-05-25 16:41:01 -04:00
end
end
desc "build a binary gem"
task :binary => :compile do
gemspec = eval(File.read('libv8.gemspec'))
gemspec.extensions.clear
gemspec.platform = Gem::Platform.new(RUBY_PLATFORM)
# We don't need most things for the binary
2012-05-01 18:04:47 -04:00
gemspec.files = ['lib/libv8.rb', 'ext/libv8/arch.rb', 'lib/libv8/version.rb']
# V8
gemspec.files += Dir['vendor/v8/include/*']
2012-05-01 18:04:47 -04:00
gemspec.files += Dir['vendor/v8/out/**/*.a']
FileUtils.mkdir_p 'pkg'
FileUtils.mv(Gem::Builder.new(gemspec).build, 'pkg')
end
desc "clean up artifacts of the build"
2012-04-25 23:46:30 -04:00
task :clean do
sh "rm -rf pkg"
sh "git clean -df"
2012-04-26 10:52:47 -04:00
sh "cd #{V8_Source} && git clean -dxf"
2011-06-15 16:55:18 -04:00
end
2012-04-26 10:52:47 -04:00
task :default => [:checkout, :compile, :spec]
task :build => :checkout