nokogiri 1.15.4 → 1.17.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 +12 -19
- data/README.md +8 -1
- data/dependencies.yml +9 -8
- data/ext/nokogiri/extconf.rb +194 -141
- data/ext/nokogiri/gumbo.c +69 -53
- data/ext/nokogiri/html4_document.c +10 -4
- data/ext/nokogiri/html4_element_description.c +18 -18
- data/ext/nokogiri/html4_sax_parser.c +40 -0
- data/ext/nokogiri/html4_sax_parser_context.c +48 -58
- data/ext/nokogiri/html4_sax_push_parser.c +26 -25
- data/ext/nokogiri/libxml2_polyfill.c +114 -0
- data/ext/nokogiri/nokogiri.c +9 -2
- data/ext/nokogiri/nokogiri.h +25 -33
- data/ext/nokogiri/test_global_handlers.c +1 -1
- data/ext/nokogiri/xml_attr.c +1 -1
- data/ext/nokogiri/xml_cdata.c +3 -12
- data/ext/nokogiri/xml_comment.c +3 -8
- data/ext/nokogiri/xml_document.c +167 -156
- data/ext/nokogiri/xml_document_fragment.c +10 -25
- data/ext/nokogiri/xml_dtd.c +1 -1
- data/ext/nokogiri/xml_element_content.c +9 -9
- data/ext/nokogiri/xml_encoding_handler.c +4 -4
- data/ext/nokogiri/xml_namespace.c +6 -10
- data/ext/nokogiri/xml_node.c +142 -108
- data/ext/nokogiri/xml_node_set.c +46 -44
- data/ext/nokogiri/xml_reader.c +74 -100
- data/ext/nokogiri/xml_relax_ng.c +35 -56
- data/ext/nokogiri/xml_sax_parser.c +156 -88
- data/ext/nokogiri/xml_sax_parser_context.c +214 -128
- data/ext/nokogiri/xml_sax_push_parser.c +69 -50
- data/ext/nokogiri/xml_schema.c +51 -87
- data/ext/nokogiri/xml_syntax_error.c +19 -11
- data/ext/nokogiri/xml_text.c +3 -6
- data/ext/nokogiri/xml_xpath_context.c +4 -7
- data/ext/nokogiri/xslt_stylesheet.c +16 -11
- data/gumbo-parser/Makefile +18 -0
- data/gumbo-parser/src/error.c +76 -48
- data/gumbo-parser/src/error.h +5 -1
- data/gumbo-parser/src/nokogiri_gumbo.h +11 -2
- data/gumbo-parser/src/parser.c +64 -23
- data/gumbo-parser/src/tokenizer.c +7 -6
- data/lib/nokogiri/class_resolver.rb +1 -1
- data/lib/nokogiri/css/node.rb +6 -2
- data/lib/nokogiri/css/parser.rb +6 -4
- data/lib/nokogiri/css/parser.y +2 -2
- data/lib/nokogiri/css/parser_extras.rb +6 -66
- data/lib/nokogiri/css/selector_cache.rb +38 -0
- data/lib/nokogiri/css/tokenizer.rb +4 -4
- data/lib/nokogiri/css/tokenizer.rex +9 -8
- data/lib/nokogiri/css/xpath_visitor.rb +43 -27
- data/lib/nokogiri/css.rb +86 -20
- data/lib/nokogiri/decorators/slop.rb +3 -5
- data/lib/nokogiri/encoding_handler.rb +2 -2
- data/lib/nokogiri/html4/document.rb +45 -24
- data/lib/nokogiri/html4/document_fragment.rb +124 -12
- data/lib/nokogiri/html4/encoding_reader.rb +2 -2
- data/lib/nokogiri/html4/sax/parser.rb +23 -38
- data/lib/nokogiri/html4/sax/parser_context.rb +4 -9
- data/lib/nokogiri/html4.rb +9 -14
- data/lib/nokogiri/html5/builder.rb +40 -0
- data/lib/nokogiri/html5/document.rb +61 -30
- data/lib/nokogiri/html5/document_fragment.rb +130 -20
- data/lib/nokogiri/html5/node.rb +4 -4
- data/lib/nokogiri/html5.rb +114 -138
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/version/info.rb +6 -5
- data/lib/nokogiri/xml/attr.rb +2 -2
- data/lib/nokogiri/xml/builder.rb +8 -1
- data/lib/nokogiri/xml/document.rb +74 -31
- data/lib/nokogiri/xml/document_fragment.rb +86 -15
- data/lib/nokogiri/xml/namespace.rb +1 -2
- data/lib/nokogiri/xml/node.rb +113 -35
- data/lib/nokogiri/xml/node_set.rb +12 -10
- data/lib/nokogiri/xml/parse_options.rb +1 -1
- data/lib/nokogiri/xml/pp/node.rb +6 -1
- data/lib/nokogiri/xml/reader.rb +51 -17
- data/lib/nokogiri/xml/relax_ng.rb +57 -20
- data/lib/nokogiri/xml/sax/document.rb +174 -83
- data/lib/nokogiri/xml/sax/parser.rb +115 -41
- data/lib/nokogiri/xml/sax/parser_context.rb +116 -8
- data/lib/nokogiri/xml/sax/push_parser.rb +3 -0
- data/lib/nokogiri/xml/sax.rb +48 -0
- data/lib/nokogiri/xml/schema.rb +112 -45
- data/lib/nokogiri/xml/searchable.rb +9 -11
- data/lib/nokogiri/xml/syntax_error.rb +23 -1
- data/lib/nokogiri/xml.rb +14 -25
- data/lib/nokogiri/xslt/stylesheet.rb +29 -7
- data/lib/nokogiri/xslt.rb +4 -10
- data/lib/nokogiri.rb +1 -1
- data/lib/xsd/xmlparser/nokogiri.rb +3 -4
- data/ports/archives/libxml2-2.13.5.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.42.tar.xz +0 -0
- metadata +15 -14
- data/ext/nokogiri/libxml2_backwards_compat.c +0 -121
- data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +0 -25
- data/ports/archives/libxml2-2.11.5.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.38.tar.xz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a915fe582aabad2932ced42915cdb777c64c1a3f3ea8bfd89341fa222c022d62
|
4
|
+
data.tar.gz: 90301f89de7232df132f7f6d664fe7c1e490ffcd18ceaf517b614581ec34eaac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ffd386186555f7dd6ea54d30f82a902e6fafc4c15a1cf7fc181964bf85f8d69043f2289133ca1ae3f294889e03841056963486897b947d05eefa389735ca2d8
|
7
|
+
data.tar.gz: 2582576f9d51851a2bf41ecd9c18ec972c4e909b51590dc46503b484ca3a91a6999dd5bcff943a4be9f899346405217b56431d9d554d5b198ad62b382e286cbd
|
data/Gemfile
CHANGED
@@ -7,39 +7,32 @@ gemspec
|
|
7
7
|
group :development do
|
8
8
|
# bootstrapping
|
9
9
|
gem "bundler", "~> 2.3"
|
10
|
-
gem "rake", "
|
10
|
+
gem "rake", "13.2.1"
|
11
11
|
|
12
12
|
# building extensions
|
13
|
-
gem "rake-compiler", "
|
14
|
-
gem "rake-compiler-dock", "
|
15
|
-
|
16
|
-
# documentation
|
17
|
-
gem "hoe-markdown", "= 1.4.0"
|
13
|
+
gem "rake-compiler", "1.2.8"
|
14
|
+
gem "rake-compiler-dock", "1.5.2"
|
18
15
|
|
19
16
|
# parser generator
|
20
|
-
gem "rexical", "
|
17
|
+
gem "rexical", "1.0.8"
|
21
18
|
|
22
19
|
# tests
|
23
|
-
gem "minitest", "5.
|
24
|
-
gem "minitest-
|
25
|
-
gem "ruby_memcheck", "
|
20
|
+
gem "minitest", "5.25.2"
|
21
|
+
gem "minitest-parallel_fork", "2.0.0"
|
22
|
+
gem "ruby_memcheck", "3.0.0"
|
26
23
|
gem "rubyzip", "~> 2.3.2"
|
27
24
|
gem "simplecov", "= 0.21.2"
|
28
25
|
|
29
26
|
# rubocop
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
gem "rubocop-performance", "1.18.0"
|
35
|
-
gem "rubocop-rake", "= 0.6.0"
|
36
|
-
gem "rubocop-shopify", "2.13.0"
|
37
|
-
end
|
27
|
+
gem "standard", "1.42.1"
|
28
|
+
gem "rubocop-minitest", "0.36.0"
|
29
|
+
gem "rubocop-packaging", "0.5.2"
|
30
|
+
gem "rubocop-rake", "0.6.0"
|
38
31
|
end
|
39
32
|
|
40
33
|
# If Psych doesn't build, you can disable this group locally by running
|
41
34
|
# `bundle config set --local without rdoc`
|
42
35
|
# Then re-run `bundle install`.
|
43
36
|
group :rdoc do
|
44
|
-
gem "rdoc", "6.
|
37
|
+
gem "rdoc", "6.8.1"
|
45
38
|
end
|
data/README.md
CHANGED
@@ -55,6 +55,7 @@ There are a few ways to ask exploratory questions:
|
|
55
55
|
|
56
56
|
- The Nokogiri mailing list is active at https://groups.google.com/group/nokogiri-talk
|
57
57
|
- Open an issue using the "Help Request" template at https://github.com/sparklemotion/nokogiri/issues
|
58
|
+
- Open a discussion at https://github.com/sparklemotion/nokogiri/discussions
|
58
59
|
|
59
60
|
Please do not mail the maintainers at their personal addresses.
|
60
61
|
|
@@ -90,6 +91,8 @@ We bump `Major.Minor.Patch` versions following this guidance:
|
|
90
91
|
- Updating packaged libraries for non-security-related reasons.
|
91
92
|
- Dropping support for EOLed Ruby versions. [Some folks find this objectionable](https://github.com/sparklemotion/nokogiri/issues/1568), but [SemVer says this is OK if the public API hasn't changed](https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api).
|
92
93
|
- Backwards-incompatible changes to internal or private methods and constants. These are detailed in the "Changes" section of each changelog entry.
|
94
|
+
- Removal of deprecated methods or parameters, after a generous transition period; usually when those methods or parameters are rarely-used or dangerous to the user. Essentially, removals that do not justify a major version bump.
|
95
|
+
|
93
96
|
|
94
97
|
`Patch`:
|
95
98
|
|
@@ -111,9 +114,13 @@ You can help sponsor the maintainers of this software through one of these organ
|
|
111
114
|
|
112
115
|
Requirements:
|
113
116
|
|
114
|
-
- Ruby >=
|
117
|
+
- Ruby >= 3.0
|
115
118
|
- JRuby >= 9.4.0.0
|
116
119
|
|
120
|
+
If you are compiling the native extension against a system version of libxml2:
|
121
|
+
|
122
|
+
- libxml2 >= 2.9.2 (recommended >= 2.12.0)
|
123
|
+
|
117
124
|
|
118
125
|
### Native Gems: Faster, more reliable installation
|
119
126
|
|
data/dependencies.yml
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
+
---
|
1
2
|
libxml2:
|
2
|
-
version: "2.
|
3
|
-
sha256: "
|
4
|
-
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.
|
3
|
+
version: "2.13.5"
|
4
|
+
sha256: "74fc163217a3964257d3be39af943e08861263c4231f9ef5b496b6f6d4c7b2b6"
|
5
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.13/libxml2-2.13.5.sha256sum
|
5
6
|
|
6
7
|
libxslt:
|
7
|
-
version: "1.1.
|
8
|
-
sha256: "
|
9
|
-
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.
|
8
|
+
version: "1.1.42"
|
9
|
+
sha256: "85ca62cac0d41fc77d3f6033da9df6fd73d20ea2fc18b0a3609ffb4110e1baeb"
|
10
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.42.sha256sum
|
10
11
|
|
11
12
|
zlib:
|
12
|
-
version: "1.
|
13
|
-
sha256: "
|
13
|
+
version: "1.3.1"
|
14
|
+
sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
|
14
15
|
# SHA-256 hash provided on http://zlib.net/
|
15
16
|
|
16
17
|
libiconv:
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -12,8 +12,8 @@ require "pathname"
|
|
12
12
|
|
13
13
|
# helpful constants
|
14
14
|
PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
15
|
-
REQUIRED_LIBXML_VERSION = "2.
|
16
|
-
RECOMMENDED_LIBXML_VERSION = "2.
|
15
|
+
REQUIRED_LIBXML_VERSION = "2.9.2"
|
16
|
+
RECOMMENDED_LIBXML_VERSION = "2.12.0"
|
17
17
|
|
18
18
|
REQUIRED_MINI_PORTILE_VERSION = "~> 2.8.2" # keep this version in sync with the one in the gemspec
|
19
19
|
REQUIRED_PKG_CONFIG_VERSION = "~> 1.1"
|
@@ -57,30 +57,6 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
57
57
|
Look for headers in DIRECTORY.
|
58
58
|
|
59
59
|
|
60
|
-
Related to zlib:
|
61
|
-
|
62
|
-
--with-zlib-dir=DIRECTORY
|
63
|
-
Look for zlib headers and library in DIRECTORY.
|
64
|
-
|
65
|
-
--with-zlib-lib=DIRECTORY
|
66
|
-
Look for zlib library in DIRECTORY.
|
67
|
-
|
68
|
-
--with-zlib-include=DIRECTORY
|
69
|
-
Look for zlib headers in DIRECTORY.
|
70
|
-
|
71
|
-
|
72
|
-
Related to iconv:
|
73
|
-
|
74
|
-
--with-iconv-dir=DIRECTORY
|
75
|
-
Look for iconv headers and library in DIRECTORY.
|
76
|
-
|
77
|
-
--with-iconv-lib=DIRECTORY
|
78
|
-
Look for iconv library in DIRECTORY.
|
79
|
-
|
80
|
-
--with-iconv-include=DIRECTORY
|
81
|
-
Look for iconv headers in DIRECTORY.
|
82
|
-
|
83
|
-
|
84
60
|
Related to libxml2:
|
85
61
|
|
86
62
|
--with-xml2-dir=DIRECTORY
|
@@ -95,6 +71,10 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
95
71
|
--with-xml2-source-dir=DIRECTORY
|
96
72
|
(dev only) Build libxml2 from the source code in DIRECTORY
|
97
73
|
|
74
|
+
--disable-xml2-legacy
|
75
|
+
Do not build libxml2 with zlib, liblzma, or HTTP support. This will become the default
|
76
|
+
in a future version of Nokogiri.
|
77
|
+
|
98
78
|
|
99
79
|
Related to libxslt:
|
100
80
|
|
@@ -123,6 +103,30 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
123
103
|
Look for exslt headers in DIRECTORY.
|
124
104
|
|
125
105
|
|
106
|
+
Related to iconv:
|
107
|
+
|
108
|
+
--with-iconv-dir=DIRECTORY
|
109
|
+
Look for iconv headers and library in DIRECTORY.
|
110
|
+
|
111
|
+
--with-iconv-lib=DIRECTORY
|
112
|
+
Look for iconv library in DIRECTORY.
|
113
|
+
|
114
|
+
--with-iconv-include=DIRECTORY
|
115
|
+
Look for iconv headers in DIRECTORY.
|
116
|
+
|
117
|
+
|
118
|
+
Related to zlib (ignored if `--disable-xml2-legacy` is used):
|
119
|
+
|
120
|
+
--with-zlib-dir=DIRECTORY
|
121
|
+
Look for zlib headers and library in DIRECTORY.
|
122
|
+
|
123
|
+
--with-zlib-lib=DIRECTORY
|
124
|
+
Look for zlib library in DIRECTORY.
|
125
|
+
|
126
|
+
--with-zlib-include=DIRECTORY
|
127
|
+
Look for zlib headers in DIRECTORY.
|
128
|
+
|
129
|
+
|
126
130
|
Flags only used when building and using the packaged libraries:
|
127
131
|
|
128
132
|
--disable-static
|
@@ -137,6 +141,9 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
137
141
|
NOKOGIRI_USE_SYSTEM_LIBRARIES
|
138
142
|
Equivalent to `--enable-system-libraries` when set, even if nil or blank.
|
139
143
|
|
144
|
+
AR
|
145
|
+
Use this path to invoke the library archiver instead of `RbConfig::CONFIG['AR']`
|
146
|
+
|
140
147
|
CC
|
141
148
|
Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
|
142
149
|
|
@@ -146,6 +153,9 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
146
153
|
CFLAGS
|
147
154
|
If this string is accepted by the compiler, add it to the flags passed to the compiler
|
148
155
|
|
156
|
+
LD
|
157
|
+
Use this path to invoke the linker instead of `RbConfig::CONFIG['LD']`
|
158
|
+
|
149
159
|
LDFLAGS
|
150
160
|
If this string is accepted by the linker, add it to the flags passed to the linker
|
151
161
|
|
@@ -175,6 +185,10 @@ def config_system_libraries?
|
|
175
185
|
end
|
176
186
|
end
|
177
187
|
|
188
|
+
def config_with_xml2_legacy?
|
189
|
+
enable_config("xml2-legacy", true)
|
190
|
+
end
|
191
|
+
|
178
192
|
def windows?
|
179
193
|
RbConfig::CONFIG["target_os"].match?(/mingw|mswin/)
|
180
194
|
end
|
@@ -195,10 +209,14 @@ def aix?
|
|
195
209
|
RbConfig::CONFIG["target_os"].include?("aix")
|
196
210
|
end
|
197
211
|
|
198
|
-
def
|
212
|
+
def unix?
|
199
213
|
!(windows? || solaris? || darwin?)
|
200
214
|
end
|
201
215
|
|
216
|
+
def nix?
|
217
|
+
ENV.key?("NIX_CC")
|
218
|
+
end
|
219
|
+
|
202
220
|
def truffle?
|
203
221
|
RUBY_ENGINE == "truffleruby"
|
204
222
|
end
|
@@ -443,7 +461,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p = true)
|
|
443
461
|
# We use 'host' to set compiler prefix for cross-compiling. Prefer host_alias over host. And
|
444
462
|
# prefer i686 (what external dev tools use) to i386 (what ruby's configure.ac emits).
|
445
463
|
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
446
|
-
recipe.host = recipe.host.gsub(
|
464
|
+
recipe.host = recipe.host.gsub("i386", "i686")
|
447
465
|
|
448
466
|
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports") if cacheable_p
|
449
467
|
recipe.configure_options << "--libdir=#{File.join(recipe.path, "lib")}"
|
@@ -626,12 +644,22 @@ if openbsd? && !config_system_libraries?
|
|
626
644
|
append_cppflags "-I/usr/local/include"
|
627
645
|
end
|
628
646
|
|
647
|
+
if ENV["AR"]
|
648
|
+
RbConfig::CONFIG["AR"] = RbConfig::MAKEFILE_CONFIG["AR"] = ENV["AR"]
|
649
|
+
end
|
650
|
+
|
629
651
|
if ENV["CC"]
|
630
652
|
RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"]
|
631
653
|
end
|
632
654
|
|
633
|
-
|
655
|
+
if ENV["LD"]
|
656
|
+
RbConfig::CONFIG["LD"] = RbConfig::MAKEFILE_CONFIG["LD"] = ENV["LD"]
|
657
|
+
end
|
658
|
+
|
659
|
+
# use same toolchain for libxml and libxslt
|
660
|
+
ENV["AR"] = RbConfig::CONFIG["AR"]
|
634
661
|
ENV["CC"] = RbConfig::CONFIG["CC"]
|
662
|
+
ENV["LD"] = RbConfig::CONFIG["LD"]
|
635
663
|
|
636
664
|
if arg_config("--prevent-strip")
|
637
665
|
old_cflags = $CFLAGS.split.join(" ")
|
@@ -646,13 +674,12 @@ if arg_config("--prevent-strip")
|
|
646
674
|
end
|
647
675
|
|
648
676
|
# adopt environment config
|
649
|
-
append_cflags(ENV["CFLAGS"]
|
650
|
-
append_cppflags(ENV["CPPFLAGS"]
|
651
|
-
append_ldflags(ENV["LDFLAGS"]
|
677
|
+
append_cflags(ENV["CFLAGS"]) unless ENV["CFLAGS"].nil?
|
678
|
+
append_cppflags(ENV["CPPFLAGS"]) unless ENV["CPPFLAGS"].nil?
|
679
|
+
append_ldflags(ENV["LDFLAGS"]) unless ENV["LDFLAGS"].nil?
|
652
680
|
$LIBS = concat_flags($LIBS, ENV["LIBS"])
|
653
681
|
|
654
|
-
#
|
655
|
-
# errors/warnings. see #2302
|
682
|
+
# libgumbo uses C90/C99 features, see #2302
|
656
683
|
append_cflags(["-std=c99", "-Wno-declaration-after-statement"])
|
657
684
|
|
658
685
|
# gumbo html5 serialization is slower with O3, let's make sure we use O2
|
@@ -667,12 +694,9 @@ append_cflags("-Winline")
|
|
667
694
|
# good to have no matter what Ruby was compiled with
|
668
695
|
append_cflags("-Wmissing-noreturn")
|
669
696
|
|
670
|
-
# check integer loss of precision
|
671
|
-
|
672
|
-
|
673
|
-
else
|
674
|
-
append_cflags("-Wconversion -Wno-sign-conversion")
|
675
|
-
end
|
697
|
+
# check integer loss of precision. this flag won't generally work until Ruby 3.4.
|
698
|
+
# see https://bugs.ruby-lang.org/issues/20507
|
699
|
+
append_cflags("-Wconversion")
|
676
700
|
|
677
701
|
# handle clang variations, see #1101
|
678
702
|
if darwin?
|
@@ -685,7 +709,7 @@ end
|
|
685
709
|
|
686
710
|
# Add SDK-specific include path for macOS and brew versions before v2.2.12 (2020-04-08) [#1851, #1801]
|
687
711
|
macos_mojave_sdk_include_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2"
|
688
|
-
if config_system_libraries? && darwin? && Dir.exist?(macos_mojave_sdk_include_path)
|
712
|
+
if config_system_libraries? && darwin? && Dir.exist?(macos_mojave_sdk_include_path) && !nix?
|
689
713
|
append_cppflags("-I#{macos_mojave_sdk_include_path}")
|
690
714
|
end
|
691
715
|
|
@@ -695,13 +719,15 @@ append_cppflags(' "-Idummypath"') if windows?
|
|
695
719
|
|
696
720
|
if config_system_libraries?
|
697
721
|
message "Building nokogiri using system libraries.\n"
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
722
|
+
if config_with_xml2_legacy?
|
723
|
+
ensure_package_configuration(
|
724
|
+
opt: "zlib",
|
725
|
+
pc: "zlib",
|
726
|
+
lib: "z",
|
727
|
+
headers: "zlib.h",
|
728
|
+
func: "gzdopen",
|
729
|
+
)
|
730
|
+
end
|
705
731
|
ensure_package_configuration(
|
706
732
|
opt: "xml2",
|
707
733
|
pc: "libxml-2.0",
|
@@ -745,58 +771,60 @@ else
|
|
745
771
|
require "yaml"
|
746
772
|
dependencies = YAML.load_file(File.join(PACKAGE_ROOT_DIR, "dependencies.yml"))
|
747
773
|
|
748
|
-
dir_config("zlib")
|
774
|
+
dir_config("zlib") if config_with_xml2_legacy?
|
749
775
|
|
750
776
|
if cross_build_p || windows?
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
777
|
+
if config_with_xml2_legacy?
|
778
|
+
zlib_recipe = process_recipe("zlib", dependencies["zlib"]["version"], static_p, cross_build_p) do |recipe|
|
779
|
+
recipe.files = [{
|
780
|
+
url: zlib_source(recipe.version),
|
781
|
+
sha256: dependencies["zlib"]["sha256"],
|
782
|
+
}]
|
783
|
+
if windows?
|
784
|
+
class << recipe
|
785
|
+
attr_accessor :cross_build_p
|
786
|
+
|
787
|
+
def configure
|
788
|
+
Dir.chdir(work_path) do
|
789
|
+
mk = File.read("win32/Makefile.gcc")
|
790
|
+
File.open("win32/Makefile.gcc", "wb") do |f|
|
791
|
+
f.puts "BINARY_PATH = #{path}/bin"
|
792
|
+
f.puts "LIBRARY_PATH = #{path}/lib"
|
793
|
+
f.puts "INCLUDE_PATH = #{path}/include"
|
794
|
+
mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-") if cross_build_p
|
795
|
+
f.puts mk
|
796
|
+
end
|
769
797
|
end
|
770
798
|
end
|
771
|
-
end
|
772
799
|
|
773
|
-
|
774
|
-
|
775
|
-
|
800
|
+
def configured?
|
801
|
+
Dir.chdir(work_path) do
|
802
|
+
!!(File.read("win32/Makefile.gcc") =~ /^BINARY_PATH/)
|
803
|
+
end
|
776
804
|
end
|
777
|
-
end
|
778
805
|
|
779
|
-
|
780
|
-
|
781
|
-
|
806
|
+
def compile
|
807
|
+
execute("compile", "make -f win32/Makefile.gcc")
|
808
|
+
end
|
782
809
|
|
783
|
-
|
784
|
-
|
810
|
+
def install
|
811
|
+
execute("install", "make -f win32/Makefile.gcc install")
|
812
|
+
end
|
785
813
|
end
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
814
|
+
recipe.cross_build_p = cross_build_p
|
815
|
+
else
|
816
|
+
class << recipe
|
817
|
+
def configure
|
818
|
+
env = {}
|
819
|
+
env["CFLAGS"] = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
|
820
|
+
env["CHOST"] = host
|
821
|
+
execute("configure", ["./configure", "--static", configure_prefix], { env: env })
|
822
|
+
if darwin?
|
823
|
+
# needed as of zlib 1.2.13
|
824
|
+
Dir.chdir(work_path) do
|
825
|
+
makefile = File.read("Makefile").gsub(/^AR=.*$/, "AR=#{host}-libtool")
|
826
|
+
File.open("Makefile", "w") { |m| m.write(makefile) }
|
827
|
+
end
|
800
828
|
end
|
801
829
|
end
|
802
830
|
end
|
@@ -804,7 +832,7 @@ else
|
|
804
832
|
end
|
805
833
|
end
|
806
834
|
|
807
|
-
unless
|
835
|
+
unless unix?
|
808
836
|
libiconv_recipe = process_recipe(
|
809
837
|
"libiconv",
|
810
838
|
dependencies["libiconv"]["version"],
|
@@ -889,6 +917,10 @@ else
|
|
889
917
|
cppflags = concat_flags(cppflags, "-DNOKOGIRI_PRECOMPILED_LIBRARIES")
|
890
918
|
end
|
891
919
|
|
920
|
+
if config_with_xml2_legacy?
|
921
|
+
recipe.configure_options << "--with-legacy"
|
922
|
+
end
|
923
|
+
|
892
924
|
if zlib_recipe
|
893
925
|
recipe.configure_options << "--with-zlib=#{zlib_recipe.path}"
|
894
926
|
end
|
@@ -900,7 +932,8 @@ else
|
|
900
932
|
end
|
901
933
|
|
902
934
|
if darwin? && !cross_build_p
|
903
|
-
recipe.configure_options
|
935
|
+
recipe.configure_options << "RANLIB=/usr/bin/ranlib" unless ENV.key?("RANLIB")
|
936
|
+
recipe.configure_options << "AR=/usr/bin/ar" unless ENV.key?("AR")
|
904
937
|
end
|
905
938
|
|
906
939
|
if windows?
|
@@ -919,6 +952,7 @@ else
|
|
919
952
|
"--with-c14n",
|
920
953
|
"--with-debug",
|
921
954
|
"--with-threads",
|
955
|
+
"--without-tls", # see https://github.com/sparklemotion/nokogiri/issues/3031
|
922
956
|
"CPPFLAGS=#{cppflags}",
|
923
957
|
"CFLAGS=#{cflags}",
|
924
958
|
]
|
@@ -940,7 +974,8 @@ else
|
|
940
974
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
941
975
|
|
942
976
|
if darwin? && !cross_build_p
|
943
|
-
recipe.configure_options
|
977
|
+
recipe.configure_options << "RANLIB=/usr/bin/ranlib" unless ENV.key?("RANLIB")
|
978
|
+
recipe.configure_options << "AR=/usr/bin/ar" unless ENV.key?("AR")
|
944
979
|
end
|
945
980
|
|
946
981
|
if windows?
|
@@ -1031,63 +1066,81 @@ else
|
|
1031
1066
|
ensure_func("exsltFuncRegister", "libexslt/exslt.h")
|
1032
1067
|
end
|
1033
1068
|
|
1034
|
-
|
1035
|
-
|
1069
|
+
if arg_config("--gumbo-dev")
|
1070
|
+
message("DEV MODE ENABLED: build libgumbo as packaged source")
|
1071
|
+
ext_dir = File.dirname(__FILE__)
|
1072
|
+
Dir.chdir(ext_dir) do
|
1073
|
+
$srcs = Dir["*.c", "../../gumbo-parser/src/*.c"]
|
1074
|
+
$hdrs = Dir["*.h", "../../gumbo-parser/src/*.h"]
|
1075
|
+
end
|
1076
|
+
$INCFLAGS << " -I$(srcdir)/../../gumbo-parser/src"
|
1077
|
+
$VPATH << "$(srcdir)/../../gumbo-parser/src"
|
1078
|
+
find_header("nokogiri_gumbo.h") || abort("nokogiri_gumbo.h not found")
|
1079
|
+
else
|
1080
|
+
libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_build_p, false) do |recipe|
|
1081
|
+
recipe.configure_options = []
|
1036
1082
|
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1083
|
+
class << recipe
|
1084
|
+
def downloaded?
|
1085
|
+
true
|
1086
|
+
end
|
1041
1087
|
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1088
|
+
def extract
|
1089
|
+
target = File.join(tmp_path, "gumbo-parser")
|
1090
|
+
output("Copying gumbo-parser files into #{target}...")
|
1091
|
+
FileUtils.mkdir_p(target)
|
1092
|
+
FileUtils.cp(Dir.glob(File.join(PACKAGE_ROOT_DIR, "gumbo-parser/src/*")), target)
|
1093
|
+
end
|
1048
1094
|
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1095
|
+
def configured?
|
1096
|
+
true
|
1097
|
+
end
|
1052
1098
|
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1099
|
+
def install
|
1100
|
+
lib_dir = File.join(port_path, "lib")
|
1101
|
+
inc_dir = File.join(port_path, "include")
|
1102
|
+
FileUtils.mkdir_p([lib_dir, inc_dir])
|
1103
|
+
FileUtils.cp(File.join(work_path, "libgumbo.a"), lib_dir)
|
1104
|
+
FileUtils.cp(Dir.glob(File.join(work_path, "*.h")), inc_dir)
|
1105
|
+
end
|
1060
1106
|
|
1061
|
-
|
1062
|
-
|
1107
|
+
def compile
|
1108
|
+
cflags = concat_flags(ENV["CFLAGS"], "-fPIC", "-O2", "-g")
|
1063
1109
|
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1110
|
+
env = { "CC" => gcc_cmd, "CFLAGS" => cflags }
|
1111
|
+
if config_cross_build?
|
1112
|
+
if host.include?("darwin")
|
1113
|
+
env["AR"] = "#{host}-libtool"
|
1114
|
+
env["ARFLAGS"] = "-o"
|
1115
|
+
else
|
1116
|
+
env["AR"] = "#{host}-ar"
|
1117
|
+
end
|
1118
|
+
env["RANLIB"] = "#{host}-ranlib"
|
1119
|
+
if windows?
|
1120
|
+
# NOTE: that in any particular windows gem package, we only ever compile against either
|
1121
|
+
# msvcrt (ruby <= 3.0) or ucrt (ruby > 3.0), so even though this gets evaluated only once
|
1122
|
+
# per gem (and not per-version-of-ruby), it's OK.
|
1123
|
+
env["CFLAGS"] = if RbConfig::CONFIG["RUBY_SO_NAME"].include?("msvcrt")
|
1124
|
+
concat_flags(env["CFLAGS"], "-D_RUBY_MSVCRT")
|
1125
|
+
else
|
1126
|
+
concat_flags(env["CFLAGS"], "-D_RUBY_UCRT")
|
1127
|
+
end
|
1128
|
+
end
|
1071
1129
|
end
|
1072
|
-
env["RANLIB"] = "#{host}-ranlib"
|
1073
|
-
end
|
1074
1130
|
|
1075
|
-
|
1131
|
+
execute("compile", make_cmd, { env: env })
|
1132
|
+
end
|
1076
1133
|
end
|
1077
1134
|
end
|
1135
|
+
append_cppflags("-I#{File.join(libgumbo_recipe.path, "include")}")
|
1136
|
+
$libs = $libs + " " + File.join(libgumbo_recipe.path, "lib", "libgumbo.a")
|
1137
|
+
$LIBPATH = $LIBPATH | [File.join(libgumbo_recipe.path, "lib")]
|
1138
|
+
ensure_func("gumbo_parse_with_options", "nokogiri_gumbo.h")
|
1078
1139
|
end
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
have_func("xmlHasFeature") || abort("xmlHasFeature() is missing.") # introduced in libxml 2.6.21
|
1085
|
-
have_func("xmlFirstElementChild") # introduced in libxml 2.7.3
|
1086
|
-
have_func("xmlRelaxNGSetParserStructuredErrors") # introduced in libxml 2.6.24
|
1087
|
-
have_func("xmlRelaxNGSetValidStructuredErrors") # introduced in libxml 2.6.21
|
1088
|
-
have_func("xmlSchemaSetValidStructuredErrors") # introduced in libxml 2.6.23
|
1089
|
-
have_func("xmlSchemaSetParserStructuredErrors") # introduced in libxml 2.6.23
|
1090
|
-
have_func("rb_gc_location") # introduced in Ruby 2.7
|
1140
|
+
|
1141
|
+
have_func("xmlCtxtSetOptions") # introduced in libxml2 2.13.0
|
1142
|
+
have_func("xmlCtxtGetOptions") # introduced in libxml2 2.14.0
|
1143
|
+
have_func("xmlSwitchEncodingName") # introduced in libxml2 2.13.0
|
1091
1144
|
have_func("rb_category_warning") # introduced in Ruby 3.0
|
1092
1145
|
|
1093
1146
|
other_library_versions_string = OTHER_LIBRARY_VERSIONS.map { |k, v| [k, v].join(":") }.join(",")
|
@@ -1119,7 +1172,7 @@ if config_clean?
|
|
1119
1172
|
mk.print(<<~EOF)
|
1120
1173
|
|
1121
1174
|
all: clean-ports
|
1122
|
-
clean-ports: $(
|
1175
|
+
clean-ports: $(TARGET_SO)
|
1123
1176
|
\t-$(Q)$(RUBY) $(srcdir)/extconf.rb --clean --#{static_p ? "enable" : "disable"}-static
|
1124
1177
|
EOF
|
1125
1178
|
end
|