nokogiri 1.11.4 → 1.13.2
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 +4 -4
- data/Gemfile +2 -0
- data/LICENSE-DEPENDENCIES.md +243 -22
- data/LICENSE.md +1 -1
- data/README.md +14 -11
- data/bin/nokogiri +63 -50
- data/dependencies.yml +11 -62
- data/ext/nokogiri/depend +35 -34
- data/ext/nokogiri/extconf.rb +235 -126
- data/ext/nokogiri/gumbo.c +584 -0
- data/ext/nokogiri/{html_document.c → html4_document.c} +8 -8
- data/ext/nokogiri/{html_element_description.c → html4_element_description.c} +21 -19
- data/ext/nokogiri/{html_entity_lookup.c → html4_entity_lookup.c} +7 -7
- data/ext/nokogiri/{html_sax_parser_context.c → html4_sax_parser_context.c} +6 -5
- data/ext/nokogiri/{html_sax_push_parser.c → html4_sax_push_parser.c} +4 -4
- data/ext/nokogiri/libxml2_backwards_compat.c +30 -30
- data/ext/nokogiri/nokogiri.c +70 -38
- data/ext/nokogiri/nokogiri.h +19 -9
- data/ext/nokogiri/xml_document.c +49 -49
- data/ext/nokogiri/xml_document_fragment.c +0 -2
- data/ext/nokogiri/xml_dtd.c +2 -2
- data/ext/nokogiri/xml_element_content.c +2 -0
- data/ext/nokogiri/xml_encoding_handler.c +31 -12
- data/ext/nokogiri/xml_namespace.c +4 -2
- data/ext/nokogiri/xml_node.c +759 -439
- data/ext/nokogiri/xml_node_set.c +20 -20
- data/ext/nokogiri/xml_reader.c +39 -11
- data/ext/nokogiri/xml_sax_parser.c +6 -6
- data/ext/nokogiri/xml_sax_parser_context.c +2 -0
- data/ext/nokogiri/xml_schema.c +2 -0
- data/ext/nokogiri/xml_xpath_context.c +109 -84
- data/ext/nokogiri/xslt_stylesheet.c +109 -10
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +101 -0
- data/gumbo-parser/THANKS +27 -0
- data/gumbo-parser/src/Makefile +34 -0
- data/gumbo-parser/src/README.md +41 -0
- data/gumbo-parser/src/ascii.c +75 -0
- data/gumbo-parser/src/ascii.h +115 -0
- data/gumbo-parser/src/attribute.c +42 -0
- data/gumbo-parser/src/attribute.h +17 -0
- data/gumbo-parser/src/char_ref.c +22225 -0
- data/gumbo-parser/src/char_ref.h +29 -0
- data/gumbo-parser/src/char_ref.rl +2154 -0
- data/gumbo-parser/src/error.c +626 -0
- data/gumbo-parser/src/error.h +148 -0
- data/gumbo-parser/src/foreign_attrs.c +104 -0
- data/gumbo-parser/src/foreign_attrs.gperf +27 -0
- data/gumbo-parser/src/gumbo.h +943 -0
- data/gumbo-parser/src/insertion_mode.h +33 -0
- data/gumbo-parser/src/macros.h +91 -0
- data/gumbo-parser/src/parser.c +4875 -0
- data/gumbo-parser/src/parser.h +41 -0
- data/gumbo-parser/src/replacement.h +33 -0
- data/gumbo-parser/src/string_buffer.c +103 -0
- data/gumbo-parser/src/string_buffer.h +68 -0
- data/gumbo-parser/src/string_piece.c +48 -0
- data/gumbo-parser/src/svg_attrs.c +174 -0
- data/gumbo-parser/src/svg_attrs.gperf +77 -0
- data/gumbo-parser/src/svg_tags.c +137 -0
- data/gumbo-parser/src/svg_tags.gperf +55 -0
- data/gumbo-parser/src/tag.c +222 -0
- data/gumbo-parser/src/tag_lookup.c +382 -0
- data/gumbo-parser/src/tag_lookup.gperf +169 -0
- data/gumbo-parser/src/tag_lookup.h +13 -0
- data/gumbo-parser/src/token_buffer.c +79 -0
- data/gumbo-parser/src/token_buffer.h +71 -0
- data/gumbo-parser/src/token_type.h +17 -0
- data/gumbo-parser/src/tokenizer.c +3463 -0
- data/gumbo-parser/src/tokenizer.h +112 -0
- data/gumbo-parser/src/tokenizer_states.h +339 -0
- data/gumbo-parser/src/utf8.c +245 -0
- data/gumbo-parser/src/utf8.h +164 -0
- data/gumbo-parser/src/util.c +68 -0
- data/gumbo-parser/src/util.h +30 -0
- data/gumbo-parser/src/vector.c +111 -0
- data/gumbo-parser/src/vector.h +45 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +9 -8
- data/lib/nokogiri/css/parser.rb +361 -342
- data/lib/nokogiri/css/parser.y +250 -245
- data/lib/nokogiri/css/parser_extras.rb +20 -20
- data/lib/nokogiri/css/syntax_error.rb +2 -1
- data/lib/nokogiri/css/tokenizer.rb +4 -3
- data/lib/nokogiri/css/tokenizer.rex +3 -2
- data/lib/nokogiri/css/xpath_visitor.rb +179 -82
- data/lib/nokogiri/css.rb +49 -17
- data/lib/nokogiri/decorators/slop.rb +8 -7
- data/lib/nokogiri/extension.rb +8 -3
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +37 -27
- data/lib/nokogiri/{html → html4}/builder.rb +3 -2
- data/lib/nokogiri/{html → html4}/document.rb +88 -79
- data/lib/nokogiri/{html → html4}/document_fragment.rb +13 -9
- data/lib/nokogiri/{html → html4}/element_description.rb +2 -1
- data/lib/nokogiri/html4/element_description_defaults.rb +578 -0
- data/lib/nokogiri/{html → html4}/entity_lookup.rb +3 -2
- data/lib/nokogiri/{html → html4}/sax/parser.rb +13 -15
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/{html → html4}/sax/push_parser.rb +11 -11
- data/lib/nokogiri/html4.rb +46 -0
- data/lib/nokogiri/html5/document.rb +88 -0
- data/lib/nokogiri/html5/document_fragment.rb +83 -0
- data/lib/nokogiri/html5/node.rb +96 -0
- data/lib/nokogiri/html5.rb +477 -0
- data/lib/nokogiri/jruby/dependencies.rb +10 -9
- data/lib/nokogiri/syntax_error.rb +1 -0
- data/lib/nokogiri/version/constant.rb +2 -1
- data/lib/nokogiri/version/info.rb +30 -14
- data/lib/nokogiri/version.rb +1 -0
- data/lib/nokogiri/xml/attr.rb +5 -3
- data/lib/nokogiri/xml/attribute_decl.rb +2 -1
- data/lib/nokogiri/xml/builder.rb +69 -31
- data/lib/nokogiri/xml/cdata.rb +2 -1
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +178 -96
- data/lib/nokogiri/xml/document_fragment.rb +41 -38
- data/lib/nokogiri/xml/dtd.rb +3 -2
- data/lib/nokogiri/xml/element_content.rb +1 -0
- data/lib/nokogiri/xml/element_decl.rb +2 -1
- data/lib/nokogiri/xml/entity_decl.rb +3 -2
- data/lib/nokogiri/xml/entity_reference.rb +1 -0
- data/lib/nokogiri/xml/namespace.rb +2 -0
- data/lib/nokogiri/xml/node/save_options.rb +7 -4
- data/lib/nokogiri/xml/node.rb +516 -351
- data/lib/nokogiri/xml/node_set.rb +46 -54
- data/lib/nokogiri/xml/notation.rb +12 -0
- data/lib/nokogiri/xml/parse_options.rb +12 -6
- data/lib/nokogiri/xml/pp/character_data.rb +8 -6
- data/lib/nokogiri/xml/pp/node.rb +24 -26
- data/lib/nokogiri/xml/pp.rb +3 -2
- data/lib/nokogiri/xml/processing_instruction.rb +2 -1
- data/lib/nokogiri/xml/reader.rb +17 -19
- data/lib/nokogiri/xml/relax_ng.rb +1 -0
- data/lib/nokogiri/xml/sax/document.rb +44 -49
- data/lib/nokogiri/xml/sax/parser.rb +36 -34
- data/lib/nokogiri/xml/sax/parser_context.rb +7 -3
- data/lib/nokogiri/xml/sax/push_parser.rb +5 -5
- data/lib/nokogiri/xml/sax.rb +5 -4
- data/lib/nokogiri/xml/schema.rb +7 -6
- data/lib/nokogiri/xml/searchable.rb +93 -62
- data/lib/nokogiri/xml/syntax_error.rb +4 -4
- data/lib/nokogiri/xml/text.rb +1 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
- data/lib/nokogiri/xml/xpath.rb +13 -1
- data/lib/nokogiri/xml/xpath_context.rb +2 -3
- data/lib/nokogiri/xml.rb +36 -37
- data/lib/nokogiri/xslt/stylesheet.rb +2 -1
- data/lib/nokogiri/xslt.rb +28 -20
- data/lib/nokogiri.rb +48 -43
- data/lib/xsd/xmlparser/nokogiri.rb +25 -24
- data/patches/libxml2/0004-use-glibc-strlen.patch +3 -3
- data/patches/libxml2/0006-update-automake-files-for-arm64.patch +2443 -1914
- data/patches/libxml2/0008-htmlParseComment-handle-abruptly-closed-comments.patch +61 -0
- data/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
- data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2445 -1919
- data/ports/archives/libxml2-2.9.13.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.35.tar.xz +0 -0
- metadata +198 -83
- data/lib/nokogiri/html/element_description_defaults.rb +0 -672
- data/lib/nokogiri/html/sax/parser_context.rb +0 -17
- data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +0 -19
- data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
data/ext/nokogiri/extconf.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
# rubocop:disable Style/GlobalVars
|
4
|
+
|
5
|
+
ENV["RC_ARCHS"] = "" if RUBY_PLATFORM.include?("darwin")
|
3
6
|
|
4
7
|
require "mkmf"
|
5
8
|
require "rbconfig"
|
@@ -8,20 +11,18 @@ require "shellwords"
|
|
8
11
|
require "pathname"
|
9
12
|
|
10
13
|
# helpful constants
|
11
|
-
PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__),
|
14
|
+
PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
12
15
|
REQUIRED_LIBXML_VERSION = "2.6.21"
|
13
16
|
RECOMMENDED_LIBXML_VERSION = "2.9.3"
|
14
17
|
|
15
|
-
#
|
16
|
-
# Keep this version in sync with the one in the Rakefile !
|
17
|
-
REQUIRED_MINI_PORTILE_VERSION = "~> 2.5.0"
|
18
|
+
REQUIRED_MINI_PORTILE_VERSION = "~> 2.8.0" # keep this version in sync with the one in the gemspec
|
18
19
|
REQUIRED_PKG_CONFIG_VERSION = "~> 1.1"
|
19
20
|
|
20
21
|
# Keep track of what versions of what libraries we build against
|
21
22
|
OTHER_LIBRARY_VERSIONS = {}
|
22
23
|
|
23
24
|
NOKOGIRI_HELP_MESSAGE = <<~HELP
|
24
|
-
USAGE: ruby #{$
|
25
|
+
USAGE: ruby #{$PROGRAM_NAME} [options]
|
25
26
|
|
26
27
|
Flags that are always valid:
|
27
28
|
|
@@ -91,6 +92,9 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
91
92
|
--with-xml2-include=DIRECTORY
|
92
93
|
Look for xml2 headers in DIRECTORY.
|
93
94
|
|
95
|
+
--with-xml2-source-dir=DIRECTORY
|
96
|
+
(dev only) Build libxml2 from the source code in DIRECTORY
|
97
|
+
|
94
98
|
|
95
99
|
Related to libxslt:
|
96
100
|
|
@@ -103,6 +107,9 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
103
107
|
--with-xslt-include=DIRECTORY
|
104
108
|
Look for xslt headers in DIRECTORY.
|
105
109
|
|
110
|
+
--with-xslt-source-dir=DIRECTORY
|
111
|
+
(dev only) Build libxslt from the source code in DIRECTORY
|
112
|
+
|
106
113
|
|
107
114
|
Related to libexslt:
|
108
115
|
|
@@ -150,7 +157,7 @@ HELP
|
|
150
157
|
# utility functions
|
151
158
|
#
|
152
159
|
def config_clean?
|
153
|
-
enable_config(
|
160
|
+
enable_config("clean", true)
|
154
161
|
end
|
155
162
|
|
156
163
|
def config_static?
|
@@ -164,28 +171,28 @@ end
|
|
164
171
|
|
165
172
|
def config_system_libraries?
|
166
173
|
enable_config("system-libraries", ENV.key?("NOKOGIRI_USE_SYSTEM_LIBRARIES")) do |_, default|
|
167
|
-
arg_config(
|
174
|
+
arg_config("--use-system-libraries", default)
|
168
175
|
end
|
169
176
|
end
|
170
177
|
|
171
178
|
def windows?
|
172
|
-
RbConfig::CONFIG[
|
179
|
+
RbConfig::CONFIG["target_os"].match?(/mingw|mswin/)
|
173
180
|
end
|
174
181
|
|
175
182
|
def solaris?
|
176
|
-
RbConfig::CONFIG[
|
183
|
+
RbConfig::CONFIG["target_os"].include?("solaris")
|
177
184
|
end
|
178
185
|
|
179
186
|
def darwin?
|
180
|
-
RbConfig::CONFIG[
|
187
|
+
RbConfig::CONFIG["target_os"].include?("darwin")
|
181
188
|
end
|
182
189
|
|
183
190
|
def openbsd?
|
184
|
-
RbConfig::CONFIG[
|
191
|
+
RbConfig::CONFIG["target_os"].include?("openbsd")
|
185
192
|
end
|
186
193
|
|
187
194
|
def aix?
|
188
|
-
RbConfig::CONFIG["target_os"]
|
195
|
+
RbConfig::CONFIG["target_os"].include?("aix")
|
189
196
|
end
|
190
197
|
|
191
198
|
def nix?
|
@@ -193,7 +200,7 @@ def nix?
|
|
193
200
|
end
|
194
201
|
|
195
202
|
def truffle?
|
196
|
-
::RUBY_ENGINE ==
|
203
|
+
::RUBY_ENGINE == "truffleruby"
|
197
204
|
end
|
198
205
|
|
199
206
|
def concat_flags(*args)
|
@@ -204,6 +211,18 @@ def local_have_library(lib, func = nil, headers = nil)
|
|
204
211
|
have_library(lib, func, headers) || have_library("lib#{lib}", func, headers)
|
205
212
|
end
|
206
213
|
|
214
|
+
def gnome_source
|
215
|
+
# As of 2022-02-20, some mirrors have expired SSL certificates. I'm able to retrieve from my home,
|
216
|
+
# but whatever host is resolved on the github actions workers see an expired cert.
|
217
|
+
#
|
218
|
+
# See https://github.com/sparklemotion/nokogiri/runs/5266206403?check_suite_focus=true
|
219
|
+
if ENV["NOKOGIRI_USE_CANONICAL_GNOME_SOURCE"]
|
220
|
+
"https://download.gnome.org"
|
221
|
+
else
|
222
|
+
"https://mirror.csclub.uwaterloo.ca/gnome" # old reliable
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
207
226
|
LOCAL_PACKAGE_RESPONSE = Object.new
|
208
227
|
def LOCAL_PACKAGE_RESPONSE.%(package)
|
209
228
|
package ? "yes: #{package}" : "no"
|
@@ -222,9 +241,9 @@ def try_package_configuration(pc)
|
|
222
241
|
# let's fall back to the pkg-config gem, which knows how to parse .pc files, and wrap it with the
|
223
242
|
# same logic as MakeMakefile#pkg_config
|
224
243
|
begin
|
225
|
-
require
|
226
|
-
gem(
|
227
|
-
require
|
244
|
+
require "rubygems"
|
245
|
+
gem("pkg-config", REQUIRED_PKG_CONFIG_VERSION)
|
246
|
+
require "pkg-config"
|
228
247
|
|
229
248
|
checking_for("#{pc} using pkg-config gem version #{PKGConfig::VERSION}", LOCAL_PACKAGE_RESPONSE) do
|
230
249
|
if PKGConfig.have_package(pc)
|
@@ -278,17 +297,16 @@ ensure
|
|
278
297
|
end
|
279
298
|
|
280
299
|
def abort_could_not_find_library(lib)
|
281
|
-
|
300
|
+
callers = caller(1..2).join("\n")
|
301
|
+
abort("-----\n#{callers}\n#{lib} is missing. Please locate mkmf.log to investigate how it is failing.\n-----")
|
282
302
|
end
|
283
303
|
|
284
|
-
def chdir_for_build
|
304
|
+
def chdir_for_build(&block)
|
285
305
|
# When using rake-compiler-dock on Windows, the underlying Virtualbox shared
|
286
306
|
# folders don't support symlinks, but libiconv expects it for a build on
|
287
307
|
# Linux. We work around this limitation by using the temp dir for cooking.
|
288
|
-
build_dir = ENV[
|
289
|
-
Dir.chdir(build_dir)
|
290
|
-
yield
|
291
|
-
end
|
308
|
+
build_dir = /mingw|mswin|cygwin/.match?(ENV["RCD_HOST_RUBY_PLATFORM"].to_s) ? "/tmp" : "."
|
309
|
+
Dir.chdir(build_dir, &block)
|
292
310
|
end
|
293
311
|
|
294
312
|
def sh_export_path(path)
|
@@ -339,8 +357,8 @@ def have_libxml_headers?(version = nil)
|
|
339
357
|
end
|
340
358
|
|
341
359
|
def try_link_iconv(using = nil)
|
342
|
-
checking_for(using ? "iconv using #{using}" :
|
343
|
-
[
|
360
|
+
checking_for(using ? "iconv using #{using}" : "iconv") do
|
361
|
+
["", "-liconv"].any? do |opt|
|
344
362
|
preserving_globals do
|
345
363
|
yield if block_given?
|
346
364
|
|
@@ -371,22 +389,22 @@ def iconv_configure_flags
|
|
371
389
|
end
|
372
390
|
|
373
391
|
return [
|
374
|
-
|
375
|
-
*("CPPFLAGS=#{idirs.map { |dir|
|
376
|
-
*("LDFLAGS=#{ldirs.map { |dir|
|
392
|
+
"--with-iconv=yes",
|
393
|
+
*("CPPFLAGS=#{idirs.map { |dir| "-I" + dir }.join(" ")}" if idirs),
|
394
|
+
*("LDFLAGS=#{ldirs.map { |dir| "-L" + dir }.join(" ")}" if ldirs),
|
377
395
|
]
|
378
396
|
end
|
379
397
|
|
380
398
|
if try_link_iconv
|
381
|
-
return [
|
399
|
+
return ["--with-iconv=yes"]
|
382
400
|
end
|
383
401
|
|
384
|
-
config = preserving_globals { have_package_configuration(
|
385
|
-
if config && try_link_iconv(
|
402
|
+
config = preserving_globals { have_package_configuration("libiconv") }
|
403
|
+
if config && try_link_iconv("pkg-config libiconv") { have_package_configuration("libiconv") }
|
386
404
|
cflags, ldflags, libs = config
|
387
405
|
|
388
406
|
return [
|
389
|
-
|
407
|
+
"--with-iconv=yes",
|
390
408
|
"CPPFLAGS=#{cflags}",
|
391
409
|
"LDFLAGS=#{ldflags}",
|
392
410
|
"LIBS=#{libs}",
|
@@ -396,23 +414,26 @@ def iconv_configure_flags
|
|
396
414
|
abort_could_not_find_library("libiconv")
|
397
415
|
end
|
398
416
|
|
399
|
-
def process_recipe(name, version, static_p, cross_p)
|
400
|
-
require
|
401
|
-
gem(
|
402
|
-
require
|
417
|
+
def process_recipe(name, version, static_p, cross_p, cacheable_p = true)
|
418
|
+
require "rubygems"
|
419
|
+
gem("mini_portile2", REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time
|
420
|
+
require "mini_portile2"
|
403
421
|
message("Using mini_portile version #{MiniPortile::VERSION}\n")
|
404
422
|
|
405
|
-
|
423
|
+
unless ["libxml2", "libxslt"].include?(name)
|
406
424
|
OTHER_LIBRARY_VERSIONS[name] = version
|
407
425
|
end
|
408
426
|
|
409
427
|
MiniPortile.new(name, version).tap do |recipe|
|
410
|
-
recipe.
|
411
|
-
|
412
|
-
|
428
|
+
def recipe.port_path
|
429
|
+
"#{@target}/#{RUBY_PLATFORM}/#{@name}/#{@version}"
|
430
|
+
end
|
431
|
+
|
432
|
+
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports") if cacheable_p
|
433
|
+
# Prefer host_alias over host in order to use the correct compiler prefix for cross build, but
|
434
|
+
# use host if not set.
|
413
435
|
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
414
|
-
recipe.
|
415
|
-
recipe.configure_options << "--libdir=#{File.join(recipe.path, 'lib')}"
|
436
|
+
recipe.configure_options << "--libdir=#{File.join(recipe.path, "lib")}"
|
416
437
|
|
417
438
|
yield recipe
|
418
439
|
|
@@ -456,10 +477,10 @@ def process_recipe(name, version, static_p, cross_p)
|
|
456
477
|
]
|
457
478
|
end
|
458
479
|
|
459
|
-
if RbConfig::CONFIG[
|
460
|
-
|
461
|
-
unless env[key].include?(
|
462
|
-
env[key] = concat_flags(env[key], RbConfig::CONFIG[
|
480
|
+
if RbConfig::CONFIG["target_cpu"] == "universal"
|
481
|
+
["CFLAGS", "LDFLAGS"].each do |key|
|
482
|
+
unless env[key].include?("-arch")
|
483
|
+
env[key] = concat_flags(env[key], RbConfig::CONFIG["ARCH_FLAG"])
|
463
484
|
end
|
464
485
|
end
|
465
486
|
end
|
@@ -468,8 +489,8 @@ def process_recipe(name, version, static_p, cross_p)
|
|
468
489
|
"#{key}=#{value.strip}"
|
469
490
|
end
|
470
491
|
|
471
|
-
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{
|
472
|
-
if File.exist?(checkpoint)
|
492
|
+
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{RUBY_PLATFORM}.installed"
|
493
|
+
if File.exist?(checkpoint) && !recipe.source_directory
|
473
494
|
message("Building Nokogiri with a packaged version of #{name}-#{version}.\n")
|
474
495
|
else
|
475
496
|
message(<<~EOM)
|
@@ -482,11 +503,11 @@ def process_recipe(name, version, static_p, cross_p)
|
|
482
503
|
message("The following patches are being applied:\n")
|
483
504
|
|
484
505
|
recipe.patch_files.each do |patch|
|
485
|
-
message(" - %s\n"
|
506
|
+
message(format(" - %s\n", File.basename(patch)))
|
486
507
|
end
|
487
508
|
end
|
488
509
|
|
489
|
-
message(<<~EOM)
|
510
|
+
message(<<~EOM) if name != "libgumbo"
|
490
511
|
|
491
512
|
The Nokogiri maintainers intend to provide timely security updates, but if
|
492
513
|
this is a concern for you and want to use your OS/distro system library
|
@@ -497,15 +518,14 @@ def process_recipe(name, version, static_p, cross_p)
|
|
497
518
|
|
498
519
|
EOM
|
499
520
|
|
500
|
-
message(<<~EOM) if name ==
|
501
|
-
Note, however, that nokogiri cannot guarantee
|
521
|
+
message(<<~EOM) if name == "libxml2"
|
522
|
+
Note, however, that nokogiri cannot guarantee compatibility with every
|
502
523
|
version of libxml2 that may be provided by OS/package vendors.
|
503
524
|
|
504
525
|
EOM
|
505
526
|
|
506
|
-
|
507
|
-
|
508
|
-
end
|
527
|
+
pp(recipe.files)
|
528
|
+
chdir_for_build { recipe.cook }
|
509
529
|
FileUtils.touch(checkpoint)
|
510
530
|
end
|
511
531
|
recipe.activate
|
@@ -516,7 +536,7 @@ def copy_packaged_libraries_headers(to_path:, from_recipes:)
|
|
516
536
|
FileUtils.rm_rf(to_path, secure: true)
|
517
537
|
FileUtils.mkdir(to_path)
|
518
538
|
from_recipes.each do |recipe|
|
519
|
-
FileUtils.cp_r(Dir[File.join(recipe.path,
|
539
|
+
FileUtils.cp_r(Dir[File.join(recipe.path, "include/*")], to_path)
|
520
540
|
end
|
521
541
|
end
|
522
542
|
|
@@ -530,22 +550,22 @@ def do_clean
|
|
530
550
|
pwd = Pathname(Dir.pwd)
|
531
551
|
|
532
552
|
# Skip if this is a development work tree
|
533
|
-
unless (root +
|
553
|
+
unless (root + ".git").exist?
|
534
554
|
message("Cleaning files only used during build.\n")
|
535
555
|
|
536
556
|
# (root + 'tmp') cannot be removed at this stage because
|
537
557
|
# nokogiri.so is yet to be copied to lib.
|
538
558
|
|
539
559
|
# clean the ports build directory
|
540
|
-
Pathname.glob(pwd.join(
|
560
|
+
Pathname.glob(pwd.join("tmp", "*", "ports")) do |dir|
|
541
561
|
FileUtils.rm_rf(dir, verbose: true)
|
542
562
|
end
|
543
563
|
|
544
564
|
if config_static?
|
545
565
|
# ports installation can be safely removed if statically linked.
|
546
|
-
FileUtils.rm_rf(root +
|
566
|
+
FileUtils.rm_rf(root + "ports", verbose: true)
|
547
567
|
else
|
548
|
-
FileUtils.rm_rf(root +
|
568
|
+
FileUtils.rm_rf(root + "ports" + "archives", verbose: true)
|
549
569
|
end
|
550
570
|
end
|
551
571
|
|
@@ -555,25 +575,25 @@ end
|
|
555
575
|
#
|
556
576
|
# main
|
557
577
|
#
|
558
|
-
do_help if arg_config(
|
559
|
-
do_clean if arg_config(
|
578
|
+
do_help if arg_config("--help")
|
579
|
+
do_clean if arg_config("--clean")
|
560
580
|
|
561
581
|
if openbsd? && !config_system_libraries?
|
562
|
-
if %x(#{ENV[
|
563
|
-
(ENV[
|
582
|
+
if %x(#{ENV["CC"] || "/usr/bin/cc"} -v 2>&1) !~ /clang/
|
583
|
+
(ENV["CC"] ||= find_executable("egcc")) ||
|
564
584
|
abort("Please install gcc 4.9+ from ports using `pkg_add -v gcc`")
|
565
585
|
end
|
566
586
|
append_cppflags "-I/usr/local/include"
|
567
587
|
end
|
568
588
|
|
569
|
-
if ENV[
|
570
|
-
RbConfig::CONFIG[
|
589
|
+
if ENV["CC"]
|
590
|
+
RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"]
|
571
591
|
end
|
572
592
|
|
573
593
|
# use same c compiler for libxml and libxslt
|
574
|
-
ENV[
|
594
|
+
ENV["CC"] = RbConfig::CONFIG["CC"]
|
575
595
|
|
576
|
-
if arg_config(
|
596
|
+
if arg_config("--prevent-strip")
|
577
597
|
old_cflags = $CFLAGS.split.join(" ")
|
578
598
|
old_ldflags = $LDFLAGS.split.join(" ")
|
579
599
|
old_dldflags = $DLDFLAGS.split.join(" ")
|
@@ -591,6 +611,10 @@ append_cppflags(ENV["CPPFLAGS"].split) unless ENV["CPPFLAGS"].nil?
|
|
591
611
|
append_ldflags(ENV["LDFLAGS"].split) unless ENV["LDFLAGS"].nil?
|
592
612
|
$LIBS = concat_flags($LIBS, ENV["LIBS"])
|
593
613
|
|
614
|
+
# nokogumbo code uses C90/C99 features, let's make sure older compilers won't give
|
615
|
+
# errors/warnings. see #2302
|
616
|
+
append_cflags(["-std=c99", "-Wno-declaration-after-statement"])
|
617
|
+
|
594
618
|
# always include debugging information
|
595
619
|
append_cflags("-g")
|
596
620
|
|
@@ -619,13 +643,13 @@ append_cppflags(' "-Idummypath"') if windows?
|
|
619
643
|
if config_system_libraries?
|
620
644
|
message "Building nokogiri using system libraries.\n"
|
621
645
|
ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
|
622
|
-
|
646
|
+
headers: "zlib.h", func: "gzdopen")
|
623
647
|
ensure_package_configuration(opt: "xml2", pc: "libxml-2.0", lib: "xml2",
|
624
|
-
|
648
|
+
headers: "libxml/parser.h", func: "xmlParseDoc")
|
625
649
|
ensure_package_configuration(opt: "xslt", pc: "libxslt", lib: "xslt",
|
626
|
-
|
650
|
+
headers: "libxslt/xslt.h", func: "xsltParseStylesheetDoc")
|
627
651
|
ensure_package_configuration(opt: "exslt", pc: "libexslt", lib: "exslt",
|
628
|
-
|
652
|
+
headers: "libexslt/exslt.h", func: "exsltFuncRegister")
|
629
653
|
|
630
654
|
have_libxml_headers?(REQUIRED_LIBXML_VERSION) ||
|
631
655
|
abort("ERROR: libxml2 version #{REQUIRED_LIBXML_VERSION} or later is required!")
|
@@ -636,20 +660,20 @@ else
|
|
636
660
|
message "Building nokogiri using packaged libraries.\n"
|
637
661
|
|
638
662
|
static_p = config_static?
|
639
|
-
message "Static linking is #{static_p ?
|
663
|
+
message "Static linking is #{static_p ? "enabled" : "disabled"}.\n"
|
640
664
|
|
641
665
|
cross_build_p = config_cross_build?
|
642
|
-
message "Cross build is #{cross_build_p ?
|
666
|
+
message "Cross build is #{cross_build_p ? "enabled" : "disabled"}.\n"
|
643
667
|
|
644
|
-
require
|
668
|
+
require "yaml"
|
645
669
|
dependencies = YAML.load_file(File.join(PACKAGE_ROOT_DIR, "dependencies.yml"))
|
646
670
|
|
647
|
-
dir_config(
|
671
|
+
dir_config("zlib")
|
648
672
|
|
649
673
|
if cross_build_p || windows?
|
650
674
|
zlib_recipe = process_recipe("zlib", dependencies["zlib"]["version"], static_p, cross_build_p) do |recipe|
|
651
675
|
recipe.files = [{
|
652
|
-
url: "
|
676
|
+
url: "https://zlib.net/fossils/#{recipe.name}-#{recipe.version}.tar.gz",
|
653
677
|
sha256: dependencies["zlib"]["sha256"],
|
654
678
|
}]
|
655
679
|
if windows?
|
@@ -658,8 +682,8 @@ else
|
|
658
682
|
|
659
683
|
def configure
|
660
684
|
Dir.chdir(work_path) do
|
661
|
-
mk = File.read(
|
662
|
-
File.open(
|
685
|
+
mk = File.read("win32/Makefile.gcc")
|
686
|
+
File.open("win32/Makefile.gcc", "wb") do |f|
|
663
687
|
f.puts "BINARY_PATH = #{path}/bin"
|
664
688
|
f.puts "LIBRARY_PATH = #{path}/lib"
|
665
689
|
f.puts "INCLUDE_PATH = #{path}/include"
|
@@ -671,7 +695,7 @@ else
|
|
671
695
|
|
672
696
|
def configured?
|
673
697
|
Dir.chdir(work_path) do
|
674
|
-
!!(File.read(
|
698
|
+
!!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
|
675
699
|
end
|
676
700
|
end
|
677
701
|
|
@@ -689,11 +713,11 @@ else
|
|
689
713
|
def configure
|
690
714
|
cflags = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
|
691
715
|
execute("configure",
|
692
|
-
["env", "CHOST=#{host}", "CFLAGS=#{cflags}", "./configure", "--static", configure_prefix])
|
716
|
+
["env", "CHOST=#{host}", "CFLAGS=#{cflags}", "./configure", "--static", configure_prefix])
|
693
717
|
end
|
694
718
|
|
695
719
|
def compile
|
696
|
-
if
|
720
|
+
if /darwin/.match?(host)
|
697
721
|
execute("compile", "make AR=#{host}-libtool")
|
698
722
|
else
|
699
723
|
super
|
@@ -705,15 +729,19 @@ else
|
|
705
729
|
|
706
730
|
unless nix?
|
707
731
|
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p,
|
708
|
-
cross_build_p) do |recipe|
|
732
|
+
cross_build_p) do |recipe|
|
709
733
|
recipe.files = [{
|
710
|
-
url: "
|
734
|
+
url: "https://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
|
711
735
|
sha256: dependencies["libiconv"]["sha256"],
|
712
736
|
}]
|
713
737
|
|
738
|
+
# The libiconv configure script doesn't accept "arm64" host string but "aarch64"
|
739
|
+
recipe.host = recipe.host.gsub("arm64-apple-darwin", "aarch64-apple-darwin")
|
740
|
+
|
714
741
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
715
742
|
|
716
743
|
recipe.configure_options += [
|
744
|
+
"--disable-dependency-tracking",
|
717
745
|
"CPPFLAGS=-Wall",
|
718
746
|
"CFLAGS=#{cflags}",
|
719
747
|
"CXXFLAGS=#{cflags}",
|
@@ -721,7 +749,7 @@ cross_build_p) do |recipe|
|
|
721
749
|
]
|
722
750
|
end
|
723
751
|
end
|
724
|
-
elsif darwin? && !have_header(
|
752
|
+
elsif darwin? && !have_header("iconv.h")
|
725
753
|
abort(<<~EOM.chomp)
|
726
754
|
-----
|
727
755
|
The file "iconv.h" is missing in your build environment,
|
@@ -733,25 +761,40 @@ cross_build_p) do |recipe|
|
|
733
761
|
Tools" to open the developer site, download the installer for your OS
|
734
762
|
version and run it.
|
735
763
|
-----
|
736
|
-
|
764
|
+
EOM
|
737
765
|
end
|
738
766
|
|
739
|
-
|
740
|
-
|
741
|
-
|
767
|
+
if zlib_recipe
|
768
|
+
append_cppflags("-I#{zlib_recipe.path}/include")
|
769
|
+
$LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH
|
770
|
+
ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
|
771
|
+
headers: "zlib.h", func: "gzdopen")
|
772
|
+
end
|
773
|
+
|
774
|
+
if libiconv_recipe
|
775
|
+
append_cppflags("-I#{libiconv_recipe.path}/include")
|
776
|
+
$LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH
|
777
|
+
ensure_package_configuration(opt: "iconv", pc: "iconv", lib: "iconv",
|
778
|
+
headers: "iconv.h", func: "iconv_open")
|
742
779
|
end
|
743
780
|
|
744
781
|
libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"]["version"], static_p, cross_build_p) do |recipe|
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
782
|
+
source_dir = arg_config("--with-xml2-source-dir")
|
783
|
+
if source_dir
|
784
|
+
recipe.source_directory = source_dir
|
785
|
+
else
|
786
|
+
minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
|
787
|
+
recipe.files = [{
|
788
|
+
url: "#{gnome_source}/sources/libxml2/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
|
789
|
+
sha256: dependencies["libxml2"]["sha256"],
|
790
|
+
}]
|
791
|
+
recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxml2", "*.patch")].sort
|
792
|
+
end
|
749
793
|
|
750
794
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
751
795
|
|
752
796
|
if zlib_recipe
|
753
797
|
recipe.configure_options << "--with-zlib=#{zlib_recipe.path}"
|
754
|
-
cflags = concat_flags(cflags, "-I#{zlib_recipe.path}/include")
|
755
798
|
end
|
756
799
|
|
757
800
|
if libiconv_recipe
|
@@ -768,6 +811,12 @@ cross_build_p) do |recipe|
|
|
768
811
|
cflags = concat_flags(cflags, "-ULIBXML_STATIC", "-DIN_LIBXML")
|
769
812
|
end
|
770
813
|
|
814
|
+
recipe.configure_options << if source_dir
|
815
|
+
"--config-cache"
|
816
|
+
else
|
817
|
+
"--disable-dependency-tracking"
|
818
|
+
end
|
819
|
+
|
771
820
|
recipe.configure_options += [
|
772
821
|
"--without-python",
|
773
822
|
"--without-readline",
|
@@ -779,10 +828,17 @@ cross_build_p) do |recipe|
|
|
779
828
|
end
|
780
829
|
|
781
830
|
libxslt_recipe = process_recipe("libxslt", dependencies["libxslt"]["version"], static_p, cross_build_p) do |recipe|
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
831
|
+
source_dir = arg_config("--with-xslt-source-dir")
|
832
|
+
if source_dir
|
833
|
+
recipe.source_directory = source_dir
|
834
|
+
else
|
835
|
+
minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
|
836
|
+
recipe.files = [{
|
837
|
+
url: "#{gnome_source}/sources/libxslt/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
|
838
|
+
sha256: dependencies["libxslt"]["sha256"],
|
839
|
+
}]
|
840
|
+
recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxslt", "*.patch")].sort
|
841
|
+
end
|
786
842
|
|
787
843
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
788
844
|
|
@@ -790,6 +846,12 @@ cross_build_p) do |recipe|
|
|
790
846
|
recipe.configure_options += ["RANLIB=/usr/bin/ranlib", "AR=/usr/bin/ar"]
|
791
847
|
end
|
792
848
|
|
849
|
+
recipe.configure_options << if source_dir
|
850
|
+
"--config-cache"
|
851
|
+
else
|
852
|
+
"--disable-dependency-tracking"
|
853
|
+
end
|
854
|
+
|
793
855
|
recipe.configure_options += [
|
794
856
|
"--without-python",
|
795
857
|
"--without-crypto",
|
@@ -802,20 +864,17 @@ cross_build_p) do |recipe|
|
|
802
864
|
append_cppflags("-DNOKOGIRI_PACKAGED_LIBRARIES")
|
803
865
|
append_cppflags("-DNOKOGIRI_PRECOMPILED_LIBRARIES") if cross_build_p
|
804
866
|
|
805
|
-
$LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH if zlib_recipe
|
806
|
-
$LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH if libiconv_recipe
|
807
|
-
|
808
867
|
$libs = $libs.shellsplit.tap do |libs|
|
809
868
|
[libxml2_recipe, libxslt_recipe].each do |recipe|
|
810
869
|
libname = recipe.name[/\Alib(.+)\z/, 1]
|
811
870
|
File.join(recipe.path, "bin", "#{libname}-config").tap do |config|
|
812
871
|
# call config scripts explicit with 'sh' for compat with Windows
|
813
|
-
$CPPFLAGS = %x(sh #{config} --cflags).strip <<
|
872
|
+
$CPPFLAGS = %x(sh #{config} --cflags).strip << " " << $CPPFLAGS
|
814
873
|
%x(sh #{config} --libs).strip.shellsplit.each do |arg|
|
815
874
|
case arg
|
816
875
|
when /\A-L(.+)\z/
|
817
876
|
# Prioritize ports' directories
|
818
|
-
$LIBPATH = if Regexp.last_match(1).start_with?(PACKAGE_ROOT_DIR +
|
877
|
+
$LIBPATH = if Regexp.last_match(1).start_with?(PACKAGE_ROOT_DIR + "/")
|
819
878
|
[Regexp.last_match(1)] | $LIBPATH
|
820
879
|
else
|
821
880
|
$LIBPATH | [Regexp.last_match(1)]
|
@@ -823,26 +882,26 @@ cross_build_p) do |recipe|
|
|
823
882
|
when /\A-l./
|
824
883
|
libs.unshift(arg)
|
825
884
|
else
|
826
|
-
$LDFLAGS <<
|
885
|
+
$LDFLAGS << " " << arg.shellescape
|
827
886
|
end
|
828
887
|
end
|
829
888
|
end
|
830
889
|
|
831
|
-
patches_string = recipe.patch_files.map { |path| File.basename(path) }.join(
|
890
|
+
patches_string = recipe.patch_files.map { |path| File.basename(path) }.join(" ")
|
832
891
|
append_cppflags(%[-DNOKOGIRI_#{recipe.name.upcase}_PATCHES="\\\"#{patches_string}\\\""])
|
833
892
|
|
834
893
|
case libname
|
835
|
-
when
|
894
|
+
when "xml2"
|
836
895
|
# xslt-config --libs or pkg-config libxslt --libs does not include
|
837
896
|
# -llzma, so we need to add it manually when linking statically.
|
838
|
-
if static_p && preserving_globals { local_have_library(
|
897
|
+
if static_p && preserving_globals { local_have_library("lzma") }
|
839
898
|
# Add it at the end; GH #988
|
840
|
-
libs <<
|
899
|
+
libs << "-llzma"
|
841
900
|
end
|
842
|
-
when
|
901
|
+
when "xslt"
|
843
902
|
# xslt-config does not have a flag to emit options including
|
844
903
|
# -lexslt, so add it manually.
|
845
|
-
libs.unshift(
|
904
|
+
libs.unshift("-lexslt")
|
846
905
|
end
|
847
906
|
end
|
848
907
|
end.shelljoin
|
@@ -850,10 +909,10 @@ cross_build_p) do |recipe|
|
|
850
909
|
if static_p
|
851
910
|
$libs = $libs.shellsplit.map do |arg|
|
852
911
|
case arg
|
853
|
-
when
|
854
|
-
File.join(libxml2_recipe.path,
|
855
|
-
when
|
856
|
-
File.join(libxslt_recipe.path,
|
912
|
+
when "-lxml2"
|
913
|
+
File.join(libxml2_recipe.path, "lib", libflag_to_filename(arg))
|
914
|
+
when "-lxslt", "-lexslt"
|
915
|
+
File.join(libxslt_recipe.path, "lib", libflag_to_filename(arg))
|
857
916
|
else
|
858
917
|
arg
|
859
918
|
end
|
@@ -865,14 +924,64 @@ cross_build_p) do |recipe|
|
|
865
924
|
ensure_func("exsltFuncRegister", "libexslt/exslt.h")
|
866
925
|
end
|
867
926
|
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
927
|
+
libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_build_p, false) do |recipe|
|
928
|
+
recipe.configure_options = []
|
929
|
+
|
930
|
+
class << recipe
|
931
|
+
def downloaded?
|
932
|
+
true
|
933
|
+
end
|
934
|
+
|
935
|
+
def extract
|
936
|
+
target = File.join(tmp_path, "gumbo-parser")
|
937
|
+
output("Copying gumbo-parser files into #{target}...")
|
938
|
+
FileUtils.mkdir_p(target)
|
939
|
+
FileUtils.cp(Dir.glob(File.join(PACKAGE_ROOT_DIR, "gumbo-parser/src/*")), target)
|
940
|
+
end
|
941
|
+
|
942
|
+
def configured?
|
943
|
+
true
|
944
|
+
end
|
945
|
+
|
946
|
+
def install
|
947
|
+
lib_dir = File.join(port_path, "lib")
|
948
|
+
inc_dir = File.join(port_path, "include")
|
949
|
+
FileUtils.mkdir_p([lib_dir, inc_dir])
|
950
|
+
FileUtils.cp(File.join(work_path, "libgumbo.a"), lib_dir)
|
951
|
+
FileUtils.cp(Dir.glob(File.join(work_path, "*.h")), inc_dir)
|
952
|
+
end
|
953
|
+
|
954
|
+
def compile
|
955
|
+
cflags = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
|
956
|
+
|
957
|
+
env = { "CC" => gcc_cmd, "CFLAGS" => cflags }
|
958
|
+
if config_cross_build?
|
959
|
+
if /darwin/.match?(host)
|
960
|
+
env["AR"] = "#{host}-libtool"
|
961
|
+
env["ARFLAGS"] = "-o"
|
962
|
+
else
|
963
|
+
env["AR"] = "#{host}-ar"
|
964
|
+
end
|
965
|
+
env["RANLIB"] = "#{host}-ranlib"
|
966
|
+
end
|
967
|
+
|
968
|
+
execute("compile", make_cmd, { env: env })
|
969
|
+
end
|
970
|
+
end
|
971
|
+
end
|
972
|
+
append_cppflags("-I#{File.join(libgumbo_recipe.path, "include")}")
|
973
|
+
$libs = $libs + " " + File.join(libgumbo_recipe.path, "lib", "libgumbo.a")
|
974
|
+
$LIBPATH = $LIBPATH | [File.join(libgumbo_recipe.path, "lib")]
|
975
|
+
ensure_func("gumbo_parse_with_options", "gumbo.h")
|
976
|
+
|
977
|
+
have_func("xmlHasFeature") || abort("xmlHasFeature() is missing.") # introduced in libxml 2.6.21
|
978
|
+
have_func("xmlFirstElementChild") # introduced in libxml 2.7.3
|
979
|
+
have_func("xmlRelaxNGSetParserStructuredErrors") # introduced in libxml 2.6.24
|
980
|
+
have_func("xmlRelaxNGSetValidStructuredErrors") # introduced in libxml 2.6.21
|
981
|
+
have_func("xmlSchemaSetValidStructuredErrors") # introduced in libxml 2.6.23
|
982
|
+
have_func("xmlSchemaSetParserStructuredErrors") # introduced in libxml 2.6.23
|
874
983
|
|
875
|
-
have_func(
|
984
|
+
have_func("vasprintf")
|
876
985
|
|
877
986
|
other_library_versions_string = OTHER_LIBRARY_VERSIONS.map { |k, v| [k, v].join(":") }.join(",")
|
878
987
|
append_cppflags(%[-DNOKOGIRI_OTHER_LIBRARY_VERSIONS="\\\"#{other_library_versions_string}\\\""])
|
@@ -882,25 +991,25 @@ unless config_system_libraries?
|
|
882
991
|
# When precompiling native gems, copy packaged libraries' headers to ext/nokogiri/include
|
883
992
|
# These are packaged up by the cross-compiling callback in the ExtensionTask
|
884
993
|
copy_packaged_libraries_headers(to_path: File.join(PACKAGE_ROOT_DIR, "ext/nokogiri/include"),
|
885
|
-
|
994
|
+
from_recipes: [libxml2_recipe, libxslt_recipe])
|
886
995
|
else
|
887
996
|
# When compiling during installation, install packaged libraries' header files into ext/nokogiri/include
|
888
997
|
copy_packaged_libraries_headers(to_path: "include",
|
889
|
-
|
998
|
+
from_recipes: [libxml2_recipe, libxslt_recipe])
|
890
999
|
$INSTALLFILES << ["include/**/*.h", "$(rubylibdir)"]
|
891
1000
|
end
|
892
1001
|
end
|
893
1002
|
|
894
|
-
create_makefile(
|
1003
|
+
create_makefile("nokogiri/nokogiri")
|
895
1004
|
|
896
1005
|
if config_clean?
|
897
1006
|
# Do not clean if run in a development work tree.
|
898
|
-
File.open(
|
1007
|
+
File.open("Makefile", "at") do |mk|
|
899
1008
|
mk.print(<<~EOF)
|
900
1009
|
|
901
1010
|
all: clean-ports
|
902
1011
|
clean-ports: $(DLLIB)
|
903
|
-
\t-$(Q)$(RUBY) $(srcdir)/extconf.rb --clean --#{static_p ?
|
1012
|
+
\t-$(Q)$(RUBY) $(srcdir)/extconf.rb --clean --#{static_p ? "enable" : "disable"}-static
|
904
1013
|
EOF
|
905
1014
|
end
|
906
1015
|
end
|