nokogiri 1.6.1 → 1.6.2.rc1

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 (93) hide show
  1. checksums.yaml +7 -7
  2. data/.editorconfig +17 -0
  3. data/.travis.yml +4 -6
  4. data/CHANGELOG.ja.rdoc +37 -8
  5. data/CHANGELOG.rdoc +48 -3
  6. data/Gemfile +3 -3
  7. data/Manifest.txt +57 -1
  8. data/README.ja.rdoc +22 -16
  9. data/README.rdoc +24 -19
  10. data/ROADMAP.md +1 -2
  11. data/Rakefile +161 -58
  12. data/build_all +56 -31
  13. data/dependencies.yml +3 -3
  14. data/ext/nokogiri/extconf.rb +379 -121
  15. data/ext/nokogiri/html_document.c +2 -2
  16. data/ext/nokogiri/nokogiri.c +6 -1
  17. data/ext/nokogiri/xml_document.c +5 -4
  18. data/ext/nokogiri/xml_node.c +11 -4
  19. data/ext/nokogiri/xml_reader.c +1 -1
  20. data/ext/nokogiri/xml_sax_parser_context.c +40 -0
  21. data/ext/nokogiri/xml_syntax_error.c +10 -5
  22. data/ext/nokogiri/xml_syntax_error.h +1 -1
  23. data/ext/nokogiri/xml_xpath_context.c +2 -14
  24. data/ext/nokogiri/xslt_stylesheet.c +1 -1
  25. data/lib/nokogiri.rb +31 -22
  26. data/lib/nokogiri/css/node.rb +0 -50
  27. data/lib/nokogiri/css/parser.rb +213 -218
  28. data/lib/nokogiri/css/parser.y +21 -30
  29. data/lib/nokogiri/css/xpath_visitor.rb +62 -14
  30. data/lib/nokogiri/html/document.rb +97 -18
  31. data/lib/nokogiri/html/sax/parser.rb +2 -2
  32. data/lib/nokogiri/version.rb +1 -1
  33. data/lib/nokogiri/xml/builder.rb +1 -1
  34. data/lib/nokogiri/xml/document.rb +2 -2
  35. data/lib/nokogiri/xml/dtd.rb +10 -0
  36. data/lib/nokogiri/xml/node.rb +26 -1
  37. data/lib/nokogiri/xml/sax/parser.rb +1 -1
  38. data/ports/archives/libxslt-1.1.28.tar.gz +0 -0
  39. data/ports/patches/libxml2/0001-Fix-parser-local-buffers-size-problems.patch +265 -0
  40. data/ports/patches/libxml2/0002-Fix-entities-local-buffers-size-problems.patch +102 -0
  41. data/ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch +26 -0
  42. data/ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch +26 -0
  43. data/ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch +158 -0
  44. data/ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch +78 -0
  45. data/ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch +480 -0
  46. data/ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch +315 -0
  47. data/ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch +37 -0
  48. data/ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch +222 -0
  49. data/ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch +53 -0
  50. data/ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch +60 -0
  51. data/ports/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch +42 -0
  52. data/ports/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch +164 -0
  53. data/ports/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch +587 -0
  54. data/ports/patches/libxslt/0008-Fix-direct-pattern-matching.patch +80 -0
  55. data/ports/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch +185 -0
  56. data/ports/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch +126 -0
  57. data/ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch +25 -0
  58. data/ports/patches/libxslt/0014-Fix-for-bug-436589.patch +43 -0
  59. data/ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch +41 -0
  60. data/suppressions/README.txt +1 -0
  61. data/suppressions/nokogiri_ree-1.8.7.358.supp +61 -0
  62. data/suppressions/nokogiri_ruby-1.8.7.370.supp +0 -0
  63. data/suppressions/nokogiri_ruby-1.9.2.320.supp +28 -0
  64. data/suppressions/nokogiri_ruby-1.9.3.327.supp +28 -0
  65. data/test/css/test_nthiness.rb +65 -2
  66. data/test/css/test_parser.rb +27 -10
  67. data/test/css/test_tokenizer.rb +1 -1
  68. data/test/css/test_xpath_visitor.rb +6 -1
  69. data/test/files/atom.xml +344 -0
  70. data/test/files/shift_jis_no_charset.html +9 -0
  71. data/test/helper.rb +10 -0
  72. data/test/html/test_document.rb +74 -7
  73. data/test/html/test_document_encoding.rb +10 -0
  74. data/test/html/test_document_fragment.rb +3 -3
  75. data/test/namespaces/test_namespaces_in_cloned_doc.rb +31 -0
  76. data/test/test_nokogiri.rb +6 -0
  77. data/test/test_reader.rb +7 -4
  78. data/test/test_xslt_transforms.rb +25 -0
  79. data/test/xml/sax/test_parser.rb +16 -0
  80. data/test/xml/sax/test_parser_context.rb +9 -0
  81. data/test/xml/test_builder.rb +9 -0
  82. data/test/xml/test_c14n.rb +12 -2
  83. data/test/xml/test_document.rb +66 -0
  84. data/test/xml/test_document_fragment.rb +5 -0
  85. data/test/xml/test_dtd.rb +84 -0
  86. data/test/xml/test_entity_reference.rb +3 -3
  87. data/test/xml/test_node.rb +21 -3
  88. data/test/xml/test_node_attributes.rb +17 -0
  89. data/test/xml/test_schema.rb +26 -0
  90. data/test/xml/test_xpath.rb +81 -0
  91. metadata +254 -174
  92. data/ports/archives/libxslt-1.1.26.tar.gz +0 -0
  93. data/tasks/cross_compile.rb +0 -134
