Expose INCLUDEPATH and LIBS qmake variables
This allows one to specify the include and lib paths for gl and zlib. Example: gem install capybara-webkit -- \ --with-gl-dir=/nix/store/1sw1cyny213ih9dpdsq8h2kwqaqcm6vp-mesa-10.2.9 \ --with-zlib-dir=/nix/store/cb649pfdf14335d07jcfmsik7a1rsgbf-zlib-1.2.8 Fixes #695
This commit is contained in:
parent
798268f0db
commit
07976a2d78
18
extconf.rb
18
extconf.rb
|
@ -1,2 +1,20 @@
|
||||||
|
require "mkmf"
|
||||||
|
|
||||||
|
$CPPFLAGS = ""
|
||||||
|
|
||||||
|
dir_config("gl")
|
||||||
|
dir_config("zlib")
|
||||||
|
|
||||||
|
include_path = $CPPFLAGS.gsub("-I", "").strip
|
||||||
|
libs = $LIBPATH.map { |path| "-L#{path}"}.join(" ").strip
|
||||||
|
|
||||||
|
unless include_path.empty?
|
||||||
|
ENV["CAPYBARA_WEBKIT_INCLUDE_PATH"] = include_path
|
||||||
|
end
|
||||||
|
|
||||||
|
unless libs.empty?
|
||||||
|
ENV["CAPYBARA_WEBKIT_LIBS"] = libs
|
||||||
|
end
|
||||||
|
|
||||||
require File.join(File.expand_path(File.dirname(__FILE__)), "lib", "capybara_webkit_builder")
|
require File.join(File.expand_path(File.dirname(__FILE__)), "lib", "capybara_webkit_builder")
|
||||||
CapybaraWebkitBuilder.build_all
|
CapybaraWebkitBuilder.build_all
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "rbconfig"
|
require "rbconfig"
|
||||||
|
require "shellwords"
|
||||||
|
|
||||||
module CapybaraWebkitBuilder
|
module CapybaraWebkitBuilder
|
||||||
extend self
|
extend self
|
||||||
|
@ -52,8 +53,10 @@ module CapybaraWebkitBuilder
|
||||||
success
|
success
|
||||||
end
|
end
|
||||||
|
|
||||||
def makefile(config = '')
|
def makefile(*configs)
|
||||||
sh("#{qmake_bin} -spec #{spec} #{config}")
|
configs += default_configs
|
||||||
|
configs = configs.map { |config| config.shellescape}.join(" ")
|
||||||
|
sh("#{qmake_bin} -spec #{spec} #{configs}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def qmake
|
def qmake
|
||||||
|
@ -82,6 +85,19 @@ module CapybaraWebkitBuilder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_configs
|
||||||
|
configs = []
|
||||||
|
libpath = ENV["CAPYBARA_WEBKIT_LIBS"]
|
||||||
|
cppflags = ENV["CAPYBARA_WEBKIT_INCLUDE_PATH"]
|
||||||
|
if libpath
|
||||||
|
configs << "LIBS += #{libpath}"
|
||||||
|
end
|
||||||
|
if cppflags
|
||||||
|
configs << "INCLUDEPATH += #{cppflags}"
|
||||||
|
end
|
||||||
|
configs
|
||||||
|
end
|
||||||
|
|
||||||
def build_all
|
def build_all
|
||||||
makefile &&
|
makefile &&
|
||||||
qmake &&
|
qmake &&
|
||||||
|
|
Loading…
Reference in New Issue