2011-05-24 14:17:58 -04:00
|
|
|
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
|
|
|
|
|
2011-05-25 16:41:01 -04:00
|
|
|
desc "Get the latest source"
|
|
|
|
task "fetch" do
|
|
|
|
puts "Fetching latest from github..."
|
|
|
|
if File.exist? File.join('lib', 'libv8', 'v8') then
|
|
|
|
Dir.chdir(File.join('lib', 'libv8', 'v8')) do
|
|
|
|
`git fetch`
|
|
|
|
`git checkout tags/#{`git tag`.split.last}`
|
|
|
|
end
|
|
|
|
else
|
|
|
|
`git clone https://github.com/v8/v8.git lib/libv8/v8`
|
|
|
|
Dir.chdir(File.join('lib', 'libv8', 'v8')) do
|
|
|
|
`git checkout tags/#{`git tag`.split.last}`
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-05-24 14:17:58 -04:00
|
|
|
desc "Compile the V8 JavaScript engine"
|
|
|
|
task "compile" do
|
2011-05-25 16:41:01 -04:00
|
|
|
puts "Compiling V8..."
|
2011-05-24 14:17:58 -04:00
|
|
|
Dir.chdir(File.join('lib', 'libv8')) do
|
|
|
|
`make`
|
2011-05-25 16:41:01 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Clean up from the build"
|
|
|
|
task "clean" do
|
|
|
|
Dir.chdir(File.join('lib', 'libv8')) do
|
|
|
|
`make clean`
|
2011-05-24 14:17:58 -04:00
|
|
|
end
|
2011-05-25 16:41:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Create a binary gem for this current platform"
|
|
|
|
task "binary" => "compile" do
|
|
|
|
gemspec = eval(File.read('libv8.gemspec'))
|
|
|
|
gemspec.extensions.clear
|
|
|
|
gemspec.platform = Gem::Platform.new(RUBY_PLATFORM)
|
2011-05-27 15:02:35 -04:00
|
|
|
gemspec.files << "lib/libv8/build/v8/libv8.a"
|
2011-05-25 16:41:01 -04:00
|
|
|
FileUtils.mkdir_p 'pkg'
|
|
|
|
FileUtils.mv(Gem::Builder.new(gemspec).build, 'pkg')
|
2011-05-24 14:17:58 -04:00
|
|
|
end
|