data/ROADMAP.md CHANGED
@@ -77,8 +77,7 @@
77
77
  ## Encoding
78
78
 
79
79
  We have a lot of issues open around encoding. How bad are things?
80
- Would it help if we deprecated support for Ruby 1.8.7? Somebody who
81
- knows encoding well should head this up.
80
+ Somebody who knows encoding well should head this up.
82
81
 
83
82
  * Extract EncodingReader as a real object that can be injected
84
83
  https://groups.google.com/forum/#!msg/nokogiri-talk/arJeAtMqvkg/tGihB-iBRSAJ
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  require 'rubygems'
3
+ require 'shellwords'
3
4
 
4
5
  gem 'hoe'
5
6
  require 'hoe'
@@ -14,11 +15,92 @@ GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
14
15
  CROSS_DIR = File.join(File.dirname(__FILE__), 'ports')
15
16
 
16
17
  def java?
17
- !! (RUBY_PLATFORM =~ /java/)
18
+ /java/ === RUBY_PLATFORM
18
19
  end
19
20
 
20
21
  ENV['LANG'] = "en_US.UTF-8" # UBUNTU 10.04, Y U NO DEFAULT TO UTF-8?
21
22
 
23
+ CrossRuby = Struct.new(:version, :host) {
24
+ def ver
25
+ @ver ||= version[/\A[^-]+/]
26
+ end
27
+
28
+ def api_ver_suffix
29
+ case ver
30
+ when /\A([2-9])\.([0-9])\./
31
+ "#{$1}#{$2}0"
32
+ when /\A1\.9\./
33
+ '191'
34
+ else
35
+ raise "unsupported version: #{ver}"
36
+ end
37
+ end
38
+
39
+ def platform
40
+ @platform ||=
41
+ case host
42
+ when /\Ax86_64-/
43
+ 'x64-mingw32'
44
+ when /\Ai[3-6]86-/
45
+ 'x86-mingw32'
46
+ else
47
+ raise "unsupported host: #{host}"
48
+ end
49
+ end
50
+
51
+ def tool(name)
52
+ (@binutils_prefix ||=
53
+ case platform
54
+ when 'x64-mingw32'
55
+ 'x86_64-w64-mingw32-'
56
+ when 'x86-mingw32'
57
+ 'i686-w64-mingw32-'
58
+ end) + name
59
+ end
60
+
61
+ def target
62
+ case platform
63
+ when 'x64-mingw32'
64
+ 'pei-x86-64'
65
+ when 'x86-mingw32'
66
+ 'pei-i386'
67
+ end
68
+ end
69
+
70
+ def libruby_dll
71
+ case platform
72
+ when 'x64-mingw32'
73
+ "x64-msvcrt-ruby#{api_ver_suffix}.dll"
74
+ when 'x86-mingw32'
75
+ "msvcrt-ruby#{api_ver_suffix}.dll"
76
+ end
77
+ end
78
+
79
+ def dlls
80
+ [
81
+ 'kernel32.dll',
82
+ 'msvcrt.dll',
83
+ 'ws2_32.dll',
84
+ *(case
85
+ when ver >= '2.0.0'
86
+ 'user32.dll'
87
+ end),
88
+ libruby_dll
89
+ ]
90
+ end
91
+ }
92
+
93
+ CROSS_RUBIES = File.read('.cross_rubies').lines.flat_map { |line|
94
+ case line
95
+ when /\A([^#]+):([^#]+)/
96
+ CrossRuby.new($1, $2)
97
+ else
98
+ []
99
+ end
100
+ }
101
+
102
+ ENV['RUBY_CC_VERSION'] ||= CROSS_RUBIES.map(&:ver).uniq.join(":")
103
+
22
104
  require 'tasks/nokogiri.org'
23
105
 
24
106
  HOE = Hoe.spec 'nokogiri' do
@@ -26,25 +108,31 @@ HOE = Hoe.spec 'nokogiri' do
26
108
  developer 'Mike Dalessio', 'mike.dalessio@gmail.com'
27
109
  developer 'Yoko Harada', 'yokolet@gmail.com'
28
110
  developer 'Tim Elliott', 'tle@holymonkey.com'
111
+ developer 'Akinori MUSHA', 'knu@idaemons.org'
29
112
 
30
113
  self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
31
114
  self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
32
115
 
33
116
  self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
34
117
 
35
- self.licenses = ['MIT']
36
118
 
37
119
  self.clean_globs += [
38
120
  'nokogiri.gemspec',
39
121
  'lib/nokogiri/nokogiri.{bundle,jar,rb,so}',
40
- 'lib/nokogiri/{1.9,2.0}',
122
+ 'lib/nokogiri/[0-9].[0-9]',
123
+ 'ports/*.installed',
124
+ 'ports/{i[3-6]86,x86_64}-{w64-,}mingw32*',
125
+ 'ports/libxml2',
126
+ 'ports/libxslt',
41
127
  # GENERATED_PARSER,
42
128
  # GENERATED_TOKENIZER
43
129
  ]
44
130
 
45
- self.extra_deps += [
46
- ["mini_portile", "~> 0.5.0"],
47
- ]
131
+ unless java?
132
+ self.extra_deps += [
133
+ ["mini_portile", "~> 0.5.2"],
134
+ ]
135
+ end
48
136
 
49
137
  self.extra_dev_deps += [
50
138
  ["hoe-bundler", ">= 1.1"],
@@ -53,7 +141,7 @@ HOE = Hoe.spec 'nokogiri' do
53
141
  ["hoe-git", ">= 1.4"],
54
142
  ["minitest", "~> 2.2.2"],
55
143
  ["rake", ">= 0.9"],
56
- ["rake-compiler", "~> 0.8.0"],
144
+ ["rake-compiler", "~> 0.9.2"],
57
145
  ["racc", ">= 1.4.6"],
58
146
  ["rexical", ">= 1.0.5"]
59
147
  ]
@@ -69,6 +157,7 @@ HOE = Hoe.spec 'nokogiri' do
69
157
 
70
158
  self.testlib = :minitest
71
159
  end
160
+ HOE.spec.licenses = ['MIT']
72
161
 
73
162
  # ----------------------------------------
74
163
 
@@ -77,7 +166,7 @@ def add_file_to_gem relative_path
77
166
  target_dir = File.dirname(target_path)
78
167
  mkdir_p target_dir unless File.directory?(target_dir)
79
168
  rm_f target_path
80
- ln relative_path, target_path
169
+ safe_ln relative_path, target_path
81
170
  HOE.spec.files += [relative_path]
82
171
  end
83
172
 
@@ -92,6 +181,8 @@ if java?
92
181
  jruby_home = RbConfig::CONFIG['prefix']
93
182
  ext.ext_dir = 'ext/java'
94
183
  ext.lib_dir = 'lib/nokogiri'
184
+ ext.source_version = '1.6'
185
+ ext.target_version = '1.6'
95
186
  jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
96
187
  ext.classpath = jars.map { |x| File.expand_path x }.join ':'
97
188
  end
@@ -100,9 +191,11 @@ if java?
100
191
  add_file_to_gem 'lib/nokogiri/nokogiri.jar'
101
192
  end
102
193
  else
103
- mingw_available = true
104
194
  begin
105
- require 'tasks/cross_compile'
195
+ require 'rake/extensioncompiler'
196
+ # Ensure mingw compiler is installed
197
+ Rake::ExtensionCompiler.mingw_host
198
+ mingw_available = true
106
199
  rescue
107
200
  puts "WARNING: cross compilation not available: #{$!}"
108
201
  mingw_available = false
@@ -111,18 +204,24 @@ else
111
204
 
112
205
  HOE.spec.files.reject! { |f| f =~ %r{\.(java|jar)$} }
113
206
 
114
- windows_p = RbConfig::CONFIG['target_os'] == 'mingw32' || RbConfig::CONFIG['target_os'] =~ /mswin/
115
-
116
- unless windows_p || java?
117
- task gem_build_path do
118
- add_file_to_gem "dependencies.yml"
119
-
120
- dependencies = YAML.load_file("dependencies.yml")
121
- %w[libxml2 libxslt].each do |lib|
122
- version = dependencies[lib]
123
- archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz")
124
- add_file_to_gem archive
125
- end
207
+ dependencies = YAML.load_file("dependencies.yml")
208
+
209
+ task gem_build_path do
210
+ %w[libxml2 libxslt].each do |lib|
211
+ version = dependencies[lib]
212
+ archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz")
213
+ add_file_to_gem archive
214
+ patchesdir = File.join("ports", "patches", lib)
215
+ patches = `#{['git', 'ls-files', patchesdir].shelljoin}`.split("\n").grep(/\.patch\z/)
216
+ patches.each { |patch|
217
+ add_file_to_gem patch
218
+ }
219
+ (untracked = Dir[File.join(patchesdir, '*.patch')] - patches).empty? or
220
+ at_exit {
221
+ untracked.each { |patch|
222
+ puts "** WARNING: untracked patch file not added to gem: #{patch}"
223
+ }
224
+ }
126
225
  end
127
226
  end
128
227
 
@@ -131,12 +230,16 @@ else
131
230
  ext.config_options << ENV['EXTOPTS']
132
231
  if mingw_available
133
232
  ext.cross_compile = true
134
- ext.cross_platform = ["x86-mswin32-60", "x86-mingw32"]
135
- ext.cross_config_options << "--with-xml2-include=#{File.join($recipes["libxml2"].path, 'include', 'libxml2')}"
136
- ext.cross_config_options << "--with-xml2-lib=#{File.join($recipes["libxml2"].path, 'lib')}"
137
- ext.cross_config_options << "--with-iconv-dir=#{$recipes["libiconv"].path}"
138
- ext.cross_config_options << "--with-xslt-dir=#{$recipes["libxslt"].path}"
139
- ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
233
+ ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
234
+ ext.cross_config_options << "--enable-cross-build"
235
+ ext.cross_compiling do |spec|
236
+ libs = dependencies.map { |name, version| "#{name}-#{version}" }.join(', ')
237
+
238
+ spec.post_install_message = <<-EOS
239
+ Nokogiri is built with the packaged libraries: #{libs}.
240
+ EOS
241
+ spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
242
+ end
140
243
  end
141
244
  end
142
245
  end
@@ -193,9 +296,9 @@ task :java_debug do
193
296
  end
194
297
 
195
298
  if java?
196
- task :test_18 => :test
197
- task :test_19 do
198
- ENV['JRUBY_OPTS'] = "--1.9"
299
+ task :test_19 => :test
300
+ task :test_20 do
301
+ ENV['JRUBY_OPTS'] = "--2.0"
199
302
  Rake::Task["test"].invoke
200
303
  end
201
304
  end
@@ -212,37 +315,37 @@ end
212
315
 
213
316
  # ----------------------------------------
214
317
 
215
- desc "build a windows gem without all the ceremony."
216
- task "gem:windows" => "gem" do
217
- cross_rubies = ["1.9.3-p194", "2.0.0-p0"]
218
- ruby_cc_version = cross_rubies.collect { |_| _.split("-").first }.join(":") # e.g., "1.8.7:1.9.2"
219
- rake_compiler_config_path = "#{ENV['HOME']}/.rake-compiler/config.yml"
318
+ def verify_dll(dll, cross_ruby)
319
+ dll_imports = cross_ruby.dlls
320
+ dump = `#{['env', 'LANG=C', cross_ruby.tool('objdump'), '-p', dll].shelljoin}`
321
+ raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target)}\s/ === dump
322
+ raise "export function Init_nokogiri not in dll #{dll}" unless /Table.*\sInit_nokogiri\s/mi === dump
323
+
324
+ # Verify that the expected DLL dependencies match the actual dependencies
325
+ # and that no further dependencies exist.
326
+ dll_imports_is = dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
327
+ if dll_imports_is.sort != dll_imports.sort
328
+ raise "unexpected dll imports #{dll_imports_is.inspect} in #{dll}"
329
+ end
330
+ puts "#{dll}: Looks good!"
331
+ end
220
332
 
