nokogiri 1.6.3.1 → 1.6.4

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.

Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -2
  3. data/CHANGELOG.ja.rdoc +16 -0
  4. data/CHANGELOG.rdoc +16 -0
  5. data/Gemfile +2 -2
  6. data/Manifest.txt +2 -11
  7. data/README.ja.rdoc +2 -2
  8. data/README.rdoc +2 -2
  9. data/Rakefile +1 -1
  10. data/build_all +1 -1
  11. data/dependencies.yml +1 -1
  12. data/ext/nokogiri/extconf.rb +115 -82
  13. data/ext/nokogiri/nokogiri.c +4 -0
  14. data/ext/nokogiri/xml_io.c +10 -6
  15. data/ext/nokogiri/xml_syntax_error.c +2 -1
  16. data/lib/nokogiri/css/parser.rb +175 -165
  17. data/lib/nokogiri/css/parser.y +8 -2
  18. data/lib/nokogiri/css/tokenizer.rb +1 -1
  19. data/lib/nokogiri/css/tokenizer.rex +1 -1
  20. data/lib/nokogiri/version.rb +3 -1
  21. data/ports/archives/libxml2-2.9.2.tar.gz +0 -0
  22. data/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch +29 -0
  23. data/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch +31 -0
  24. data/test/css/test_parser.rb +5 -0
  25. data/test/css/test_tokenizer.rb +17 -0
  26. data/test/html/test_document.rb +5 -5
  27. data/test/html/test_document_fragment.rb +5 -0
  28. data/test/xml/test_builder.rb +1 -1
  29. data/test/xml/test_document.rb +1 -9
  30. data/test/xml/test_entity_reference.rb +9 -3
  31. data/test/xml/test_node.rb +1 -1
  32. data/test/xml/test_syntax_error.rb +18 -0
  33. data/test/xml/test_xpath.rb +2 -0
  34. data/test_all +2 -2
  35. metadata +11 -20
  36. data/ports/archives/libxml2-2.8.0.tar.gz +0 -0
  37. data/ports/patches/libxml2/0001-Fix-parser-local-buffers-size-problems.patch +0 -265
  38. data/ports/patches/libxml2/0002-Fix-entities-local-buffers-size-problems.patch +0 -102
  39. data/ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch +0 -26
  40. data/ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch +0 -26
  41. data/ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch +0 -158
  42. data/ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch +0 -78
  43. data/ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch +0 -480
  44. data/ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch +0 -315
  45. data/ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch +0 -37
  46. data/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch +0 -2006
  47. data/ports/patches/libxml2/0011-Do-not-fetch-external-parameter-entities.patch +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17d38f9fb67b16ba272f1396dab02d33fe076506
4
- data.tar.gz: cb53002d5d6c4c6091b9b005eac2ce5cd41820d4
3
+ metadata.gz: a7c7a390c125f0b1eca55141b2c6a2b9269e2ddf
4
+ data.tar.gz: 9e9c9e3ed07a75d4e6cf8f23face26ddf20a4f61
5
5
  SHA512:
6
- metadata.gz: 568fca09f379dd61e9d2bd8dedccc0f25b851ac92d20cc12021ded1083f3f0d9b53a69b84faa162ac5d8a6423adb82cf577fc0d366fec5cfe6c34578a6af4702
7
- data.tar.gz: b2a13c133ccc33f9c0ed0b05f397dd836af3214261bed643c4f925d5a5161b6fb5a69a628f03b5d5759ae1b43a42266869751bea084f1f7cfa35e97e00643627
6
+ metadata.gz: 06ad0bc7f5271e67cd5cc225e9241bea832c4ee5a3944513450506eb305a70ceebc58f9b816623d5966b6f8b72f241782a9a55fa6f490ca8f0645af89d90261e
7
+ data.tar.gz: 295345231210ed1eaae94485abfa9a19edcfdd6afa254ccfc862461f0600332e7fb60bb4b2bad37cac2159e9fd5dd882ed07e08cf20fccc4c0cefde67bcd8371
@@ -2,18 +2,23 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.2
5
+ - 2.1.3
6
6
  - ruby-head
