nokogiri 1.11.0.rc4-java → 1.11.5-java
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 +3 -0
- data/LICENSE-DEPENDENCIES.md +12 -12
- data/LICENSE.md +1 -1
- data/README.md +168 -91
- data/dependencies.yml +12 -12
- data/ext/java/nokogiri/EncodingHandler.java +76 -89
- data/ext/java/nokogiri/HtmlDocument.java +135 -144
- data/ext/java/nokogiri/HtmlElementDescription.java +102 -117
- data/ext/java/nokogiri/HtmlEntityLookup.java +33 -60
- data/ext/java/nokogiri/HtmlSaxParserContext.java +218 -222
- data/ext/java/nokogiri/HtmlSaxPushParser.java +162 -169
- data/ext/java/nokogiri/NokogiriService.java +595 -556
- data/ext/java/nokogiri/XmlAttr.java +118 -126
- data/ext/java/nokogiri/XmlAttributeDecl.java +95 -106
- data/ext/java/nokogiri/XmlCdata.java +35 -58
- data/ext/java/nokogiri/XmlComment.java +46 -67
- data/ext/java/nokogiri/XmlDocument.java +645 -572
- data/ext/java/nokogiri/XmlDocumentFragment.java +125 -137
- data/ext/java/nokogiri/XmlDtd.java +448 -414
- data/ext/java/nokogiri/XmlElement.java +23 -48
- data/ext/java/nokogiri/XmlElementContent.java +343 -316
- data/ext/java/nokogiri/XmlElementDecl.java +124 -125
- data/ext/java/nokogiri/XmlEntityDecl.java +119 -127
- data/ext/java/nokogiri/XmlEntityReference.java +49 -72
- data/ext/java/nokogiri/XmlNamespace.java +175 -175
- data/ext/java/nokogiri/XmlNode.java +1843 -1620
- data/ext/java/nokogiri/XmlNodeSet.java +361 -331
- data/ext/java/nokogiri/XmlProcessingInstruction.java +47 -69
- data/ext/java/nokogiri/XmlReader.java +513 -450
- data/ext/java/nokogiri/XmlRelaxng.java +85 -104
- data/ext/java/nokogiri/XmlSaxParserContext.java +328 -315
- data/ext/java/nokogiri/XmlSaxPushParser.java +227 -220
- data/ext/java/nokogiri/XmlSchema.java +328 -295
- data/ext/java/nokogiri/XmlSyntaxError.java +113 -115
- data/ext/java/nokogiri/XmlText.java +55 -76
- data/ext/java/nokogiri/XmlXpathContext.java +240 -238
- data/ext/java/nokogiri/XsltStylesheet.java +280 -269
- data/ext/java/nokogiri/internals/ClosedStreamException.java +5 -2
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +201 -202
- data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +17 -10
- data/ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java +43 -16
- data/ext/java/nokogiri/internals/NokogiriDomParser.java +63 -80
- data/ext/java/nokogiri/internals/NokogiriEntityResolver.java +107 -88
- data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +27 -52
- data/ext/java/nokogiri/internals/NokogiriHandler.java +316 -286
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +736 -652
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +184 -173
- data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +81 -98
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +64 -79
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +84 -99
- data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +48 -65
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +116 -131
- data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +34 -56
- data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +23 -46
- data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +55 -72
- data/ext/java/nokogiri/internals/ParserContext.java +206 -211
- data/ext/java/nokogiri/internals/ReaderNode.java +478 -403
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +822 -739
- data/ext/java/nokogiri/internals/SchemaErrorHandler.java +31 -54
- data/ext/java/nokogiri/internals/XalanDTMManagerPatch.java +129 -123
- data/ext/java/nokogiri/internals/XmlDeclHandler.java +3 -34
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +206 -207
- data/ext/java/nokogiri/internals/XmlSaxParser.java +22 -47
- data/ext/java/nokogiri/internals/c14n/AttrCompare.java +71 -68
- data/ext/java/nokogiri/internals/c14n/C14nHelper.java +137 -118
- data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +27 -21
- data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +74 -61
- data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +230 -205
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +572 -547
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +17 -10
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +17 -10
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +323 -302
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +232 -219
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +22 -15
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +23 -16
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +23 -16
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +22 -15
- data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +575 -545
- data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +141 -120
- data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +39 -38
- data/ext/java/nokogiri/internals/c14n/Constants.java +13 -10
- data/ext/java/nokogiri/internals/c14n/ElementProxy.java +279 -247
- data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +66 -53
- data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +44 -37
- data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +135 -120
- data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +59 -48
- data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +384 -334
- data/ext/java/nokogiri/internals/c14n/NodeFilter.java +25 -24
- data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +151 -140
- data/ext/java/nokogiri/internals/c14n/XMLUtils.java +456 -423
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java +1466 -1500
- data/ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java +626 -574
- data/ext/nokogiri/depend +34 -474
- data/ext/nokogiri/extconf.rb +270 -183
- data/ext/nokogiri/html_document.c +10 -15
- data/ext/nokogiri/html_element_description.c +84 -71
- data/ext/nokogiri/html_entity_lookup.c +21 -16
- data/ext/nokogiri/html_sax_parser_context.c +67 -64
- data/ext/nokogiri/html_sax_push_parser.c +42 -34
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +190 -60
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +15 -15
- data/ext/nokogiri/xml_attribute_decl.c +18 -18
- data/ext/nokogiri/xml_cdata.c +13 -18
- data/ext/nokogiri/xml_comment.c +19 -26
- data/ext/nokogiri/xml_document.c +246 -188
- data/ext/nokogiri/xml_document_fragment.c +13 -15
- data/ext/nokogiri/xml_dtd.c +54 -48
- data/ext/nokogiri/xml_element_content.c +30 -27
- data/ext/nokogiri/xml_element_decl.c +22 -22
- data/ext/nokogiri/xml_encoding_handler.c +17 -11
- data/ext/nokogiri/xml_entity_decl.c +32 -30
- data/ext/nokogiri/xml_entity_reference.c +16 -18
- data/ext/nokogiri/xml_namespace.c +56 -49
- data/ext/nokogiri/xml_node.c +371 -320
- data/ext/nokogiri/xml_node_set.c +168 -156
- data/ext/nokogiri/xml_processing_instruction.c +17 -19
- data/ext/nokogiri/xml_reader.c +191 -157
- data/ext/nokogiri/xml_relax_ng.c +29 -23
- data/ext/nokogiri/xml_sax_parser.c +117 -112
- data/ext/nokogiri/xml_sax_parser_context.c +101 -84
- data/ext/nokogiri/xml_sax_push_parser.c +36 -27
- data/ext/nokogiri/xml_schema.c +48 -42
- data/ext/nokogiri/xml_syntax_error.c +42 -21
- data/ext/nokogiri/xml_text.c +13 -17
- data/ext/nokogiri/xml_xpath_context.c +134 -127
- data/ext/nokogiri/xslt_stylesheet.c +157 -157
- data/lib/nokogiri.rb +2 -6
- data/lib/nokogiri/css/parser.rb +1 -1
- data/lib/nokogiri/extension.rb +26 -0
- data/lib/nokogiri/html/document_fragment.rb +15 -15
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/version/info.rb +32 -8
- data/lib/nokogiri/xml/document.rb +74 -28
- data/lib/nokogiri/xml/node.rb +39 -42
- data/lib/nokogiri/xml/reader.rb +2 -9
- data/lib/nokogiri/xml/xpath.rb +1 -3
- data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -1
- metadata +62 -127
- data/ext/nokogiri/xml_io.c +0 -63
- data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
data/ext/nokogiri/extconf.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# :
|
1
|
+
# frozen_string_literal: true
|
2
2
|
ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/
|
3
3
|
|
4
4
|
require "mkmf"
|
@@ -7,9 +7,7 @@ require "fileutils"
|
|
7
7
|
require "shellwords"
|
8
8
|
require "pathname"
|
9
9
|
|
10
|
-
#
|
11
|
-
# helpful constants
|
12
|
-
#
|
10
|
+
# helpful constants
|
13
11
|
PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
14
12
|
REQUIRED_LIBXML_VERSION = "2.6.21"
|
15
13
|
RECOMMENDED_LIBXML_VERSION = "2.9.3"
|
@@ -28,64 +26,109 @@ NOKOGIRI_HELP_MESSAGE = <<~HELP
|
|
28
26
|
Flags that are always valid:
|
29
27
|
|
30
28
|
--use-system-libraries
|
31
|
-
|
29
|
+
--enable-system-libraries
|
30
|
+
Use system libraries instead of building and using the packaged libraries.
|
31
|
+
|
32
|
+
--disable-system-libraries
|
33
|
+
Use the packaged libraries, and ignore the system libraries. This is the default on most
|
34
|
+
platforms, and overrides `--use-system-libraries` and the environment variable
|
35
|
+
`NOKOGIRI_USE_SYSTEM_LIBRARIES`.
|
32
36
|
|
33
37
|
--disable-clean
|
34
|
-
Do not clean out intermediate files after successful build
|
38
|
+
Do not clean out intermediate files after successful build.
|
39
|
+
|
40
|
+
--prevent-strip
|
41
|
+
Take steps to prevent stripping the symbol table and debugging info from the shared
|
42
|
+
library, potentially overriding RbConfig's CFLAGS/LDFLAGS/DLDFLAGS.
|
35
43
|
|
36
44
|
|
37
45
|
Flags only used when using system libraries:
|
38
46
|
|
39
|
-
|
40
|
-
|
47
|
+
General:
|
48
|
+
|
49
|
+
--with-opt-dir=DIRECTORY
|
50
|
+
Look for headers and libraries in DIRECTORY.
|
51
|
+
|
52
|
+
--with-opt-lib=DIRECTORY
|
53
|
+
Look for libraries in DIRECTORY.
|
54
|
+
|
55
|
+
--with-opt-include=DIRECTORY
|
56
|
+
Look for headers in DIRECTORY.
|
57
|
+
|
58
|
+
|
59
|
+
Related to zlib:
|
60
|
+
|
61
|
+
--with-zlib-dir=DIRECTORY
|
62
|
+
Look for zlib headers and library in DIRECTORY.
|
63
|
+
|
64
|
+
--with-zlib-lib=DIRECTORY
|
65
|
+
Look for zlib library in DIRECTORY.
|
66
|
+
|
67
|
+
--with-zlib-include=DIRECTORY
|
68
|
+
Look for zlib headers in DIRECTORY.
|
69
|
+
|
70
|
+
|
71
|
+
Related to iconv:
|
72
|
+
|
73
|
+
--with-iconv-dir=DIRECTORY
|
74
|
+
Look for iconv headers and library in DIRECTORY.
|
75
|
+
|
76
|
+
--with-iconv-lib=DIRECTORY
|
77
|
+
Look for iconv library in DIRECTORY.
|
41
78
|
|
42
|
-
|
43
|
-
|
79
|
+
--with-iconv-include=DIRECTORY
|
80
|
+
Look for iconv headers in DIRECTORY.
|
44
81
|
|
45
|
-
--with-iconv-dir=DIRECTORY
|
46
|
-
Look for iconv header and library in DIRECTORY
|
47
82
|
|
48
|
-
|
49
|
-
Look for xml2 headers and library in DIRECTORY
|
83
|
+
Related to libxml2:
|
50
84
|
|
51
|
-
|
52
|
-
|
85
|
+
--with-xml2-dir=DIRECTORY
|
86
|
+
Look for xml2 headers and library in DIRECTORY.
|
53
87
|
|
54
|
-
|
55
|
-
|
88
|
+
--with-xml2-lib=DIRECTORY
|
89
|
+
Look for xml2 library in DIRECTORY.
|
56
90
|
|
57
|
-
|
58
|
-
|
91
|
+
--with-xml2-include=DIRECTORY
|
92
|
+
Look for xml2 headers in DIRECTORY.
|
59
93
|
|
60
|
-
--with-xslt-lib=DIRECTORY
|
61
|
-
Look for xslt library in DIRECTORY
|
62
94
|
|
63
|
-
|
64
|
-
Look for xslt headers in DIRECTORY
|
95
|
+
Related to libxslt:
|
65
96
|
|
66
|
-
|
67
|
-
|
97
|
+
--with-xslt-dir=DIRECTORY
|
98
|
+
Look for xslt headers and library in DIRECTORY.
|
68
99
|
|
69
|
-
|
70
|
-
|
100
|
+
--with-xslt-lib=DIRECTORY
|
101
|
+
Look for xslt library in DIRECTORY.
|
71
102
|
|
72
|
-
|
73
|
-
|
103
|
+
--with-xslt-include=DIRECTORY
|
104
|
+
Look for xslt headers in DIRECTORY.
|
105
|
+
|
106
|
+
|
107
|
+
Related to libexslt:
|
108
|
+
|
109
|
+
--with-exslt-dir=DIRECTORY
|
110
|
+
Look for exslt headers and library in DIRECTORY.
|
111
|
+
|
112
|
+
--with-exslt-lib=DIRECTORY
|
113
|
+
Look for exslt library in DIRECTORY.
|
114
|
+
|
115
|
+
--with-exslt-include=DIRECTORY
|
116
|
+
Look for exslt headers in DIRECTORY.
|
74
117
|
|
75
118
|
|
76
119
|
Flags only used when building and using the packaged libraries:
|
77
120
|
|
78
121
|
--disable-static
|
79
|
-
Do not statically link packaged libraries, instead use shared libraries
|
122
|
+
Do not statically link packaged libraries, instead use shared libraries.
|
80
123
|
|
81
124
|
--enable-cross-build
|
82
125
|
Enable cross-build mode. (You probably do not want to set this manually.)
|
83
126
|
|
127
|
+
|
84
128
|
Environment variables used:
|
85
129
|
|
86
130
|
NOKOGIRI_USE_SYSTEM_LIBRARIES
|
87
|
-
|
88
|
-
packaged libraries. Equivalent to `--use-system-libraries`.
|
131
|
+
Equivalent to `--enable-system-libraries` when set, even if nil or blank.
|
89
132
|
|
90
133
|
CC
|
91
134
|
Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
|
@@ -106,6 +149,25 @@ HELP
|
|
106
149
|
#
|
107
150
|
# utility functions
|
108
151
|
#
|
152
|
+
def config_clean?
|
153
|
+
enable_config('clean', true)
|
154
|
+
end
|
155
|
+
|
156
|
+
def config_static?
|
157
|
+
default_static = !truffle?
|
158
|
+
enable_config("static", default_static)
|
159
|
+
end
|
160
|
+
|
161
|
+
def config_cross_build?
|
162
|
+
enable_config("cross-build")
|
163
|
+
end
|
164
|
+
|
165
|
+
def config_system_libraries?
|
166
|
+
enable_config("system-libraries", ENV.key?("NOKOGIRI_USE_SYSTEM_LIBRARIES")) do |_, default|
|
167
|
+
arg_config('--use-system-libraries', default)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
109
171
|
def windows?
|
110
172
|
RbConfig::CONFIG['target_os'] =~ /mingw32|mswin/
|
111
173
|
end
|
@@ -127,15 +189,19 @@ def aix?
|
|
127
189
|
end
|
128
190
|
|
129
191
|
def nix?
|
130
|
-
!
|
192
|
+
!(windows? || solaris? || darwin?)
|
131
193
|
end
|
132
194
|
|
133
|
-
def
|
195
|
+
def truffle?
|
196
|
+
::RUBY_ENGINE == 'truffleruby'
|
197
|
+
end
|
198
|
+
|
199
|
+
def concat_flags(*args)
|
134
200
|
args.compact.join(" ")
|
135
201
|
end
|
136
202
|
|
137
|
-
def local_have_library(lib, func=nil, headers=nil)
|
138
|
-
have_library(lib, func, headers)
|
203
|
+
def local_have_library(lib, func = nil, headers = nil)
|
204
|
+
have_library(lib, func, headers) || have_library("lib#{lib}", func, headers)
|
139
205
|
end
|
140
206
|
|
141
207
|
LOCAL_PACKAGE_RESPONSE = Object.new
|
@@ -145,7 +211,7 @@ end
|
|
145
211
|
|
146
212
|
# wrapper around MakeMakefil#pkg_config and the PKGConfig gem
|
147
213
|
def try_package_configuration(pc)
|
148
|
-
|
214
|
+
unless ENV.key?("NOKOGIRI_TEST_PKG_CONFIG_GEM")
|
149
215
|
# try MakeMakefile#pkg_config, which uses the system utility `pkg-config`.
|
150
216
|
return if checking_for("#{pc} using `pkg_config`", LOCAL_PACKAGE_RESPONSE) do
|
151
217
|
pkg_config(pc)
|
@@ -157,7 +223,7 @@ def try_package_configuration(pc)
|
|
157
223
|
# same logic as MakeMakefile#pkg_config
|
158
224
|
begin
|
159
225
|
require 'rubygems'
|
160
|
-
gem
|
226
|
+
gem('pkg-config', REQUIRED_PKG_CONFIG_VERSION)
|
161
227
|
require 'pkg-config'
|
162
228
|
|
163
229
|
checking_for("#{pc} using pkg-config gem version #{PKGConfig::VERSION}", LOCAL_PACKAGE_RESPONSE) do
|
@@ -166,14 +232,14 @@ def try_package_configuration(pc)
|
|
166
232
|
ldflags = PKGConfig.libs_only_L(pc)
|
167
233
|
libs = PKGConfig.libs_only_l(pc)
|
168
234
|
|
169
|
-
Logging
|
170
|
-
Logging
|
235
|
+
Logging.message("pkg-config gem found package configuration for %s\n", pc)
|
236
|
+
Logging.message("cflags: %s\nldflags: %s\nlibs: %s\n\n", cflags, ldflags, libs)
|
171
237
|
|
172
238
|
[cflags, ldflags, libs]
|
173
239
|
end
|
174
240
|
end
|
175
241
|
rescue LoadError
|
176
|
-
message
|
242
|
+
message("Please install either the `pkg-config` utility or the `pkg-config` rubygem.\n")
|
177
243
|
end
|
178
244
|
end
|
179
245
|
|
@@ -185,7 +251,7 @@ def have_package_configuration(opt: nil, pc: nil, lib:, func:, headers:)
|
|
185
251
|
end
|
186
252
|
|
187
253
|
# see if we have enough path info to do this without trying any harder
|
188
|
-
|
254
|
+
unless ENV.key?("NOKOGIRI_TEST_PKG_CONFIG")
|
189
255
|
return true if local_have_library(lib, func, headers)
|
190
256
|
end
|
191
257
|
|
@@ -196,12 +262,12 @@ def have_package_configuration(opt: nil, pc: nil, lib:, func:, headers:)
|
|
196
262
|
end
|
197
263
|
|
198
264
|
def ensure_package_configuration(opt: nil, pc: nil, lib:, func:, headers:)
|
199
|
-
have_package_configuration(opt: opt, pc: pc, lib: lib, func: func, headers: headers)
|
265
|
+
have_package_configuration(opt: opt, pc: pc, lib: lib, func: func, headers: headers) ||
|
200
266
|
abort_could_not_find_library(lib)
|
201
267
|
end
|
202
268
|
|
203
|
-
def ensure_func(func, headers=nil)
|
204
|
-
have_func(func, headers)
|
269
|
+
def ensure_func(func, headers = nil)
|
270
|
+
have_func(func, headers) || abort_could_not_find_library(func)
|
205
271
|
end
|
206
272
|
|
207
273
|
def preserving_globals
|
@@ -212,7 +278,7 @@ ensure
|
|
212
278
|
end
|
213
279
|
|
214
280
|
def abort_could_not_find_library(lib)
|
215
|
-
abort
|
281
|
+
abort("-----\n#{caller[0]}\n#{lib} is missing. Please locate mkmf.log to investigate how it is failing.\n-----")
|
216
282
|
end
|
217
283
|
|
218
284
|
def chdir_for_build
|
@@ -225,7 +291,7 @@ def chdir_for_build
|
|
225
291
|
end
|
226
292
|
end
|
227
293
|
|
228
|
-
def sh_export_path
|
294
|
+
def sh_export_path(path)
|
229
295
|
# because libxslt 1.1.29 configure.in uses AC_PATH_TOOL which treats ":"
|
230
296
|
# as a $PATH separator, we need to convert windows paths from
|
231
297
|
#
|
@@ -237,7 +303,7 @@ def sh_export_path path
|
|
237
303
|
#
|
238
304
|
# which is sh-compatible, in order to find things properly during
|
239
305
|
# configuration
|
240
|
-
return path
|
306
|
+
return path unless windows?
|
241
307
|
|
242
308
|
match = Regexp.new("^([A-Z]):(/.*)").match(path)
|
243
309
|
if match && match.length == 3
|
@@ -250,31 +316,26 @@ end
|
|
250
316
|
def libflag_to_filename(ldflag)
|
251
317
|
case ldflag
|
252
318
|
when /\A-l(.+)/
|
253
|
-
"lib#{
|
319
|
+
"lib#{Regexp.last_match(1)}.#{$LIBEXT}"
|
254
320
|
end
|
255
321
|
end
|
256
322
|
|
257
|
-
def
|
258
|
-
# NOTE: TruffleRuby uses this env var as it does not support using static libraries yet.
|
259
|
-
arg_config('--use-system-libraries', ENV.key?("NOKOGIRI_USE_SYSTEM_LIBRARIES"))
|
260
|
-
end
|
261
|
-
|
262
|
-
def have_libxml_headers?(version=nil)
|
323
|
+
def have_libxml_headers?(version = nil)
|
263
324
|
source = if version.nil?
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
try_cpp
|
325
|
+
<<~SRC
|
326
|
+
#include <libxml/xmlversion.h>
|
327
|
+
SRC
|
328
|
+
else
|
329
|
+
version_int = format("%d%2.2d%2.2d", *version.split("."))
|
330
|
+
<<~SRC
|
331
|
+
#include <libxml/xmlversion.h>
|
332
|
+
#if LIBXML_VERSION < #{version_int}
|
333
|
+
# error libxml2 is older than #{version}
|
334
|
+
#endif
|
335
|
+
SRC
|
336
|
+
end
|
337
|
+
|
338
|
+
try_cpp(source)
|
278
339
|
end
|
279
340
|
|
280
341
|
def try_link_iconv(using = nil)
|
@@ -302,19 +363,18 @@ def iconv_configure_flags
|
|
302
363
|
# give --with-iconv-dir and --with-opt-dir first priority
|
303
364
|
["iconv", "opt"].each do |target|
|
304
365
|
config = preserving_globals { dir_config(target) }
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
end
|
311
|
-
|
312
|
-
return [
|
313
|
-
'--with-iconv=yes',
|
314
|
-
*("CPPFLAGS=#{idirs.map { |dir| '-I' + dir }.join(' ')}" if idirs),
|
315
|
-
*("LDFLAGS=#{ldirs.map { |dir| '-L' + dir }.join(' ')}" if ldirs),
|
316
|
-
]
|
366
|
+
next unless config.any? && try_link_iconv("--with-#{target}-* flags") { dir_config(target) }
|
367
|
+
idirs, ldirs = config.map do |dirs|
|
368
|
+
Array(dirs).flat_map do |dir|
|
369
|
+
dir.split(File::PATH_SEPARATOR)
|
370
|
+
end if dirs
|
317
371
|
end
|
372
|
+
|
373
|
+
return [
|
374
|
+
'--with-iconv=yes',
|
375
|
+
*("CPPFLAGS=#{idirs.map { |dir| '-I' + dir }.join(' ')}" if idirs),
|
376
|
+
*("LDFLAGS=#{ldirs.map { |dir| '-L' + dir }.join(' ')}" if ldirs),
|
377
|
+
]
|
318
378
|
end
|
319
379
|
|
320
380
|
if try_link_iconv
|
@@ -333,14 +393,14 @@ def iconv_configure_flags
|
|
333
393
|
]
|
334
394
|
end
|
335
395
|
|
336
|
-
abort_could_not_find_library
|
396
|
+
abort_could_not_find_library("libiconv")
|
337
397
|
end
|
338
398
|
|
339
399
|
def process_recipe(name, version, static_p, cross_p)
|
340
400
|
require 'rubygems'
|
341
|
-
gem
|
401
|
+
gem('mini_portile2', REQUIRED_MINI_PORTILE_VERSION)
|
342
402
|
require 'mini_portile2'
|
343
|
-
message
|
403
|
+
message("Using mini_portile version #{MiniPortile::VERSION}\n")
|
344
404
|
|
345
405
|
if name != "libxml2" && name != "libxslt"
|
346
406
|
OTHER_LIBRARY_VERSIONS[name] = version
|
@@ -352,12 +412,12 @@ def process_recipe(name, version, static_p, cross_p)
|
|
352
412
|
# correct compiler prefix for cross build, but use host if not set.
|
353
413
|
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
354
414
|
recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", name, "*.patch")].sort
|
355
|
-
recipe.configure_options << "--libdir=#{File.join(recipe.path,
|
415
|
+
recipe.configure_options << "--libdir=#{File.join(recipe.path, 'lib')}"
|
356
416
|
|
357
417
|
yield recipe
|
358
418
|
|
359
419
|
env = Hash.new do |hash, key|
|
360
|
-
hash[key] =
|
420
|
+
hash[key] = (ENV[key]).to_s
|
361
421
|
end
|
362
422
|
|
363
423
|
recipe.configure_options.flatten!
|
@@ -365,10 +425,10 @@ def process_recipe(name, version, static_p, cross_p)
|
|
365
425
|
recipe.configure_options.delete_if do |option|
|
366
426
|
case option
|
367
427
|
when /\A(\w+)=(.*)\z/
|
368
|
-
if env.key?(
|
369
|
-
|
428
|
+
env[Regexp.last_match(1)] = if env.key?(Regexp.last_match(1))
|
429
|
+
concat_flags(env[Regexp.last_match(1)], Regexp.last_match(2))
|
370
430
|
else
|
371
|
-
|
431
|
+
Regexp.last_match(2)
|
372
432
|
end
|
373
433
|
true
|
374
434
|
else
|
@@ -410,34 +470,34 @@ def process_recipe(name, version, static_p, cross_p)
|
|
410
470
|
|
411
471
|
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
|
412
472
|
if File.exist?(checkpoint)
|
413
|
-
message
|
473
|
+
message("Building Nokogiri with a packaged version of #{name}-#{version}.\n")
|
414
474
|
else
|
415
|
-
message
|
475
|
+
message(<<~EOM)
|
416
476
|
---------- IMPORTANT NOTICE ----------
|
417
477
|
Building Nokogiri with a packaged version of #{name}-#{version}.
|
418
478
|
Configuration options: #{recipe.configure_options.shelljoin}
|
419
479
|
EOM
|
420
480
|
|
421
481
|
unless recipe.patch_files.empty?
|
422
|
-
message
|
482
|
+
message("The following patches are being applied:\n")
|
423
483
|
|
424
484
|
recipe.patch_files.each do |patch|
|
425
|
-
message
|
485
|
+
message(" - %s\n" % File.basename(patch))
|
426
486
|
end
|
427
487
|
end
|
428
488
|
|
429
|
-
message
|
489
|
+
message(<<~EOM)
|
430
490
|
|
431
491
|
The Nokogiri maintainers intend to provide timely security updates, but if
|
432
492
|
this is a concern for you and want to use your OS/distro system library
|
433
493
|
instead, then abort this installation process and install nokogiri as
|
434
494
|
instructed at:
|
435
495
|
|
436
|
-
https://nokogiri.org/tutorials/installing_nokogiri.html#
|
496
|
+
https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries
|
437
497
|
|
438
498
|
EOM
|
439
499
|
|
440
|
-
message
|
500
|
+
message(<<~EOM) if name == 'libxml2'
|
441
501
|
Note, however, that nokogiri cannot guarantee compatiblity with every
|
442
502
|
version of libxml2 that may be provided by OS/package vendors.
|
443
503
|
|
@@ -446,7 +506,7 @@ def process_recipe(name, version, static_p, cross_p)
|
|
446
506
|
chdir_for_build do
|
447
507
|
recipe.cook
|
448
508
|
end
|
449
|
-
FileUtils.touch
|
509
|
+
FileUtils.touch(checkpoint)
|
450
510
|
end
|
451
511
|
recipe.activate
|
452
512
|
end
|
@@ -461,8 +521,8 @@ def copy_packaged_libraries_headers(to_path:, from_recipes:)
|
|
461
521
|
end
|
462
522
|
|
463
523
|
def do_help
|
464
|
-
print
|
465
|
-
exit!
|
524
|
+
print(NOKOGIRI_HELP_MESSAGE)
|
525
|
+
exit!(0)
|
466
526
|
end
|
467
527
|
|
468
528
|
def do_clean
|
@@ -471,7 +531,7 @@ def do_clean
|
|
471
531
|
|
472
532
|
# Skip if this is a development work tree
|
473
533
|
unless (root + '.git').exist?
|
474
|
-
message
|
534
|
+
message("Cleaning files only used during build.\n")
|
475
535
|
|
476
536
|
# (root + 'tmp') cannot be removed at this stage because
|
477
537
|
# nokogiri.so is yet to be copied to lib.
|
@@ -481,7 +541,7 @@ def do_clean
|
|
481
541
|
FileUtils.rm_rf(dir, verbose: true)
|
482
542
|
end
|
483
543
|
|
484
|
-
if
|
544
|
+
if config_static?
|
485
545
|
# ports installation can be safely removed if statically linked.
|
486
546
|
FileUtils.rm_rf(root + 'ports', verbose: true)
|
487
547
|
else
|
@@ -489,7 +549,7 @@ def do_clean
|
|
489
549
|
end
|
490
550
|
end
|
491
551
|
|
492
|
-
exit!
|
552
|
+
exit!(0)
|
493
553
|
end
|
494
554
|
|
495
555
|
#
|
@@ -498,10 +558,10 @@ end
|
|
498
558
|
do_help if arg_config('--help')
|
499
559
|
do_clean if arg_config('--clean')
|
500
560
|
|
501
|
-
if openbsd? && !
|
502
|
-
if
|
503
|
-
ENV['CC'] ||= find_executable('egcc')
|
504
|
-
abort
|
561
|
+
if openbsd? && !config_system_libraries?
|
562
|
+
if %x(#{ENV['CC'] || '/usr/bin/cc'} -v 2>&1) !~ /clang/
|
563
|
+
(ENV['CC'] ||= find_executable('egcc')) ||
|
564
|
+
abort("Please install gcc 4.9+ from ports using `pkg_add -v gcc`")
|
505
565
|
end
|
506
566
|
append_cppflags "-I/usr/local/include"
|
507
567
|
end
|
@@ -513,21 +573,42 @@ end
|
|
513
573
|
# use same c compiler for libxml and libxslt
|
514
574
|
ENV['CC'] = RbConfig::CONFIG['CC']
|
515
575
|
|
576
|
+
if arg_config('--prevent-strip')
|
577
|
+
old_cflags = $CFLAGS.split.join(" ")
|
578
|
+
old_ldflags = $LDFLAGS.split.join(" ")
|
579
|
+
old_dldflags = $DLDFLAGS.split.join(" ")
|
580
|
+
$CFLAGS = $CFLAGS.split.reject { |flag| flag == "-s" }.join(" ")
|
581
|
+
$LDFLAGS = $LDFLAGS.split.reject { |flag| flag == "-s" }.join(" ")
|
582
|
+
$DLDFLAGS = $DLDFLAGS.split.reject { |flag| flag == "-s" }.join(" ")
|
583
|
+
puts "Prevent stripping by removing '-s' from $CFLAGS" if old_cflags != $CFLAGS
|
584
|
+
puts "Prevent stripping by removing '-s' from $LDFLAGS" if old_ldflags != $LDFLAGS
|
585
|
+
puts "Prevent stripping by removing '-s' from $DLDFLAGS" if old_dldflags != $DLDFLAGS
|
586
|
+
end
|
587
|
+
|
516
588
|
# adopt environment config
|
517
|
-
append_cflags(ENV["CFLAGS"].split
|
518
|
-
append_cppflags(ENV["CPPFLAGS"].split
|
519
|
-
append_ldflags(ENV["LDFLAGS"].split
|
589
|
+
append_cflags(ENV["CFLAGS"].split) unless ENV["CFLAGS"].nil?
|
590
|
+
append_cppflags(ENV["CPPFLAGS"].split) unless ENV["CPPFLAGS"].nil?
|
591
|
+
append_ldflags(ENV["LDFLAGS"].split) unless ENV["LDFLAGS"].nil?
|
520
592
|
$LIBS = concat_flags($LIBS, ENV["LIBS"])
|
521
593
|
|
522
|
-
|
523
|
-
append_cflags("-
|
524
|
-
|
594
|
+
# always include debugging information
|
595
|
+
append_cflags("-g")
|
596
|
+
|
597
|
+
# we use at least one inline function in the C extension
|
598
|
+
append_cflags("-Winline")
|
599
|
+
|
600
|
+
# good to have no matter what Ruby was compiled with
|
601
|
+
append_cflags("-Wmissing-noreturn")
|
602
|
+
|
603
|
+
# handle clang variations, see #1101
|
525
604
|
append_cflags("-Wno-error=unused-command-line-argument-hard-error-in-future") if darwin?
|
526
|
-
|
605
|
+
|
606
|
+
# these tend to be noisy, but on occasion useful during development
|
607
|
+
# append_cflags(["-Wcast-qual", "-Wwrite-strings"])
|
527
608
|
|
528
609
|
# Add SDK-specific include path for macOS and brew versions before v2.2.12 (2020-04-08) [#1851, #1801]
|
529
610
|
macos_mojave_sdk_include_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2"
|
530
|
-
if
|
611
|
+
if config_system_libraries? && darwin? && Dir.exist?(macos_mojave_sdk_include_path)
|
531
612
|
append_cppflags("-I#{macos_mojave_sdk_include_path}")
|
532
613
|
end
|
533
614
|
|
@@ -535,26 +616,30 @@ end
|
|
535
616
|
# See https://sourceforge.net/p/mingw/bugs/2142
|
536
617
|
append_cppflags(' "-Idummypath"') if windows?
|
537
618
|
|
538
|
-
if
|
619
|
+
if config_system_libraries?
|
539
620
|
message "Building nokogiri using system libraries.\n"
|
540
|
-
ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
|
541
|
-
|
542
|
-
ensure_package_configuration(opt: "
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
621
|
+
ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
|
622
|
+
headers: "zlib.h", func: "gzdopen")
|
623
|
+
ensure_package_configuration(opt: "xml2", pc: "libxml-2.0", lib: "xml2",
|
624
|
+
headers: "libxml/parser.h", func: "xmlParseDoc")
|
625
|
+
ensure_package_configuration(opt: "xslt", pc: "libxslt", lib: "xslt",
|
626
|
+
headers: "libxslt/xslt.h", func: "xsltParseStylesheetDoc")
|
627
|
+
ensure_package_configuration(opt: "exslt", pc: "libexslt", lib: "exslt",
|
628
|
+
headers: "libexslt/exslt.h", func: "exsltFuncRegister")
|
629
|
+
|
630
|
+
have_libxml_headers?(REQUIRED_LIBXML_VERSION) ||
|
631
|
+
abort("ERROR: libxml2 version #{REQUIRED_LIBXML_VERSION} or later is required!")
|
632
|
+
have_libxml_headers?(RECOMMENDED_LIBXML_VERSION) ||
|
633
|
+
warn("WARNING: libxml2 version #{RECOMMENDED_LIBXML_VERSION} or later is highly recommended, but proceeding anyway.")
|
549
634
|
|
550
635
|
else
|
551
636
|
message "Building nokogiri using packaged libraries.\n"
|
552
637
|
|
553
|
-
static_p =
|
554
|
-
message "Static linking is #{static_p ?
|
638
|
+
static_p = config_static?
|
639
|
+
message "Static linking is #{static_p ? 'enabled' : 'disabled'}.\n"
|
555
640
|
|
556
|
-
cross_build_p =
|
557
|
-
message "Cross build is #{cross_build_p ?
|
641
|
+
cross_build_p = config_cross_build?
|
642
|
+
message "Cross build is #{cross_build_p ? 'enabled' : 'disabled'}.\n"
|
558
643
|
|
559
644
|
require 'yaml'
|
560
645
|
dependencies = YAML.load_file(File.join(PACKAGE_ROOT_DIR, "dependencies.yml"))
|
@@ -564,17 +649,17 @@ else
|
|
564
649
|
if cross_build_p || windows?
|
565
650
|
zlib_recipe = process_recipe("zlib", dependencies["zlib"]["version"], static_p, cross_build_p) do |recipe|
|
566
651
|
recipe.files = [{
|
567
|
-
|
568
|
-
|
569
|
-
|
652
|
+
url: "http://zlib.net/fossils/#{recipe.name}-#{recipe.version}.tar.gz",
|
653
|
+
sha256: dependencies["zlib"]["sha256"],
|
654
|
+
}]
|
570
655
|
if windows?
|
571
656
|
class << recipe
|
572
657
|
attr_accessor :cross_build_p
|
573
658
|
|
574
659
|
def configure
|
575
|
-
Dir.chdir
|
576
|
-
mk = File.read
|
577
|
-
File.open
|
660
|
+
Dir.chdir(work_path) do
|
661
|
+
mk = File.read('win32/Makefile.gcc')
|
662
|
+
File.open('win32/Makefile.gcc', 'wb') do |f|
|
578
663
|
f.puts "BINARY_PATH = #{path}/bin"
|
579
664
|
f.puts "LIBRARY_PATH = #{path}/lib"
|
580
665
|
f.puts "INCLUDE_PATH = #{path}/include"
|
@@ -585,17 +670,17 @@ else
|
|
585
670
|
end
|
586
671
|
|
587
672
|
def configured?
|
588
|
-
Dir.chdir
|
589
|
-
!!
|
673
|
+
Dir.chdir(work_path) do
|
674
|
+
!!(File.read('win32/Makefile.gcc') =~ /^BINARY_PATH/)
|
590
675
|
end
|
591
676
|
end
|
592
677
|
|
593
678
|
def compile
|
594
|
-
execute
|
679
|
+
execute("compile", "make -f win32/Makefile.gcc")
|
595
680
|
end
|
596
681
|
|
597
682
|
def install
|
598
|
-
execute
|
683
|
+
execute("install", "make -f win32/Makefile.gcc install")
|
599
684
|
end
|
600
685
|
end
|
601
686
|
recipe.cross_build_p = cross_build_p
|
@@ -603,12 +688,13 @@ else
|
|
603
688
|
class << recipe
|
604
689
|
def configure
|
605
690
|
cflags = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
|
606
|
-
execute
|
691
|
+
execute("configure",
|
692
|
+
["env", "CHOST=#{host}", "CFLAGS=#{cflags}", "./configure", "--static", configure_prefix])
|
607
693
|
end
|
608
694
|
|
609
695
|
def compile
|
610
|
-
if host
|
611
|
-
execute
|
696
|
+
if host =~ /darwin/
|
697
|
+
execute("compile", "make AR=#{host}-libtool")
|
612
698
|
else
|
613
699
|
super
|
614
700
|
end
|
@@ -618,11 +704,12 @@ else
|
|
618
704
|
end
|
619
705
|
|
620
706
|
unless nix?
|
621
|
-
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p,
|
707
|
+
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p,
|
708
|
+
cross_build_p) do |recipe|
|
622
709
|
recipe.files = [{
|
623
|
-
|
624
|
-
|
625
|
-
|
710
|
+
url: "http://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
|
711
|
+
sha256: dependencies["libiconv"]["sha256"],
|
712
|
+
}]
|
626
713
|
|
627
714
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
628
715
|
|
@@ -630,37 +717,35 @@ else
|
|
630
717
|
"CPPFLAGS=-Wall",
|
631
718
|
"CFLAGS=#{cflags}",
|
632
719
|
"CXXFLAGS=#{cflags}",
|
633
|
-
"LDFLAGS="
|
720
|
+
"LDFLAGS=",
|
634
721
|
]
|
635
722
|
end
|
636
723
|
end
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
-----
|
724
|
+
elsif darwin? && !have_header('iconv.h')
|
725
|
+
abort(<<~EOM.chomp)
|
726
|
+
-----
|
727
|
+
The file "iconv.h" is missing in your build environment,
|
728
|
+
which means you haven't installed Xcode Command Line Tools properly.
|
729
|
+
|
730
|
+
To install Command Line Tools, try running `xcode-select --install` on
|
731
|
+
terminal and follow the instructions. If it fails, open Xcode.app,
|
732
|
+
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
|
733
|
+
Tools" to open the developer site, download the installer for your OS
|
734
|
+
version and run it.
|
735
|
+
-----
|
650
736
|
EOM
|
651
|
-
end
|
652
737
|
end
|
653
738
|
|
654
739
|
unless windows?
|
655
|
-
preserving_globals { local_have_library('z', 'gzdopen', 'zlib.h') }
|
656
|
-
abort
|
740
|
+
preserving_globals { local_have_library('z', 'gzdopen', 'zlib.h') } ||
|
741
|
+
abort('zlib is missing; necessary for building libxml2')
|
657
742
|
end
|
658
743
|
|
659
744
|
libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"]["version"], static_p, cross_build_p) do |recipe|
|
660
745
|
recipe.files = [{
|
661
|
-
|
662
|
-
|
663
|
-
|
746
|
+
url: "http://xmlsoft.org/sources/#{recipe.name}-#{recipe.version}.tar.gz",
|
747
|
+
sha256: dependencies["libxml2"]["sha256"],
|
748
|
+
}]
|
664
749
|
|
665
750
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
666
751
|
|
@@ -679,6 +764,10 @@ else
|
|
679
764
|
recipe.configure_options += ["RANLIB=/usr/bin/ranlib", "AR=/usr/bin/ar"]
|
680
765
|
end
|
681
766
|
|
767
|
+
if windows?
|
768
|
+
cflags = concat_flags(cflags, "-ULIBXML_STATIC", "-DIN_LIBXML")
|
769
|
+
end
|
770
|
+
|
682
771
|
recipe.configure_options += [
|
683
772
|
"--without-python",
|
684
773
|
"--without-readline",
|
@@ -691,9 +780,9 @@ else
|
|
691
780
|
|
692
781
|
libxslt_recipe = process_recipe("libxslt", dependencies["libxslt"]["version"], static_p, cross_build_p) do |recipe|
|
693
782
|
recipe.files = [{
|
694
|
-
|
695
|
-
|
696
|
-
|
783
|
+
url: "http://xmlsoft.org/sources/#{recipe.name}-#{recipe.version}.tar.gz",
|
784
|
+
sha256: dependencies["libxslt"]["sha256"],
|
785
|
+
}]
|
697
786
|
|
698
787
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
699
788
|
|
@@ -721,15 +810,15 @@ else
|
|
721
810
|
libname = recipe.name[/\Alib(.+)\z/, 1]
|
722
811
|
File.join(recipe.path, "bin", "#{libname}-config").tap do |config|
|
723
812
|
# call config scripts explicit with 'sh' for compat with Windows
|
724
|
-
$CPPFLAGS =
|
725
|
-
|
813
|
+
$CPPFLAGS = %x(sh #{config} --cflags).strip << ' ' << $CPPFLAGS
|
814
|
+
%x(sh #{config} --libs).strip.shellsplit.each do |arg|
|
726
815
|
case arg
|
727
816
|
when /\A-L(.+)\z/
|
728
817
|
# Prioritize ports' directories
|
729
|
-
if
|
730
|
-
|
818
|
+
$LIBPATH = if Regexp.last_match(1).start_with?(PACKAGE_ROOT_DIR + '/')
|
819
|
+
[Regexp.last_match(1)] | $LIBPATH
|
731
820
|
else
|
732
|
-
$LIBPATH
|
821
|
+
$LIBPATH | [Regexp.last_match(1)]
|
733
822
|
end
|
734
823
|
when /\A-l./
|
735
824
|
libs.unshift(arg)
|
@@ -740,7 +829,7 @@ else
|
|
740
829
|
end
|
741
830
|
|
742
831
|
patches_string = recipe.patch_files.map { |path| File.basename(path) }.join(' ')
|
743
|
-
append_cppflags(%
|
832
|
+
append_cppflags(%[-DNOKOGIRI_#{recipe.name.upcase}_PATCHES="\\\"#{patches_string}\\\""])
|
744
833
|
|
745
834
|
case libname
|
746
835
|
when 'xml2'
|
@@ -776,7 +865,7 @@ else
|
|
776
865
|
ensure_func("exsltFuncRegister", "libexslt/exslt.h")
|
777
866
|
end
|
778
867
|
|
779
|
-
have_func('xmlHasFeature')
|
868
|
+
have_func('xmlHasFeature') || abort("xmlHasFeature() is missing.") # introduced in libxml 2.6.21
|
780
869
|
have_func('xmlFirstElementChild') # introduced in libxml 2.7.3
|
781
870
|
have_func('xmlRelaxNGSetParserStructuredErrors') # introduced in libxml 2.6.24
|
782
871
|
have_func('xmlRelaxNGSetValidStructuredErrors') # introduced in libxml 2.6.21
|
@@ -785,10 +874,10 @@ have_func('xmlSchemaSetParserStructuredErrors') # introduced in libxml 2.6.23
|
|
785
874
|
|
786
875
|
have_func('vasprintf')
|
787
876
|
|
788
|
-
other_library_versions_string = OTHER_LIBRARY_VERSIONS.map { |k,v| [k,v].join(":") }.join(",")
|
789
|
-
append_cppflags(%
|
877
|
+
other_library_versions_string = OTHER_LIBRARY_VERSIONS.map { |k, v| [k, v].join(":") }.join(",")
|
878
|
+
append_cppflags(%[-DNOKOGIRI_OTHER_LIBRARY_VERSIONS="\\\"#{other_library_versions_string}\\\""])
|
790
879
|
|
791
|
-
unless
|
880
|
+
unless config_system_libraries?
|
792
881
|
if cross_build_p
|
793
882
|
# When precompiling native gems, copy packaged libraries' headers to ext/nokogiri/include
|
794
883
|
# These are packaged up by the cross-compiling callback in the ExtensionTask
|
@@ -804,10 +893,10 @@ end
|
|
804
893
|
|
805
894
|
create_makefile('nokogiri/nokogiri')
|
806
895
|
|
807
|
-
if
|
896
|
+
if config_clean?
|
808
897
|
# Do not clean if run in a development work tree.
|
809
898
|
File.open('Makefile', 'at') do |mk|
|
810
|
-
mk.print
|
899
|
+
mk.print(<<~EOF)
|
811
900
|
|
812
901
|
all: clean-ports
|
813
902
|
clean-ports: $(DLLIB)
|
@@ -815,5 +904,3 @@ if enable_config('clean', true)
|
|
815
904
|
EOF
|
816
905
|
end
|
817
906
|
end
|
818
|
-
|
819
|
-
# :startdoc:
|