333
+ task :cross do
334
+ rake_compiler_config_path = File.expand_path("~/.rake-compiler/config.yml")
221
335
  unless File.exists? rake_compiler_config_path
222
- raise "rake-compiler has not installed any cross rubies. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{cross_rubies.first}'"
223
- end
224
- rake_compiler_config = YAML.load_file(rake_compiler_config_path)
225
-
226
- # check that rake-compiler config contains the right patchlevels. see #279 for background,
227
- # and http://blog.mmediasys.com/2011/01/22/rake-compiler-updated-list-of-supported-ruby-versions-for-cross-compilation/
228
- # for more up-to-date docs.
229
- cross_rubies.each do |version|
230
- majmin, patchlevel = version.split("-")
231
- rbconfig = "rbconfig-#{majmin}"
232
- unless rake_compiler_config.key?(rbconfig) && rake_compiler_config[rbconfig] =~ /-#{patchlevel}/
233
- raise "rake-compiler '#{rbconfig}' not #{patchlevel}. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{version}'"
234
- end
336
+ raise "rake-compiler has not installed any cross rubies. Try using rake-compiler-dev-box for building binary windows gems.'"
235
337
  end
236
338
 
237
- # verify that --export-all is in the 1.9 rbconfig. see #279,#374,#375.
238
- rbconfig_19 = rake_compiler_config["rbconfig-1.9.3"]
239
- raise "rbconfig #{rbconfig_19} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_19).split("\n").grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
240
-
241
- rbconfig_20 = rake_compiler_config["rbconfig-2.0.0"]
242
- raise "rbconfig #{rbconfig_20} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_20).split("\n").grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
243
-
244
- pkg_config_path = %w[libxslt libxml2].collect { |pkg| File.join($recipes[pkg].path, "lib/pkgconfig") }.join(":")
245
- sh("env PKG_CONFIG_PATH=#{pkg_config_path} RUBY_CC_VERSION=#{ruby_cc_version} rake cross native gem") || raise("build failed!")
339
+ CROSS_RUBIES.each do |cross_ruby|
340
+ task "tmp/#{cross_ruby.platform}/nokogiri/#{cross_ruby.ver}/nokogiri.so" do |t|
341
+ # To reduce the gem file size strip mingw32 dlls before packaging
342
+ sh [cross_ruby.tool('strip'), '-S', t.name].shelljoin
343
+ verify_dll t.name, cross_ruby
344
+ end
345
+ end
246
346
  end
