nokogiri 1.6.2.rc1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.autotest +26 -0
- data/.editorconfig +17 -0
- data/.gemtest +0 -0
- data/.travis.yml +25 -0
- data/CHANGELOG.ja.rdoc +857 -0
- data/CHANGELOG.rdoc +880 -0
- data/C_CODING_STYLE.rdoc +33 -0
- data/Gemfile +21 -0
- data/Manifest.txt +371 -0
- data/README.ja.rdoc +112 -0
- data/README.rdoc +180 -0
- data/ROADMAP.md +89 -0
- data/Rakefile +351 -0
- data/STANDARD_RESPONSES.md +47 -0
- data/Y_U_NO_GEMSPEC.md +155 -0
- data/bin/nokogiri +78 -0
- data/build_all +130 -0
- data/dependencies.yml +4 -0
- data/ext/nokogiri/depend +358 -0
- data/ext/nokogiri/extconf.rb +453 -0
- data/ext/nokogiri/html_document.c +170 -0
- data/ext/nokogiri/html_document.h +10 -0
- data/ext/nokogiri/html_element_description.c +279 -0
- data/ext/nokogiri/html_element_description.h +10 -0
- data/ext/nokogiri/html_entity_lookup.c +32 -0
- data/ext/nokogiri/html_entity_lookup.h +8 -0
- data/ext/nokogiri/html_sax_parser_context.c +116 -0
- data/ext/nokogiri/html_sax_parser_context.h +11 -0
- data/ext/nokogiri/html_sax_push_parser.c +87 -0
- data/ext/nokogiri/html_sax_push_parser.h +9 -0
- data/ext/nokogiri/nokogiri.c +148 -0
- data/ext/nokogiri/nokogiri.h +164 -0
- data/ext/nokogiri/xml_attr.c +94 -0
- data/ext/nokogiri/xml_attr.h +9 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_attribute_decl.h +9 -0
- data/ext/nokogiri/xml_cdata.c +56 -0
- data/ext/nokogiri/xml_cdata.h +9 -0
- data/ext/nokogiri/xml_comment.c +54 -0
- data/ext/nokogiri/xml_comment.h +9 -0
- data/ext/nokogiri/xml_document.c +577 -0
- data/ext/nokogiri/xml_document.h +23 -0
- data/ext/nokogiri/xml_document_fragment.c +48 -0
- data/ext/nokogiri/xml_document_fragment.h +10 -0
- data/ext/nokogiri/xml_dtd.c +202 -0
- data/ext/nokogiri/xml_dtd.h +10 -0
- data/ext/nokogiri/xml_element_content.c +123 -0
- data/ext/nokogiri/xml_element_content.h +10 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_element_decl.h +9 -0
- data/ext/nokogiri/xml_encoding_handler.c +79 -0
- data/ext/nokogiri/xml_encoding_handler.h +8 -0
- data/ext/nokogiri/xml_entity_decl.c +110 -0
- data/ext/nokogiri/xml_entity_decl.h +10 -0
- data/ext/nokogiri/xml_entity_reference.c +52 -0
- data/ext/nokogiri/xml_entity_reference.h +9 -0
- data/ext/nokogiri/xml_io.c +56 -0
- data/ext/nokogiri/xml_io.h +11 -0
- data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
- data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
- data/ext/nokogiri/xml_namespace.c +78 -0
- data/ext/nokogiri/xml_namespace.h +13 -0
- data/ext/nokogiri/xml_node.c +1541 -0
- data/ext/nokogiri/xml_node.h +13 -0
- data/ext/nokogiri/xml_node_set.c +467 -0
- data/ext/nokogiri/xml_node_set.h +14 -0
- data/ext/nokogiri/xml_processing_instruction.c +56 -0
- data/ext/nokogiri/xml_processing_instruction.h +9 -0
- data/ext/nokogiri/xml_reader.c +681 -0
- data/ext/nokogiri/xml_reader.h +10 -0
- data/ext/nokogiri/xml_relax_ng.c +161 -0
- data/ext/nokogiri/xml_relax_ng.h +9 -0
- data/ext/nokogiri/xml_sax_parser.c +312 -0
- data/ext/nokogiri/xml_sax_parser.h +39 -0
- data/ext/nokogiri/xml_sax_parser_context.c +262 -0
- data/ext/nokogiri/xml_sax_parser_context.h +10 -0
- data/ext/nokogiri/xml_sax_push_parser.c +115 -0
- data/ext/nokogiri/xml_sax_push_parser.h +9 -0
- data/ext/nokogiri/xml_schema.c +205 -0
- data/ext/nokogiri/xml_schema.h +9 -0
- data/ext/nokogiri/xml_syntax_error.c +63 -0
- data/ext/nokogiri/xml_syntax_error.h +13 -0
- data/ext/nokogiri/xml_text.c +52 -0
- data/ext/nokogiri/xml_text.h +9 -0
- data/ext/nokogiri/xml_xpath_context.c +307 -0
- data/ext/nokogiri/xml_xpath_context.h +10 -0
- data/ext/nokogiri/xslt_stylesheet.c +270 -0
- data/ext/nokogiri/xslt_stylesheet.h +14 -0
- data/lib/nokogiri.rb +137 -0
- data/lib/nokogiri/2.0/nokogiri.so +0 -0
- data/lib/nokogiri/2.1/nokogiri.so +0 -0
- data/lib/nokogiri/css.rb +27 -0
- data/lib/nokogiri/css/node.rb +52 -0
- data/lib/nokogiri/css/parser.rb +715 -0
- data/lib/nokogiri/css/parser.y +249 -0
- data/lib/nokogiri/css/parser_extras.rb +91 -0
- data/lib/nokogiri/css/syntax_error.rb +7 -0
- data/lib/nokogiri/css/tokenizer.rb +152 -0
- data/lib/nokogiri/css/tokenizer.rex +55 -0
- data/lib/nokogiri/css/xpath_visitor.rb +219 -0
- data/lib/nokogiri/decorators/slop.rb +35 -0
- data/lib/nokogiri/html.rb +37 -0
- data/lib/nokogiri/html/builder.rb +35 -0
- data/lib/nokogiri/html/document.rb +333 -0
- data/lib/nokogiri/html/document_fragment.rb +41 -0
- data/lib/nokogiri/html/element_description.rb +23 -0
- data/lib/nokogiri/html/element_description_defaults.rb +671 -0
- data/lib/nokogiri/html/entity_lookup.rb +13 -0
- data/lib/nokogiri/html/sax/parser.rb +52 -0
- data/lib/nokogiri/html/sax/parser_context.rb +16 -0
- data/lib/nokogiri/html/sax/push_parser.rb +16 -0
- data/lib/nokogiri/syntax_error.rb +4 -0
- data/lib/nokogiri/version.rb +106 -0
- data/lib/nokogiri/xml.rb +73 -0
- data/lib/nokogiri/xml/attr.rb +14 -0
- data/lib/nokogiri/xml/attribute_decl.rb +18 -0
- data/lib/nokogiri/xml/builder.rb +443 -0
- data/lib/nokogiri/xml/cdata.rb +11 -0
- data/lib/nokogiri/xml/character_data.rb +7 -0
- data/lib/nokogiri/xml/document.rb +279 -0
- data/lib/nokogiri/xml/document_fragment.rb +112 -0
- data/lib/nokogiri/xml/dtd.rb +32 -0
- data/lib/nokogiri/xml/element_content.rb +36 -0
- data/lib/nokogiri/xml/element_decl.rb +13 -0
- data/lib/nokogiri/xml/entity_decl.rb +19 -0
- data/lib/nokogiri/xml/namespace.rb +13 -0
- data/lib/nokogiri/xml/node.rb +982 -0
- data/lib/nokogiri/xml/node/save_options.rb +61 -0
- data/lib/nokogiri/xml/node_set.rb +355 -0
- data/lib/nokogiri/xml/notation.rb +6 -0
- data/lib/nokogiri/xml/parse_options.rb +98 -0
- data/lib/nokogiri/xml/pp.rb +2 -0
- data/lib/nokogiri/xml/pp/character_data.rb +18 -0
- data/lib/nokogiri/xml/pp/node.rb +56 -0
- data/lib/nokogiri/xml/processing_instruction.rb +8 -0
- data/lib/nokogiri/xml/reader.rb +112 -0
- data/lib/nokogiri/xml/relax_ng.rb +32 -0
- data/lib/nokogiri/xml/sax.rb +4 -0
- data/lib/nokogiri/xml/sax/document.rb +171 -0
- data/lib/nokogiri/xml/sax/parser.rb +123 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +16 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +60 -0
- data/lib/nokogiri/xml/schema.rb +63 -0
- data/lib/nokogiri/xml/syntax_error.rb +47 -0
- data/lib/nokogiri/xml/text.rb +9 -0
- data/lib/nokogiri/xml/xpath.rb +10 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +11 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xslt.rb +56 -0
- data/lib/nokogiri/xslt/stylesheet.rb +25 -0
- data/lib/xsd/xmlparser/nokogiri.rb +102 -0
- data/suppressions/README.txt +1 -0
- data/suppressions/nokogiri_ree-1.8.7.358.supp +61 -0
- data/suppressions/nokogiri_ruby-1.8.7.370.supp +0 -0
- data/suppressions/nokogiri_ruby-1.9.2.320.supp +28 -0
- data/suppressions/nokogiri_ruby-1.9.3.327.supp +28 -0
- data/tasks/nokogiri.org.rb +24 -0
- data/tasks/test.rb +95 -0
- data/test/css/test_nthiness.rb +222 -0
- data/test/css/test_parser.rb +358 -0
- data/test/css/test_tokenizer.rb +198 -0
- data/test/css/test_xpath_visitor.rb +96 -0
- data/test/decorators/test_slop.rb +16 -0
- data/test/files/2ch.html +108 -0
- data/test/files/address_book.rlx +12 -0
- data/test/files/address_book.xml +10 -0
- data/test/files/atom.xml +344 -0
- data/test/files/bar/bar.xsd +4 -0
- data/test/files/bogus.xml +0 -0
- data/test/files/dont_hurt_em_why.xml +422 -0
- data/test/files/encoding.html +82 -0
- data/test/files/encoding.xhtml +84 -0
- data/test/files/exslt.xml +8 -0
- data/test/files/exslt.xslt +35 -0
- data/test/files/foo/foo.xsd +4 -0
- data/test/files/metacharset.html +10 -0
- data/test/files/noencoding.html +47 -0
- data/test/files/po.xml +32 -0
- data/test/files/po.xsd +66 -0
- data/test/files/saml/saml20assertion_schema.xsd +283 -0
- data/test/files/saml/saml20protocol_schema.xsd +302 -0
- data/test/files/saml/xenc_schema.xsd +146 -0
- data/test/files/saml/xmldsig_schema.xsd +318 -0
- data/test/files/shift_jis.html +10 -0
- data/test/files/shift_jis.xml +5 -0
- data/test/files/shift_jis_no_charset.html +9 -0
- data/test/files/snuggles.xml +3 -0
- data/test/files/staff.dtd +10 -0
- data/test/files/staff.xml +59 -0
- data/test/files/staff.xslt +32 -0
- data/test/files/test_document_url/bar.xml +2 -0
- data/test/files/test_document_url/document.dtd +4 -0
- data/test/files/test_document_url/document.xml +6 -0
- data/test/files/tlm.html +850 -0
- data/test/files/to_be_xincluded.xml +2 -0
- data/test/files/valid_bar.xml +2 -0
- data/test/files/xinclude.xml +4 -0
- data/test/helper.rb +164 -0
- data/test/html/sax/test_parser.rb +141 -0
- data/test/html/sax/test_parser_context.rb +46 -0
- data/test/html/test_builder.rb +164 -0
- data/test/html/test_document.rb +619 -0
- data/test/html/test_document_encoding.rb +148 -0
- data/test/html/test_document_fragment.rb +261 -0
- data/test/html/test_element_description.rb +105 -0
- data/test/html/test_named_characters.rb +14 -0
- data/test/html/test_node.rb +196 -0
- data/test/html/test_node_encoding.rb +27 -0
- data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +14 -0
- data/test/namespaces/test_namespaces_in_builder_doc.rb +75 -0
- data/test/namespaces/test_namespaces_in_cloned_doc.rb +31 -0
- data/test/namespaces/test_namespaces_in_created_doc.rb +75 -0
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +66 -0
- data/test/test_convert_xpath.rb +135 -0
- data/test/test_css_cache.rb +45 -0
- data/test/test_encoding_handler.rb +46 -0
- data/test/test_memory_leak.rb +156 -0
- data/test/test_nokogiri.rb +138 -0
- data/test/test_reader.rb +558 -0
- data/test/test_soap4r_sax.rb +52 -0
- data/test/test_xslt_transforms.rb +279 -0
- data/test/xml/node/test_save_options.rb +28 -0
- data/test/xml/node/test_subclass.rb +44 -0
- data/test/xml/sax/test_parser.rb +382 -0
- data/test/xml/sax/test_parser_context.rb +115 -0
- data/test/xml/sax/test_push_parser.rb +157 -0
- data/test/xml/test_attr.rb +64 -0
- data/test/xml/test_attribute_decl.rb +86 -0
- data/test/xml/test_builder.rb +315 -0
- data/test/xml/test_c14n.rb +161 -0
- data/test/xml/test_cdata.rb +48 -0
- data/test/xml/test_comment.rb +29 -0
- data/test/xml/test_document.rb +934 -0
- data/test/xml/test_document_encoding.rb +28 -0
- data/test/xml/test_document_fragment.rb +228 -0
- data/test/xml/test_dtd.rb +187 -0
- data/test/xml/test_dtd_encoding.rb +33 -0
- data/test/xml/test_element_content.rb +56 -0
- data/test/xml/test_element_decl.rb +73 -0
- data/test/xml/test_entity_decl.rb +122 -0
- data/test/xml/test_entity_reference.rb +245 -0
- data/test/xml/test_namespace.rb +95 -0
- data/test/xml/test_node.rb +1155 -0
- data/test/xml/test_node_attributes.rb +113 -0
- data/test/xml/test_node_encoding.rb +107 -0
- data/test/xml/test_node_inheritance.rb +32 -0
- data/test/xml/test_node_reparenting.rb +374 -0
- data/test/xml/test_node_set.rb +755 -0
- data/test/xml/test_parse_options.rb +64 -0
- data/test/xml/test_processing_instruction.rb +30 -0
- data/test/xml/test_reader_encoding.rb +142 -0
- data/test/xml/test_relax_ng.rb +60 -0
- data/test/xml/test_schema.rb +129 -0
- data/test/xml/test_syntax_error.rb +12 -0
- data/test/xml/test_text.rb +45 -0
- data/test/xml/test_unparented_node.rb +422 -0
- data/test/xml/test_xinclude.rb +83 -0
- data/test/xml/test_xpath.rb +376 -0
- data/test/xslt/test_custom_functions.rb +133 -0
- data/test/xslt/test_exception_handling.rb +37 -0
- data/test_all +81 -0
- metadata +601 -0
@@ -0,0 +1,453 @@
|
|
1
|
+
ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/
|
2
|
+
|
3
|
+
# Available options:
|
4
|
+
#
|
5
|
+
# --enable-clean (default)
|
6
|
+
# --disable-clean
|
7
|
+
#
|
8
|
+
# --enable-static (default)
|
9
|
+
# --disable-static
|
10
|
+
#
|
11
|
+
# --with-iconv-dir=DIR
|
12
|
+
#
|
13
|
+
# --with-zlib-dir=DIR
|
14
|
+
#
|
15
|
+
# --use-system-libraries
|
16
|
+
# --with-xml2-dir=DIR / --with-xml2-config=CONFIG
|
17
|
+
# --with-xslt-dir=DIR / --with-xslt-config=CONFIG
|
18
|
+
# --with-exslt-dir=DIR / --with-exslt-config=CONFIG
|
19
|
+
#
|
20
|
+
# --enable-cross-build
|
21
|
+
|
22
|
+
# :stopdoc:
|
23
|
+
|
24
|
+
require 'mkmf'
|
25
|
+
|
26
|
+
def message!(important_message)
|
27
|
+
message important_message
|
28
|
+
if !$stdout.tty? && File.chardev?('/dev/tty')
|
29
|
+
File.open('/dev/tty', 'w') { |tty|
|
30
|
+
tty.print important_message
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
36
|
+
|
37
|
+
ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
38
|
+
# Workaround for Ruby bug #8074, introduced in Ruby 2.0.0, fixed in Ruby 2.1.0
|
39
|
+
# https://bugs.ruby-lang.org/issues/8074
|
40
|
+
@libdir_basename = "lib"
|
41
|
+
|
42
|
+
if arg_config('--clean')
|
43
|
+
require 'pathname'
|
44
|
+
require 'fileutils'
|
45
|
+
|
46
|
+
root = Pathname(ROOT)
|
47
|
+
pwd = Pathname(Dir.pwd)
|
48
|
+
|
49
|
+
# Skip if this is a development work tree
|
50
|
+
unless (root + '.git').exist?
|
51
|
+
message "Cleaning files only used during build.\n"
|
52
|
+
|
53
|
+
# (root + 'tmp') cannot be removed at this stage because
|
54
|
+
# nokogiri.so is yet to be copied to lib.
|
55
|
+
|
56
|
+
# clean the ports build directory
|
57
|
+
Pathname.glob(pwd.join('tmp', '*', 'ports')) { |dir|
|
58
|
+
FileUtils.rm_rf(dir, verbose: true)
|
59
|
+
FileUtils.rmdir(dir.parent, parents: true, verbose: true)
|
60
|
+
}
|
61
|
+
|
62
|
+
if enable_config('static')
|
63
|
+
# ports installation can be safely removed if statically linked.
|
64
|
+
FileUtils.rm_rf(root + 'ports', verbose: true)
|
65
|
+
else
|
66
|
+
FileUtils.rm_rf(root + 'ports' + 'archives', verbose: true)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
exit
|
71
|
+
end
|
72
|
+
|
73
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'macruby'
|
74
|
+
$LIBRUBYARG_STATIC.gsub!(/-static/, '')
|
75
|
+
end
|
76
|
+
|
77
|
+
$CFLAGS << " #{ENV["CFLAGS"]}"
|
78
|
+
$LIBS << " #{ENV["LIBS"]}"
|
79
|
+
|
80
|
+
def preserving_globals
|
81
|
+
values = [
|
82
|
+
$arg_config,
|
83
|
+
$CFLAGS, $CPPFLAGS,
|
84
|
+
$LDFLAGS, $LIBPATH, $libs
|
85
|
+
].map(&:dup)
|
86
|
+
yield
|
87
|
+
ensure
|
88
|
+
$arg_config,
|
89
|
+
$CFLAGS, $CPPFLAGS,
|
90
|
+
$LDFLAGS, $LIBPATH, $libs =
|
91
|
+
values
|
92
|
+
end
|
93
|
+
|
94
|
+
def asplode(lib)
|
95
|
+
abort "-----\n#{lib} is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.\n-----"
|
96
|
+
end
|
97
|
+
|
98
|
+
def have_iconv?
|
99
|
+
have_header('iconv.h') or return false
|
100
|
+
%w{ iconv_open libiconv_open }.any? do |method|
|
101
|
+
have_func(method, 'iconv.h') or
|
102
|
+
have_library('iconv', method, 'iconv.h')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def each_iconv_idir
|
107
|
+
# If --with-iconv-dir or --with-opt-dir is given, it should be
|
108
|
+
# the first priority
|
109
|
+
%w[iconv opt].each { |config|
|
110
|
+
idir = preserving_globals {
|
111
|
+
dir_config(config)
|
112
|
+
}.first and yield idir
|
113
|
+
}
|
114
|
+
|
115
|
+
# Try the system default
|
116
|
+
yield "/usr/include"
|
117
|
+
|
118
|
+
cflags, = preserving_globals {
|
119
|
+
pkg_config('libiconv')
|
120
|
+
}
|
121
|
+
if cflags
|
122
|
+
cflags.shellsplit.each { |arg|
|
123
|
+
arg.sub!(/\A-I/, '') and
|
124
|
+
yield arg
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
nil
|
129
|
+
end
|
130
|
+
|
131
|
+
def iconv_prefix
|
132
|
+
# Make sure libxml2 is built with iconv
|
133
|
+
each_iconv_idir { |idir|
|
134
|
+
prefix = %r{\A(.+)?/include\z} === idir && $1 or next
|
135
|
+
File.exist?(File.join(idir, 'iconv.h')) or next
|
136
|
+
preserving_globals {
|
137
|
+
# Follow the way libxml2's configure uses a value given with
|
138
|
+
# --with-iconv[=DIR]
|
139
|
+
$CPPFLAGS = "-I#{idir} " << $CPPFLAGS
|
140
|
+
$LIBPATH.unshift(File.join(prefix, "lib"))
|
141
|
+
have_iconv?
|
142
|
+
} and break prefix
|
143
|
+
} or asplode "libiconv"
|
144
|
+
end
|
145
|
+
|
146
|
+
def process_recipe(name, version, static_p, cross_p)
|
147
|
+
MiniPortile.new(name, version).tap do |recipe|
|
148
|
+
recipe.target = portsdir = File.join(ROOT, "ports")
|
149
|
+
# Prefer host_alias over host in order to use i586-mingw32msvc as
|
150
|
+
# correct compiler prefix for cross build, but use host if not set.
|
151
|
+
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
152
|
+
recipe.patch_files = Dir[File.join(portsdir, "patches", name, "*.patch")].sort
|
153
|
+
|
154
|
+
if static_p
|
155
|
+
recipe.configure_options = [
|
156
|
+
"--disable-shared",
|
157
|
+
"--enable-static",
|
158
|
+
"CFLAGS='-fPIC #{ENV["CFLAGS"]}'",
|
159
|
+
]
|
160
|
+
else
|
161
|
+
recipe.configure_options = [
|
162
|
+
"--enable-shared",
|
163
|
+
"--disable-static",
|
164
|
+
]
|
165
|
+
end
|
166
|
+
|
167
|
+
if cross_p
|
168
|
+
recipe.configure_options += [
|
169
|
+
"--target=#{recipe.host}",
|
170
|
+
"--host=#{recipe.host}",
|
171
|
+
]
|
172
|
+
end
|
173
|
+
|
174
|
+
yield recipe
|
175
|
+
|
176
|
+
if recipe.patch_files.empty?
|
177
|
+
message! "Building #{name}-#{version} for nokogiri.\n"
|
178
|
+
else
|
179
|
+
message! "Building #{name}-#{version} for nokogiri with the following patches applied:\n"
|
180
|
+
|
181
|
+
recipe.patch_files.each { |patch|
|
182
|
+
message! "\t- %s\n" % File.basename(patch)
|
183
|
+
}
|
184
|
+
end
|
185
|
+
|
186
|
+
message! <<-"EOS"
|
187
|
+
************************************************************************
|
188
|
+
IMPORTANT! Nokogiri builds and uses a packaged version of #{name}.
|
189
|
+
|
190
|
+
If this is a concern for you and you want to use the system library
|
191
|
+
instead, abort this installation process and reinstall nokogiri as
|
192
|
+
follows:
|
193
|
+
|
194
|
+
gem install nokogiri -- --use-system-libraries
|
195
|
+
|
196
|
+
If you are using Bundler, tell it to use the option:
|
197
|
+
|
198
|
+
bundle config build.nokogiri --use-system-libraries
|
199
|
+
bundle install
|
200
|
+
EOS
|
201
|
+
|
202
|
+
message! <<-"EOS" if name == 'libxml2'
|
203
|
+
|
204
|
+
However, note that nokogiri does not necessarily support all versions
|
205
|
+
of libxml2.
|
206
|
+
|
207
|
+
For example, libxml2-2.9.0 and higher are currently known to be broken
|
208
|
+
and thus unsupported by nokogiri, due to compatibility problems and
|
209
|
+
XPath optimization bugs.
|
210
|
+
EOS
|
211
|
+
|
212
|
+
message! <<-"EOS"
|
213
|
+
************************************************************************
|
214
|
+
EOS
|
215
|
+
|
216
|
+
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
217
|
+
unless File.exist?(checkpoint)
|
218
|
+
recipe.cook
|
219
|
+
FileUtils.touch checkpoint
|
220
|
+
end
|
221
|
+
recipe.activate
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
windows_p = RbConfig::CONFIG['target_os'] == 'mingw32' || RbConfig::CONFIG['target_os'] =~ /mswin/
|
226
|
+
|
227
|
+
if windows_p
|
228
|
+
$CFLAGS << " -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF"
|
229
|
+
elsif RbConfig::CONFIG['target_os'] =~ /solaris/
|
230
|
+
$CFLAGS << " -DUSE_INCLUDED_VASPRINTF"
|
231
|
+
else
|
232
|
+
$CFLAGS << " -g -DXP_UNIX"
|
233
|
+
end
|
234
|
+
|
235
|
+
if RUBY_PLATFORM =~ /mingw/i
|
236
|
+
# Work around a character escaping bug in MSYS by passing an arbitrary
|
237
|
+
# double quoted parameter to gcc. See https://sourceforge.net/p/mingw/bugs/2142
|
238
|
+
$CPPFLAGS << ' "-Idummypath"'
|
239
|
+
end
|
240
|
+
|
241
|
+
if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
|
242
|
+
$CFLAGS << " -O3" unless $CFLAGS[/-O\d/]
|
243
|
+
$CFLAGS << " -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline"
|
244
|
+
end
|
245
|
+
|
246
|
+
case
|
247
|
+
when arg_config('--use-system-libraries', !!ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'])
|
248
|
+
message! "Building nokogiri using system libraries.\n"
|
249
|
+
|
250
|
+
dir_config('zlib')
|
251
|
+
|
252
|
+
# Using system libraries means we rely on the system libxml2 with
|
253
|
+
# regard to the iconv support.
|
254
|
+
|
255
|
+
dir_config('xml2').any? || pkg_config('libxml-2.0')
|
256
|
+
dir_config('xslt').any? || pkg_config('libxslt')
|
257
|
+
dir_config('exslt').any? || pkg_config('libexslt')
|
258
|
+
else
|
259
|
+
message! "Building nokogiri using packaged libraries.\n"
|
260
|
+
|
261
|
+
require 'mini_portile'
|
262
|
+
require 'yaml'
|
263
|
+
|
264
|
+
static_p = enable_config('static', true) or
|
265
|
+
message! "Static linking is disabled.\n"
|
266
|
+
|
267
|
+
dir_config('zlib')
|
268
|
+
|
269
|
+
dependencies = YAML.load_file(File.join(ROOT, "dependencies.yml"))
|
270
|
+
|
271
|
+
cross_build_p = enable_config("cross-build")
|
272
|
+
if cross_build_p || windows_p
|
273
|
+
zlib_recipe = process_recipe("zlib", dependencies["zlib"], static_p, cross_build_p) do |recipe|
|
274
|
+
recipe.files = ["http://zlib.net/#{recipe.name}-#{recipe.version}.tar.gz"]
|
275
|
+
class << recipe
|
276
|
+
attr_accessor :cross_build_p
|
277
|
+
|
278
|
+
def configure
|
279
|
+
Dir.chdir work_path do
|
280
|
+
mk = File.read 'win32/Makefile.gcc'
|
281
|
+
File.open 'win32/Makefile.gcc', 'wb' do |f|
|
282
|
+
f.puts "BINARY_PATH = #{path}/bin"
|
283
|
+
f.puts "LIBRARY_PATH = #{path}/lib"
|
284
|
+
f.puts "INCLUDE_PATH = #{path}/include"
|
285
|
+
mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-") if cross_build_p
|
286
|
+
f.puts mk
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
def configured?
|
292
|
+
Dir.chdir work_path do
|
293
|
+
!! (File.read('win32/Makefile.gcc') =~ /^BINARY_PATH/)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
def compile
|
298
|
+
execute "compile", "make -f win32/Makefile.gcc"
|
299
|
+
end
|
300
|
+
|
301
|
+
def install
|
302
|
+
execute "install", "make -f win32/Makefile.gcc install"
|
303
|
+
end
|
304
|
+
end
|
305
|
+
recipe.cross_build_p = cross_build_p
|
306
|
+
end
|
307
|
+
|
308
|
+
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"], static_p, cross_build_p) do |recipe|
|
309
|
+
recipe.files = ["http://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz"]
|
310
|
+
recipe.configure_options += [
|
311
|
+
"CPPFLAGS='-Wall'",
|
312
|
+
"CFLAGS='-O2 -g'",
|
313
|
+
"CXXFLAGS='-O2 -g'",
|
314
|
+
"LDFLAGS="
|
315
|
+
]
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"], static_p, cross_build_p) do |recipe|
|
320
|
+
recipe.files = ["ftp://ftp.xmlsoft.org/libxml2/#{recipe.name}-#{recipe.version}.tar.gz"]
|
321
|
+
recipe.configure_options += [
|
322
|
+
"--without-python",
|
323
|
+
"--without-readline",
|
324
|
+
"--with-iconv=#{libiconv_recipe ? libiconv_recipe.path : iconv_prefix}",
|
325
|
+
"--with-c14n",
|
326
|
+
"--with-debug",
|
327
|
+
"--with-threads"
|
328
|
+
]
|
329
|
+
end
|
330
|
+
|
331
|
+
libxslt_recipe = process_recipe("libxslt", dependencies["libxslt"], static_p, cross_build_p) do |recipe|
|
332
|
+
recipe.files = ["ftp://ftp.xmlsoft.org/libxml2/#{recipe.name}-#{recipe.version}.tar.gz"]
|
333
|
+
recipe.configure_options += [
|
334
|
+
"--without-python",
|
335
|
+
"--without-crypto",
|
336
|
+
"--with-debug",
|
337
|
+
"--with-libxml-prefix=#{libxml2_recipe.path}"
|
338
|
+
]
|
339
|
+
end
|
340
|
+
|
341
|
+
$CFLAGS << ' ' << '-DNOKOGIRI_USE_PACKAGED_LIBRARIES'
|
342
|
+
$LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH if zlib_recipe
|
343
|
+
$LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH if libiconv_recipe
|
344
|
+
|
345
|
+
have_lzma = preserving_globals {
|
346
|
+
have_library('lzma')
|
347
|
+
}
|
348
|
+
|
349
|
+
$libs = $libs.shellsplit.tap { |libs|
|
350
|
+
[libxml2_recipe, libxslt_recipe].each { |recipe|
|
351
|
+
libname = recipe.name[/\Alib(.+)\z/, 1]
|
352
|
+
File.join(recipe.path, "bin", "#{libname}-config").tap { |config|
|
353
|
+
# call config scripts explicit with 'sh' for compat with Windows
|
354
|
+
$CPPFLAGS = `sh #{config} --cflags`.strip << ' ' << $CPPFLAGS
|
355
|
+
`sh #{config} --libs`.strip.shellsplit.each { |arg|
|
356
|
+
case arg
|
357
|
+
when /\A-L(.+)\z/
|
358
|
+
# Prioritize ports' directories
|
359
|
+
if $1.start_with?(ROOT + '/')
|
360
|
+
$LIBPATH = [$1] | $LIBPATH
|
361
|
+
else
|
362
|
+
$LIBPATH = $LIBPATH | [$1]
|
363
|
+
end
|
364
|
+
when /\A-l./
|
365
|
+
libs.unshift(arg)
|
366
|
+
else
|
367
|
+
$LDFLAGS << ' ' << arg.shellescape
|
368
|
+
end
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
$CPPFLAGS << ' ' << "-DNOKOGIRI_#{recipe.name.upcase}_PATH=\"#{recipe.path}\"".shellescape
|
373
|
+
|
374
|
+
case libname
|
375
|
+
when 'xml2'
|
376
|
+
# xslt-config --libs or pkg-config libxslt --libs does not include
|
377
|
+
# -llzma, so we need to add it manually when linking statically.
|
378
|
+
if static_p && have_lzma
|
379
|
+
# Add it at the end; GH #988
|
380
|
+
libs << '-llzma'
|
381
|
+
end
|
382
|
+
when 'xslt'
|
383
|
+
# xslt-config does not have a flag to emit options including
|
384
|
+
# -lexslt, so add it manually.
|
385
|
+
libs.unshift('-lexslt')
|
386
|
+
end
|
387
|
+
}
|
388
|
+
}.shelljoin
|
389
|
+
|
390
|
+
if static_p
|
391
|
+
message 'checking for linker flags for static linking... '
|
392
|
+
|
393
|
+
case
|
394
|
+
when try_link('int main(void) { return 0; }',
|
395
|
+
['-Wl,-Bstatic', '-lxml2', '-Wl,-Bdynamic'].shelljoin)
|
396
|
+
message "-Wl,-Bstatic\n"
|
397
|
+
|
398
|
+
$libs = $libs.shellsplit.flat_map { |arg|
|
399
|
+
case arg
|
400
|
+
when '-lxml2', '-lxslt', '-lexslt'
|
401
|
+
['-Wl,-Bstatic', arg, '-Wl,-Bdynamic']
|
402
|
+
else
|
403
|
+
arg
|
404
|
+
end
|
405
|
+
}.shelljoin
|
406
|
+
else
|
407
|
+
message "NONE\n"
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
{
|
413
|
+
"xml2" => ['xmlParseDoc', 'libxml/parser.h'],
|
414
|
+
"xslt" => ['xsltParseStylesheetDoc', 'libxslt/xslt.h'],
|
415
|
+
"exslt" => ['exsltFuncRegister', 'libexslt/exslt.h'],
|
416
|
+
}.each { |lib, (func, header)|
|
417
|
+
have_func(func, header) || have_library(lib, func, header) || have_library("lib#{lib}", func, header) or asplode("lib#{lib}")
|
418
|
+
}
|
419
|
+
|
420
|
+
unless have_func('xmlHasFeature')
|
421
|
+
abort "-----\nThe function 'xmlHasFeature' is missing from your installation of libxml2. Likely this means that your installed version of libxml2 is old enough that nokogiri will not work well. To get around this problem, please upgrade your installation of libxml2.
|
422
|
+
|
423
|
+
Please visit http://nokogiri.org/tutorials/installing_nokogiri.html for more help!"
|
424
|
+
end
|
425
|
+
|
426
|
+
have_func 'xmlFirstElementChild'
|
427
|
+
have_func('xmlRelaxNGSetParserStructuredErrors')
|
428
|
+
have_func('xmlRelaxNGSetParserStructuredErrors')
|
429
|
+
have_func('xmlRelaxNGSetValidStructuredErrors')
|
430
|
+
have_func('xmlSchemaSetValidStructuredErrors')
|
431
|
+
have_func('xmlSchemaSetParserStructuredErrors')
|
432
|
+
|
433
|
+
if ENV['CPUPROFILE']
|
434
|
+
unless find_library('profiler', 'ProfilerEnable', *LIB_DIRS)
|
435
|
+
abort "google performance tools are not installed"
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
create_makefile('nokogiri/nokogiri')
|
440
|
+
|
441
|
+
if enable_config('clean', true)
|
442
|
+
# Do not clean if run in a development work tree.
|
443
|
+
File.open('Makefile', 'at') { |mk|
|
444
|
+
mk.print <<EOF
|
445
|
+
all: clean-ports
|
446
|
+
|
447
|
+
clean-ports: $(DLLIB)
|
448
|
+
-$(Q)$(RUBY) $(srcdir)/extconf.rb --clean --#{static_p ? 'enable' : 'disable'}-static
|
449
|
+
EOF
|
450
|
+
}
|
451
|
+
end
|
452
|
+
|
453
|
+
# :startdoc:
|