7
7
  - jruby-19mode
8
8
  - jruby-20mode
9
9
  - rbx-19mode
10
10
 
11
+ os:
12
+ - linux
13
+ - osx
14
+
11
15
  jdk:
12
16
  - openjdk7
13
17
  - openjdk6
14
18
 
15
19
  matrix:
16
20
  allow_failures:
21
+ - os: osx
17
22
  - rvm: rbx-19mode
18
23
  # currently broken on Travis CI
19
24
  - rvm: jruby-20mode
@@ -22,7 +27,7 @@ matrix:
22
27
  jdk: openjdk7
23
28
  - rvm: 2.0.0
24
29
  jdk: openjdk7
25
- - rvm: 2.1.2
30
+ - rvm: 2.1.3
26
31
  jdk: openjdk7
27
32
  - rvm: ruby-head
28
33
  jdk: openjdk7
@@ -1,3 +1,19 @@
1
+ === 1.6.4 / 2014-11-04
2
+
3
+ ==== 機能
4
+
5
+ * (MRI) Bundled Libxml2 is upgraded to 2.9.2.
6
+ * (MRI) `nokogiri --version` will include a list of applied patches.
7
+ * (MRI) Nokogiri no longer prints messages directly to TTY while building the extension.
8
+ * (MRI) Detect and help user fix a missing /usr/include/iconv.h on OS X. (#1111)
9
+ * (MRI) Improve the iconv detection for building libxml2.
10
+
11
+ ==== バグ修正
12
+
13
+ * (MRI) Fix DocumentFragment#element_children (#1138).
14
+ * Fix a bug with CSS attribute selector without any prefix where "foo [bar]" was treated as "foo[bar]". (#1174)
15
+
16
+
1
17
  === 1.6.3.1 / 2014年7月21日
2
18
 
3
19
  ==== バグ修正
@@ -1,3 +1,19 @@
1
+ === 1.6.4 / 2014-11-04
2
+
3
+ ==== Features
4
+
5
+ * (MRI) Bundled Libxml2 is upgraded to 2.9.2.
6
+ * (MRI) `nokogiri --version` will include a list of applied patches.
7
+ * (MRI) Nokogiri no longer prints messages directly to TTY while building the extension.
8
+ * (MRI) Detect and help user fix a missing /usr/include/iconv.h on OS X. (#1111)
9
+ * (MRI) Improve the iconv detection for building libxml2.
10
+
11
+ ==== Bug fixes
12
+
13
+ * (MRI) Fix DocumentFragment#element_children (#1138).
14
+ * Fix a bug with CSS attribute selector without any prefix where "foo [bar]" was treated as "foo[bar]". (#1174)
15
+
16
+
1
17
  === 1.6.3.1 / 2014-07-21
2
18
 
3
19
  ==== Bug fixes
data/Gemfile CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  source "https://rubygems.org/"
6
6
 
7
- gem "mini_portile", "=0.6.0"
7
+ gem "mini_portile", "~>0.6.0"
8
8
 
9
9
  gem "rdoc", "~>4.0", :group => [:development, :test]
10
10
  gem "hoe-bundler", ">=1.1", :group => [:development, :test]
@@ -16,6 +16,6 @@ gem "rake", ">=0.9", :group => [:development, :test]
16
16
  gem "rake-compiler", "~>0.9.2", :group => [:development, :test]
17
17
  gem "racc", ">=1.4.6", :group => [:development, :test], :platform => :ruby
18
18
  gem "rexical", ">=1.0.5", :group => [:development, :test], :platform => :ruby
19
- gem "hoe", "~>3.7", :group => [:development, :test]
19
+ gem "hoe", "~>3.13", :group => [:development, :test]
20
20
 
21
21
  # vim: syntax=ruby
@@ -239,17 +239,8 @@ lib/nokogiri/xslt.rb
239
239
  lib/nokogiri/xslt/stylesheet.rb
240
240
  lib/xercesImpl.jar
241
241
  lib/xsd/xmlparser/nokogiri.rb
242
- ports/patches/libxml2/0001-Fix-parser-local-buffers-size-problems.patch
243
- ports/patches/libxml2/0002-Fix-entities-local-buffers-size-problems.patch
244
- ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch
245
- ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch
246
- ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch
247
- ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch
248
- ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
249
- ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch
250
- ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch
251
- ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
252
- ports/patches/libxml2/0011-Do-not-fetch-external-parameter-entities.patch
242
+ ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch
243
+ ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
253
244
  ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch
254
245
  ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
255
246
  ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch
@@ -67,7 +67,7 @@ IRCのチャンネルはfreenodeの #nokogiri です。
67
67
  * Nokogiri 1.6.0以降ではlibxml2とlibxsltは同梱されているが、
68
68
  もしインストール済みのものを使いたい場合:
69
69
 
70
- * libxml2 2.6.17以上2.9.0未満, iconvサポート付きのもの
70
+ * libxml2 2.6.21以上, iconvサポート付きのもの
71
71
  (libxml2-dev/-develパッケージも必要)
72
72
 
73
73
  * libxslt 上記のlibxml2でビルドされ、サポートされているもの
@@ -81,7 +81,7 @@ IRCのチャンネルはfreenodeの #nokogiri です。
81
81
 
82
82
  (The MIT License)
83
83
 
84
- Copyright (c) 2008 - 2013:
84
+ Copyright (c) 2008 - 2014:
85
85
 
86
86
  * {Aaron Patterson}[http://tenderlovemaking.com]
87
87
  * {Mike Dalessio}[http://mike.daless.io]
@@ -77,7 +77,7 @@ The IRC channel is #nokogiri on freenode.
77
77
  * in Nokogiri 1.6.0 and later libxml2 and libxslt are bundled with the
78
78
  gem, but if you want to use them installed on the system:
79
79
 
80
- * libxml2 >=2.6.21 and <2.9.0, with iconv support
80
+ * libxml2 >=2.6.21 with iconv support
81
81
  (libxml2-dev/-devel is required too)
82
82
 
83
83
  * libxslt, built with and supported by the given libxml2
@@ -150,7 +150,7 @@ Then run rake:
150
150
 
151
151
  (The MIT License)
152
152
 
153
- Copyright (c) 2008 - 2013:
153
+ Copyright (c) 2008 - 2014:
154
154
 
155
155
  * {Aaron Patterson}[http://tenderlovemaking.com]
156
156
  * {Mike Dalessio}[http://mike.daless.io]
data/Rakefile CHANGED
@@ -136,7 +136,7 @@ HOE = Hoe.spec 'nokogiri' do
136
136
  # for more details, see:
137
137
  # - https://github.com/sparklemotion/nokogiri/issues/1102
138
138
  # - https://github.com/luislavena/mini_portile/issues/32
139
- ["mini_portile", "= 0.6.0"],
139
+ ["mini_portile", "~> 0.6.0"],
140
140
  ]
141
141
  end
142
142
 
data/build_all CHANGED
@@ -54,7 +54,7 @@ fi
54
54
 
55
55
  rvm_use () {
56
56
  current_ruby=$1
57
- rvm use "${1}@nokogiri" --create || rvm -v
57
+ rvm use "${1}@nokogiri" --create
58
58
  }
59
59
 
60
60
  rvm_do () {
@@ -1,4 +1,4 @@
1
- libxml2: "2.8.0"
1
+ libxml2: "2.9.2"
2
2
  libxslt: "1.1.28"
3
3
  zlib: "1.2.8"
4
4
  libiconv: "1.14"
@@ -40,16 +40,6 @@ HELP
40
40
  exit! 0
41
41
  end
42
42
 
43
- def message!(important_message)
44
- message important_message
45
- if !$stdout.tty? && File.chardev?('/dev/tty')
46
- File.open('/dev/tty', 'w') { |tty|
47
- tty.print important_message
48
- }
49
- end
50
- rescue Errno::ENXIO
51
- end
52
-
53
43
  def do_clean
54
44
  require 'pathname'
55
45
  require 'fileutils'
@@ -81,6 +71,19 @@ def do_clean
81
71
  exit! 0
82
72
  end
83
73
 
74
+ def add_cflags(flags)
75
+ print "checking if the C compiler accepts #{flags}... "
76
+ with_cflags("#{$CFLAGS} #{flags}") do
77
+ if try_compile("int main() {return 0;}", werror: true)
78
+ puts 'yes'
79
+ true
80
+ else
81
+ puts 'no'
82
+ false
83
+ end
84
+ end
85
+ end
86
+
84
87
  def preserving_globals
85
88
  values = [
86
89
  $arg_config,
@@ -96,58 +99,68 @@ ensure
96
99
  end
97
100
 
98
101
  def asplode(lib)
99
- abort "-----\n#{lib} is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.\n-----"
102
+ abort "-----\n#{lib} is missing. Please locate mkmf.log to investigate how it is failing.\n-----"
100
103
  end
101
104
 
102
- def have_iconv?
103
- have_header('iconv.h') or return false
104
- %w{ iconv_open libiconv_open }.any? do |method|
105
- have_func(method, 'iconv.h') or
106
- have_library('iconv', method, 'iconv.h')
107
- end
105
+ def have_iconv?(using = nil)
106
+ checking_for(using ? "iconv using #{using}" : 'iconv') {
107
+ ['', '-liconv'].any? { |opt|
108
+ preserving_globals {
109
+ yield if block_given?
110
+
111
+ try_link(<<-'SRC', opt)
112
+ #include <stdlib.h>
113
+ #include <iconv.h>
114
+
115
+ int main(void)
116
+ {
117
+ iconv_t cd = iconv_open("", "");
118
+ iconv(cd, NULL, NULL, NULL, NULL);
119
+ return EXIT_SUCCESS;
120
+ }
121
+ SRC
122
+ }
123
+ }
124
+ }
108
125
  end
109
126
 
110
- def each_iconv_idir
127
+ def iconv_configure_flags
111
128
  # If --with-iconv-dir or --with-opt-dir is given, it should be
112
129
  # the first priority
113
- %w[iconv opt].each { |config|
114
- idir = preserving_globals {
115
- dir_config(config)
116
- }.first and yield idir
117
- }
118
-
119
- # Try the system default
120
- yield "/usr/include"
130
+ %w[iconv opt].each { |name|
131
+ if (config = preserving_globals { dir_config(name) }).any? &&
132
+ have_iconv?("--with-#{name}-* flags") { dir_config(name) }
133
+ idirs, ldirs = config.map { |dirs|
134
+ Array(dirs).flat_map { |dir|
135
+ dir.split(File::PATH_SEPARATOR)
136
+ } if dirs
137
+ }
121
138
 
122
- cflags, = preserving_globals {
123
- pkg_config('libiconv')
139
+ return [
140
+ '--with-iconv=yes',
141
+ *("CPPFLAGS=#{idirs.map { |dir| '-I' << dir }.join(' ')}".quote if idirs),
142
+ *("LDFLAGS=#{ldirs.map { |dir| '-L' << dir }.join(' ')}".quote if ldirs),
143
+ ]
144
+ end
124
145
  }
125
- if cflags
126
- cflags.shellsplit.each { |arg|
127
- arg.sub!(/\A-I/, '') and
128
- yield arg
129
- }
146
+
147
+ if have_iconv?
148
+ return ['--with-iconv=yes']
130
149
  end
131
150
 
132
- nil
133
- end
151
+ if (config = preserving_globals { pkg_config('libiconv') }) &&
152
+ have_iconv?('pkg-config libiconv') { pkg_config('libiconv') }
153
+ cflags, ldflags, libs = config
134
154
 
135
- def iconv_prefix
136
- # Make sure libxml2 is built with iconv
137
- each_iconv_idir { |idir|
138
- next unless File.file?(File.join(idir, 'iconv.h'))
139
-
140
- prefix, dir = File.split(idir)
141
- next unless dir == 'include'
142
-
143
- preserving_globals {
144
- # Follow the way libxml2's configure uses a value given with
145
- # --with-iconv[=DIR]
146
- $CPPFLAGS = "-I#{idir}".quote << ' ' << $CPPFLAGS
147
- $LIBPATH.unshift(File.join(prefix, "lib"))
148
- have_iconv?
149
- } and break prefix
150
- } or asplode "libiconv"
155
+ return [
156
+ '--with-iconv=yes',
157
+ "CPPFLAGS=#{cflags}".quote,
158
+ "LDFLAGS=#{ldflags}".quote,
159
+ "LIBS=#{libs}".quote,
160
+ ]
161
+ end
162
+
163
+ asplode "libiconv"
151
164
  end
152
165
 
153
166
  def process_recipe(name, version, static_p, cross_p)
@@ -208,25 +221,31 @@ def process_recipe(name, version, static_p, cross_p)
208
221
  "#{key}=#{value}".shellescape
209
222
  }
210
223
 
211
- if recipe.patch_files.empty?
212
- message! "Building #{name}-#{version} for nokogiri.\n"
213
- else
214
- message! "Building #{name}-#{version} for nokogiri with the following patches applied:\n"
224
+ message <<-"EOS"
225
+ ************************************************************************
226
+ IMPORTANT NOTICE:
227
+
228
+ Buidling Nokogiri with a packaged version of #{name}-#{version}#{'.' if recipe.patch_files.empty?}
229
+ EOS
230
+
231
+ unless recipe.patch_files.empty?
232
+ message "with the following patches applied:\n"
215
233
 
216
234
  recipe.patch_files.each { |patch|
217
- message! "\t- %s\n" % File.basename(patch)
235
+ message "\t- %s\n" % File.basename(patch)
218
236
  }
219
237
  end
220
238
 
221
- message! <<-"EOS"
222
- ************************************************************************
223
- IMPORTANT! Nokogiri builds and uses a packaged version of #{name}.
239
+ message <<-"EOS"
224
240
 
225
- If this is a concern for you and you want to use the system library
226
- instead, abort this installation process and reinstall nokogiri as
227
- follows:
241
+ Team Nokogiri will keep on doing their best to provide security
242
+ updates in a timely manner, but if this is a concern for you and want
243
+ to use the system library instead; abort this installation process and
244
+ reinstall nokogiri as follows:
228
245
 
229
246
  gem install nokogiri -- --use-system-libraries
247
+ [--with-xml2-config=/path/to/xml2-config]
248
+ [--with-xslt-config=/path/to/xslt-config]
230
249
 
231
250
  If you are using Bundler, tell it to use the option:
232
251
 
@@ -234,17 +253,13 @@ If you are using Bundler, tell it to use the option:
234
253
  bundle install
235
254
  EOS
236
255
 
237
- message! <<-"EOS" if name == 'libxml2'
238
-
239
- However, note that nokogiri does not necessarily support all versions
240
- of libxml2.
256
+ message <<-"EOS" if name == 'libxml2'
241
257
 
242
- For example, libxml2-2.9.0 and higher are currently known to be broken
243
- and thus unsupported by nokogiri, due to compatibility problems and
244
- XPath optimization bugs.
258
+ Note, however, that nokogiri is not fully compatible with arbitrary
259
+ versions of libxml2 provided by OS/package vendors.
245
260
  EOS
246
261
 
247
- message! <<-"EOS"
262
+ message <<-"EOS"
248
263
  ************************************************************************
249
264
  EOS
250
265
 
@@ -302,9 +317,11 @@ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'macruby'
302
317
  $LIBRUBYARG_STATIC.gsub!(/-static/, '')
303
318
  end
304
319
 
305
- $CFLAGS << " #{ENV["CFLAGS"]}"
306
320
  $LIBS << " #{ENV["LIBS"]}"
307
321
 
322
+ # Read CFLAGS from ENV and make sure compiling works.
323
+ add_cflags(ENV["CFLAGS"])
324
+
308
325
  case RbConfig::CONFIG['target_os']
309
326
  when 'mingw32', /mswin/
310
327
  windows_p = true
@@ -312,9 +329,9 @@ when 'mingw32', /mswin/
312
329
  when /solaris/
313
330
  $CFLAGS << " -DUSE_INCLUDED_VASPRINTF"
314
331
  when /darwin/
315
- if RbConfig::MAKEFILE_CONFIG['CC'] !~ /gcc/ then
316
- $CFLAGS << " -Wno-error=unused-command-line-argument-hard-error-in-future"
317
- end
332
+ darwin_p = true
333
+ # Let Apple LLVM/clang 5.1 ignore unknown compiler flags
334
+ add_cflags("-Wno-error=unused-command-line-argument-hard-error-in-future")
318
335
  else
319
336
  $CFLAGS << " -g -DXP_UNIX"
320
337
  end
@@ -332,7 +349,7 @@ end
332
349
 
333
350
  case
334
351
  when arg_config('--use-system-libraries', !!ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'])
335
- message! "Building nokogiri using system libraries.\n"
352
+ message "Building nokogiri using system libraries.\n"
336
353
 
337
354
  dir_config('zlib')
338
355
 
@@ -347,26 +364,26 @@ when arg_config('--use-system-libraries', !!ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES']
347
364
  #include <libxml/xmlversion.h>
348
365
 
349
366
  #if LIBXML_VERSION < 20621
350
- #error libxml2 is too old
367
+ #error libxml2 is way too old
351
368
  #endif
352
369
  SRC
353
370
 
354
- try_cpp(<<-SRC) or warn "libxml2 version 2.9.0 and later is not yet supported, but proceeding anyway."
371
+ try_cpp(<<-SRC) or warn "libxml2 version 2.9.2 or later is highly recommended, but proceeding anyway."
355
372
  #include <libxml/xmlversion.h>
356
373
 
357
- #if LIBXML_VERSION >= 20900
358
- #error libxml2 is too new
374
+ #if LIBXML_VERSION < 20902
375
+ #error libxml2 is too old
359
376
  #endif
360
377
  SRC
361
378
  else
362
- message! "Building nokogiri using packaged libraries.\n"
379
+ message "Building nokogiri using packaged libraries.\n"
363
380
 
364
381
  require 'mini_portile'
365
382
  monkey_patch_mini_portile
366
383
  require 'yaml'
367
384
 
368
385
  static_p = enable_config('static', true) or
369
- message! "Static linking is disabled.\n"
386
+ message "Static linking is disabled.\n"
370
387
 
371
388
  dir_config('zlib')
372
389
 
@@ -418,6 +435,21 @@ else
418
435
  "LDFLAGS="
419
436
  ]
420
437
  end
438
+ else
439
+ if darwin_p && !File.exist?('/usr/include/iconv.h')
440
+ abort <<'EOM'.chomp
441
+ -----
442
+ The file "/usr/include/iconv.h" is missing in your build environment,
443
+ which means you haven't installed Xcode Command Line Tools properly.
444
+
445
+ To install Command Line Tools, try running `xcode-select --install` on
446
+ terminal and follow the instructions. If it fails, open Xcode.app,
447
+ select from the menu "Xcode" - "Open Developer Tool" - "More Developer
448
+ Tools" to open the developer site, download the installer for your OS
449
+ version and run it.
450
+ -----
451
+ EOM
452
+ end
421
453
  end
422
454
 
423
455
  libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"], static_p, cross_build_p) do |recipe|
@@ -425,7 +457,7 @@ else
425
457
  recipe.configure_options += [
426
458
  "--without-python",
427
459
  "--without-readline",
428
- "--with-iconv=#{libiconv_recipe ? libiconv_recipe.path : iconv_prefix}",
460
+ *(libiconv_recipe ? "--with-iconv=#{libiconv_recipe.path}" : iconv_configure_flags),
429
461
  "--with-c14n",
430
462
  "--with-debug",
431
463
  "--with-threads"
@@ -475,6 +507,7 @@ else
475
507
 
476
508
  # Defining a macro that expands to a C string; double quotes are significant.
477
509
  $CPPFLAGS << ' ' << "-DNOKOGIRI_#{recipe.name.upcase}_PATH=\"#{recipe.path}\"".shellescape
510
+ $CPPFLAGS << ' ' << "-DNOKOGIRI_#{recipe.name.upcase}_PATCHES=\"#{recipe.patch_files.map { |path| File.basename(path) }.join(' ')}\"".shellescape
478
511
 
479
512
  case libname
480
513
  when 'xml2'