247
347
 
348
+ desc "build a windows gem without all the ceremony."
349
+ task "gem:windows" => %w[cross native gem]
350
+
248
351
  # vim: syntax=Ruby
data/build_all CHANGED
@@ -2,14 +2,19 @@
2
2
  #
3
3
  # script to build gems for all relevant platforms:
4
4
  # - MRI et al (standard gem)
5
- # - windows (x86-mingw32 and x86-mswin32-60)
5
+ # - windows (x86-mingw32 and x64-mingw32)
6
6
  # - jruby
7
7
  #
8
8
  # here's what I recommend for building all the gems:
9
9
  #
10
- # 1. set up a vagrant VM guest running ubuntu lucid 32-bit.
10
+ # set up a rake-compiler-dev-box as described here:
11
+ # https://github.com/tjschuck/rake-compiler-dev-box
12
+ # It is prepared with all the necessary build tools and environments.
13
+ #
14
+ # or alternatively do:
15
+ # 1. Setup a ubuntu 12.04+ machine
11
16
  # 2. install rvm, and install 1.9.3, 2.0.0 and jruby.
12
- # 3. `sudo apt-get install mingw32`
17
+ # 3. `sudo apt-get install mingw32 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64`
13
18
  #
14
19
  # as you build, you may run into these problems:
