mirror of
https://github.com/rubyjs/libv8
synced 2023-03-27 23:21:48 -04:00
Merge pull request #161 from cstrahan/link-system-install
Properly link to the system's libv8
This commit is contained in:
commit
3b925dc882
2 changed files with 13 additions and 0 deletions
|
@ -48,6 +48,7 @@ module Libv8
|
||||||
def configure(context = MkmfContext.new)
|
def configure(context = MkmfContext.new)
|
||||||
context.send(:dir_config, 'v8')
|
context.send(:dir_config, 'v8')
|
||||||
context.send(:find_header, 'v8.h') or fail NotFoundError
|
context.send(:find_header, 'v8.h') or fail NotFoundError
|
||||||
|
context.send(:have_library, 'v8') or fail NotFoundError
|
||||||
end
|
end
|
||||||
|
|
||||||
class NotFoundError < StandardError
|
class NotFoundError < StandardError
|
||||||
|
|
|
@ -12,16 +12,28 @@ describe "libv8 locations" do
|
||||||
describe "configuring a compliation context with it" do
|
describe "configuring a compliation context with it" do
|
||||||
before do
|
before do
|
||||||
@context.stub(:find_header) {true}
|
@context.stub(:find_header) {true}
|
||||||
|
@context.stub(:have_library) {true}
|
||||||
@location.configure @context
|
@location.configure @context
|
||||||
end
|
end
|
||||||
it "adds the include path to the front of the include flags" do
|
it "adds the include path to the front of the include flags" do
|
||||||
@context.should have_received(:dir_config).with('v8').at_least(:once)
|
@context.should have_received(:dir_config).with('v8').at_least(:once)
|
||||||
@context.should have_received(:find_header).with('v8.h').at_least(:once)
|
@context.should have_received(:find_header).with('v8.h').at_least(:once)
|
||||||
|
@context.should have_received(:have_library).with('v8').at_least(:once)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe "when the v8 library cannot be found" do
|
||||||
|
before do
|
||||||
|
@context.stub(:find_header) {true}
|
||||||
|
@context.stub(:have_library) {false}
|
||||||
|
end
|
||||||
|
it "raises a NotFoundError" do
|
||||||
|
expect {@location.configure @context}.to raise_error Libv8::Location::System::NotFoundError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe "when the v8.h header cannot be found" do
|
describe "when the v8.h header cannot be found" do
|
||||||
before do
|
before do
|
||||||
@context.stub(:find_header) {false}
|
@context.stub(:find_header) {false}
|
||||||
|
@context.stub(:have_library) {true}
|
||||||
end
|
end
|
||||||
it "raises a NotFoundError" do
|
it "raises a NotFoundError" do
|
||||||
expect {@location.configure @context}.to raise_error Libv8::Location::System::NotFoundError
|
expect {@location.configure @context}.to raise_error Libv8::Location::System::NotFoundError
|
||||||
|
|
Loading…
Reference in a new issue