diff --git a/Rakefile b/Rakefile index da65fc4..db6a1a0 100644 --- a/Rakefile +++ b/Rakefile @@ -7,6 +7,7 @@ RSpec::Core::RakeTask.new(:spec) V8_Version = Libv8::VERSION.gsub(/\.\d$/,'') V8_Source = File.expand_path '../vendor/v8', __FILE__ +desc "setup the vendored v8 source to correspond to the libv8 gem version and prepare deps" task :checkout do sh "git submodule update --init" Dir.chdir(V8_Source) do @@ -16,7 +17,14 @@ task :checkout do end end +desc "compile v8 via the ruby extension mechanism" 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 Dir.chdir(V8_Source) do puts "compiling libv8" sh "make native GYP_GENERATORS=make" @@ -41,6 +49,7 @@ end desc "clean up artifacts of the build" task :clean do sh "rm -rf pkg" + sh "git clean -df" sh "cd #{V8_Source} && git clean -dxf" end diff --git a/ext/libv8/extconf.rb b/ext/libv8/extconf.rb index 7400f3e..1232e00 100644 --- a/ext/libv8/extconf.rb +++ b/ext/libv8/extconf.rb @@ -1,5 +1,4 @@ require 'mkmf' -require 'pathname' create_makefile('libv8') Dir.chdir(File.expand_path '../../../vendor/v8', __FILE__) do diff --git a/lib/libv8.rb b/lib/libv8.rb index d46ab8c..0a7657b 100644 --- a/lib/libv8.rb +++ b/lib/libv8.rb @@ -1,5 +1,3 @@ -require 'pathname' - require 'libv8/version' module Libv8 @@ -7,7 +5,12 @@ module Libv8 module_function def libv8(name) - File.expand_path "../../vendor/v8/out/native/libv8_#{name}.a", __FILE__ + path = File.expand_path "../../vendor/v8/out/native/libv8_#{name}.a", __FILE__ + if File.exists? path + path + else + File.expand_path "../../vendor/v8/out/native/obj.target/tools/gyp/libv8_#{name}.a", __FILE__ + end end def libv8_base