15
20
  #
@@ -34,6 +39,8 @@
34
39
  # RUBY_ENGINE (just comment it out)
35
40
  #
36
41
 
42
+ DEFAULT_RUBY=2.0.0
43
+
37
44
  HOST=
38
45
 
39
46
  # Load RVM into a shell session *as a function*
@@ -45,16 +52,37 @@ else
45
52
  echo "ERROR: An RVM installation was not found.\n"
46
53
  fi
47
54
 
48
- function rvm_use {
55
+ rvm_use () {
49
56
  current_ruby=$1
50
57
  rvm use "${1}@nokogiri" --create || rvm -v
51
58
  }
52
59
 
60
+ rvm_do () {
61
+ local ver=$1
62
+ shift
63
+ rvm "${ver}@nokogiri" do "$@"
64
+ }
65
+
66
+ cross_rubies () {
67
+ grep -v '#' .cross_rubies
68
+ }
69
+
70
+ ruby_vers () {
71
+ cross_rubies | while read -r line; do
72
+ echo "${line%%[-:]*}"
73
+ done | uniq
74
+ }
75
+
53
76
  set -o errexit
54
77
 
55
- # initialize
56
- rvm_use 1.8.7
57
- bundle install --quiet --local || bundle install
78
+ for ver in `ruby_vers`; do
79
+ rvm_use $ver
80
+ gem install bundler --conservative
81
+ bundle install --quiet --local || bundle install
82
+ done
83
+
84
+ rvm_use $DEFAULT_RUBY
85
+
58
86
  rm -rf tmp pkg
59
87
  bundle exec rake clean
60
88
 
@@ -63,42 +91,39 @@ rm -rf gems
63
91
  mkdir -p gems
64
92
 
65
93
  # windows
66
- platform=$(uname -i)
67
- if [[ $platform =~ "64" ]] ; then
68
- echo ""
69
- echo "ERROR: You need to build the windows gem on a 32-bit machine!"
70
- echo ""
71
- exit 1
72
- fi
73
- rvm_use 1.8.7
74
- if [[ ! -a ${HOME}/.rake-compiler/ruby/ruby-1.8.7-p358/lib/ruby/1.8.7/x86_64-linux/rbconfig.rb ]] ; then
75
94
 
76
- # if this fails around the purelib.rb thing, try varying the ruby
77
- # used to run this script, and whether the HOST env var is set
78
- # below.
95
+ for verspec in `cross_rubies`; do
96
+ version="${verspec%%:*}"
97
+ ver="${version%%-*}"
98
+ host="${verspec#*:}"
99
+
100
+ case $ver in
101
+ 1.9.3)
102
+ # Parallel make does not work in 1.9.3, as it has a
103
+ # missing dependency problem with main.o.
104
+ make="make"
105
+ ;;
106
+ *)
107
+ make="$MAKE"
108
+ esac
109
+
110
+ MAKE="$make" rvm_do $ver rake-compiler cross-ruby VERSION=$version HOST=$host debugflags="-g"
111
+ done
79
112
 
