13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'ext/nokogumbo/extconf.rb', line 13
def
begin
require 'yaml'
dependencies = YAML.load_file(File.join(NG_SPEC.gem_dir, 'dependencies.yml'))
version = dependencies['libxml2']['version']
host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
path = File.join('ports', host, 'libxml2', version, 'include/libxml2')
return path if File.directory?(path)
dep_index = NG_SPEC.dependencies.index { |dep| dep.name == 'mini_portile2' and dep.type == :runtime }
return nil if dep_index.nil?
requirement = NG_SPEC.dependencies[dep_index].requirement.to_s
gem 'mini_portile2', requirement
require 'mini_portile2'
p = MiniPortile::new('libxml2', version).tap do |r|
r.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
r.files = [{
url: "http://xmlsoft.org/sources/libxml2-#{r.version}.tar.gz",
sha256: dependencies['libxml2']['sha256']
}]
r.configure_options += [
"--without-python",
"--without-readline",
"--with-c14n",
"--with-debug",
"--with-threads"
]
end
p.download unless p.downloaded?
p.
p.configure unless p.configured?
system('make', '-C', "tmp/#{p.host}/ports/libxml2/#{version}/libxml2-#{version}/include/libxml", 'install-xmlincHEADERS')
path
rescue
puts 'failed to download/install headers'
nil
end
end
|