80
- bundle exec rake-compiler cross-ruby VERSION=1.8.7-p358 # HOST=i386-mingw32
81
- fi
82
- if [[ ! -a ${HOME}/.rake-compiler/ruby/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb ]] ; then
83
- bundle exec rake-compiler cross-ruby VERSION=1.9.3-p194
84
- fi
85
- if [[ ! -a ${HOME}/.rake-compiler/ruby/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-linux/rbconfig.rb ]] ; then
86
- bundle exec rake-compiler cross-ruby VERSION=2.0.0-p0
87
- fi
88
- bundle exec rake cross
89
113
  bundle exec rake gem:windows
90
- cp -v pkg/nokogiri*x86-{mingw32,mswin32}*.gem gems
114
+ cp -v pkg/nokogiri*{x86,x64}-mingw32*.gem gems
91
115
 
92
116
  # MRI
93
- rvm_use 1.8.7
117
+ bundle exec rake clean
94
118
  bundle exec rake gem
95
119
  cp -v pkg/nokogiri*.gem gems # should only be one at this point in the script
96
120
 
97
121
  # jruby
98
122
  rvm_use jruby
123
+ gem install bundler --conservative
99
124
  bundle install --quiet --local || bundle install
100
125
  bundle exec rake clean clobber
101
- rvm_use 1.8.7
126
+ rvm_use $DEFAULT_RUBY
102
127
  bundle exec rake generate
103
128
  rvm_use jruby
104
129
  bundle exec rake gem