nokogiri 1.5.11-x86-mingw32 → 1.6.0-x86-mingw32

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.

data/build_all CHANGED
@@ -8,7 +8,7 @@
8
8
  # here's what I recommend for building all the gems:
9
9
  #
10
10
  # 1. set up a vagrant VM guest running ubuntu lucid 32-bit.
11
- # 2. install rvm, and install 1.8.7, 1.9.3 and jruby.
11
+ # 2. install rvm, and install 1.9.3, 2.0.0 and jruby.
12
12
  # 3. `sudo apt-get install mingw32`
13
13
  #
14
14
  # as you build, you may run into these problems:
@@ -53,7 +53,7 @@ function rvm_use {
53
53
  set -o errexit
54
54
 
55
55
  # initialize
56
- rvm_use 1.8.7
56
+ rvm_use 1.9.3
57
57
  bundle install --quiet --local || bundle install
58
58
  rm -rf tmp pkg
59
59
  bundle exec rake clean
@@ -70,15 +70,7 @@ if [[ $platform =~ "64" ]] ; then
70
70
  echo ""
71
71
  exit 1
72
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
-
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.
79
-
80
- bundle exec rake-compiler cross-ruby VERSION=1.8.7-p358 # HOST=i386-mingw32
81
- fi
73
+ rvm_use 1.9.3
82
74
  if [[ ! -a ${HOME}/.rake-compiler/ruby/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb ]] ; then
83
75
  bundle exec rake-compiler cross-ruby VERSION=1.9.3-p194
84
76
  fi
@@ -90,7 +82,7 @@ bundle exec rake gem:windows
90
82
  cp -v pkg/nokogiri*x86-{mingw32,mswin32}*.gem gems
91
83
 
92
84
  # MRI
93
- rvm_use 1.8.7
85
+ rvm_use 1.9.3
94
86
  bundle exec rake gem
95
87
  cp -v pkg/nokogiri*.gem gems # should only be one at this point in the script
96
88
 
@@ -98,7 +90,7 @@ cp -v pkg/nokogiri*.gem gems # should only be one at this point in the script
98
90
  rvm_use jruby
99
91
  bundle install --quiet --local || bundle install
100
92
  bundle exec rake clean clobber
101
- rvm_use 1.8.7
93
+ rvm_use 1.9.3
102
94
  bundle exec rake generate
103
95
  rvm_use jruby
104
96
  bundle exec rake gem
data/dependencies.yml ADDED
@@ -0,0 +1,4 @@
1
+ libxml2: "2.8.0"
2
+ libxslt: "1.1.26"
3
+ zlib: "1.2.7"
4
+ libiconv: "1.13.1"
@@ -18,7 +18,34 @@ end
18
18
  $CFLAGS << " #{ENV["CFLAGS"]}"
19
19
  $LIBS << " #{ENV["LIBS"]}"
20
20
 
21
- if RbConfig::CONFIG['target_os'] == 'mingw32' || RbConfig::CONFIG['target_os'] =~ /mswin/
21
+ def preserving_globals
22
+ values =
23
+ $arg_config,
24
+ $CFLAGS, $CPPFLAGS,
25
+ $LDFLAGS, $LIBPATH, $libs
26
+ yield
27
+ ensure
28
+ $arg_config,
29
+ $CFLAGS, $CPPFLAGS,
30
+ $LDFLAGS, $LIBPATH, $libs =
31
+ values
32
+ end
33
+
34
+ def asplode(lib)
35
+ abort "-----\n#{lib} is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.\n-----"
36
+ end
37
+
38
+ def have_iconv?
39
+ have_header('iconv.h') or return false
40
+ %w{ iconv_open libiconv_open }.any? do |method|
41
+ have_func(method, 'iconv.h') or
42
+ have_library('iconv', method, 'iconv.h')
43
+ end
44
+ end
45
+
46
+ windows_p = RbConfig::CONFIG['target_os'] == 'mingw32' || RbConfig::CONFIG['target_os'] =~ /mswin/
47
+
48
+ if windows_p
22
49
  $CFLAGS << " -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF"
23
50
  elsif RbConfig::CONFIG['target_os'] =~ /solaris/
24
51
  $CFLAGS << " -DUSE_INCLUDED_VASPRINTF"
@@ -36,20 +63,14 @@ if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
36
63
  $CFLAGS << " -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline"
37
64
  end
38
65
 
39
- if RbConfig::CONFIG['target_os'] =~ /mswin/
40
- lib_prefix = 'lib'
41
-
42
- # There's no default include/lib dir on Windows. Let's just add the Ruby ones
43
- # and resort on the search path specified by INCLUDE and LIB environment
44
- # variables
66
+ if windows_p
67
+ # I'm cross compiling!
45
68
  HEADER_DIRS = [INCLUDEDIR]
46
69
  LIB_DIRS = [LIBDIR]
47
70
  XML2_HEADER_DIRS = [File.join(INCLUDEDIR, "libxml2"), INCLUDEDIR]
48
71
 
49
72
  else
50
- lib_prefix = ''
51
-
52
- HEADER_DIRS = [
73
+ opt_header_dirs = [
53
74
  # First search /opt/local for macports
54
75
  '/opt/local/include',
55
76
 
@@ -58,37 +79,136 @@ else
58
79
 
59
80
  # Check the ruby install locations
60
81
  INCLUDEDIR,
61
-
62
- # Finally fall back to /usr
63
- '/usr/include',
64
- '/usr/include/libxml2',
65
82
  ]
66
83
 
67
- LIB_DIRS = [
68
- # First search /opt/local for macports
69
- '/opt/local/lib',
70
-
71
- # Then search /usr/local for people that installed from source
72
- '/usr/local/lib',
73
-
74
- # Check the ruby install locations
75
- LIBDIR,
76
-
77
- # Finally fall back to /usr
78
- '/usr/lib',
79
- ]
80
-
81
- XML2_HEADER_DIRS = [
82
- '/opt/local/include/libxml2',
83
- '/usr/local/include/libxml2',
84
- File.join(INCLUDEDIR, "libxml2")
85
- ] + HEADER_DIRS
86
-
87
- # If the user has homebrew installed, use the libxml2 inside homebrew
88
- brew_prefix = `brew --prefix libxml2 2> /dev/null`.chomp
89
- unless brew_prefix.empty?
90
- LIB_DIRS.unshift File.join(brew_prefix, 'lib')
91
- XML2_HEADER_DIRS.unshift File.join(brew_prefix, 'include/libxml2')
84
+ if ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES']
85
+ HEADER_DIRS = opt_header_dirs + [
86
+ # Fall back to /usr
87
+ '/usr/include',
88
+ '/usr/include/libxml2',
89
+ ]
90
+
91
+ LIB_DIRS = [
92
+ # First search /opt/local for macports
93
+ '/opt/local/lib',
94
+
95
+ # Then search /usr/local for people that installed from source
96
+ '/usr/local/lib',
97
+
98
+ # Check the ruby install locations
99
+ LIBDIR,
100
+
101
+ # Finally fall back to /usr
102
+ '/usr/lib',
103
+ ]
104
+
105
+ XML2_HEADER_DIRS = opt_header_dirs.map { |idir|
106
+ File.join(idir, "libxml2")
107
+ } + HEADER_DIRS
108
+
109
+ # If the user has homebrew installed, use the libxml2 inside homebrew
110
+ brew_prefix = `brew --prefix libxml2 2> /dev/null`.chomp
111
+ unless brew_prefix.empty?
112
+ LIB_DIRS.unshift File.join(brew_prefix, 'lib')
113
+ XML2_HEADER_DIRS.unshift File.join(brew_prefix, 'include/libxml2')
114
+ end
115
+
116
+ else
117
+ require 'mini_portile'
118
+ require 'yaml'
119
+
120
+ common_recipe = lambda do |recipe|
121
+ recipe.target = File.join(ROOT, "ports")
122
+ recipe.files = ["ftp://ftp.xmlsoft.org/libxml2/#{recipe.name}-#{recipe.version}.tar.gz"]
123
+
124
+ checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
125
+ unless File.exist?(checkpoint)
126
+ recipe.cook
127
+ FileUtils.touch checkpoint
128
+ end
129
+ recipe.activate
130
+ end
131
+
132
+ def each_idir
133
+ # If --with-iconv-dir is given, it should be the first priority
134
+ idir = preserving_globals {
135
+ dir_config('iconv')
136
+ }.first and yield idirta
137
+
138
+ # Then --with-opt-dir
139
+ idir = preserving_globals {
140
+ dir_config('opt')
141
+ }.first and yield idir
142
+
143
+ # Try the system default
144
+ yield "/usr/include"
145
+
146
+ opt_header_dirs.each { |dir|
147
+ yield dir
148
+ }
149
+
150
+ cflags, = preserving_globals {
151
+ pkg_config('libiconv')
152
+ }
153
+ if cflags
154
+ cflags.shellsplit.each { |arg|
155
+ arg.sub!(/\A-I/, '') and
156
+ yield arg
157
+ }
158
+ end
159
+
160
+ nil
161
+ end
162
+
163
+ # Make sure libxml2 is built with iconv
164
+ iconv_prefix = each_idir { |idir|
165
+ prefix = %r{\A(.+)?/include\z} === idir && $1 or next
166
+ File.exist?(File.join(idir, 'iconv.h')) or next
167
+ preserving_globals {
168
+ # Follow the way libxml2's configure uses a value given with
169
+ # --with-iconv[=DIR]
170
+ $CPPFLAGS << " -I#{idir}"
171
+ $LDFLAGS << " -L#{prefix}/lib"
172
+ have_iconv?
173
+ } and break prefix
174
+ } or asplode "libiconv"
175
+
176
+ dependencies = YAML.load_file(File.join(ROOT, "dependencies.yml"))
177
+
178
+ libxml2_recipe = MiniPortile.new("libxml2", dependencies["libxml2"]).tap do |recipe|
179
+ recipe.configure_options = [
180
+ "--enable-shared",
181
+ "--disable-static",
182
+ "--without-python",
183
+ "--without-readline",
184
+ "--with-iconv=#{iconv_prefix}",
185
+ "--with-c14n",
186
+ "--with-debug",
187
+ "--with-threads"
188
+ ]
189
+ common_recipe.call recipe
190
+ end
191
+
192
+ libxslt_recipe = MiniPortile.new("libxslt", dependencies["libxslt"]).tap do |recipe|
193
+ recipe.configure_options = [
194
+ "--enable-shared",
195
+ "--disable-static",
196
+ "--without-python",
197
+ "--without-crypto",
198
+ "--with-debug",
199
+ "--with-libxml-prefix=#{libxml2_recipe.path}"
200
+ ]
201
+ common_recipe.call recipe
202
+ end
203
+
204
+ $LDFLAGS << " -Wl,-rpath,#{libxml2_recipe.path}/lib"
205
+ $LDFLAGS << " -Wl,-rpath,#{libxslt_recipe.path}/lib"
206
+
207
+ $CFLAGS << " -DNOKOGIRI_USE_PACKAGED_LIBRARIES -DNOKOGIRI_LIBXML2_PATH='\"#{libxml2_recipe.path}\"' -DNOKOGIRI_LIBXSLT_PATH='\"#{libxslt_recipe.path}\"'"
208
+
209
+ HEADER_DIRS = [libxml2_recipe, libxslt_recipe].map { |f| File.join(f.path, "include") }
210
+ LIB_DIRS = [libxml2_recipe, libxslt_recipe].map { |f| File.join(f.path, "lib") }
211
+ XML2_HEADER_DIRS = HEADER_DIRS + [File.join(libxml2_recipe.path, "include", "libxml2")]
92
212
  end
93
213
  end
94
214
 
@@ -97,29 +217,17 @@ dir_config('iconv', HEADER_DIRS, LIB_DIRS)
97
217
  dir_config('xml2', XML2_HEADER_DIRS, LIB_DIRS)
98
218
  dir_config('xslt', HEADER_DIRS, LIB_DIRS)
99
219
 
100
- def asplode(lib)
101
- abort "-----\n#{lib} is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.\n-----"
102
- end
103
-
104
220
  pkg_config('libxslt')
105
221
  pkg_config('libxml-2.0')
106
222
  pkg_config('libiconv')
107
223
 
108
- def have_iconv?
109
- %w{ iconv_open libiconv_open }.any? do |method|
110
- have_func(method, 'iconv.h') or
111
- have_library('iconv', method, 'iconv.h') or
112
- find_library('iconv', method, 'iconv.h')
113
- end
114
- end
115
-
116
224
  asplode "libxml2" unless find_header('libxml/parser.h')
117
225
  asplode "libxslt" unless find_header('libxslt/xslt.h')
118
226
  asplode "libexslt" unless find_header('libexslt/exslt.h')
119
227
  asplode "libiconv" unless have_iconv?
120
- asplode "libxml2" unless find_library("#{lib_prefix}xml2", 'xmlParseDoc')
121
- asplode "libxslt" unless find_library("#{lib_prefix}xslt", 'xsltParseStylesheetDoc')
122
- asplode "libexslt" unless find_library("#{lib_prefix}exslt", 'exsltFuncRegister')
228
+ asplode "libxml2" unless find_library("xml2", 'xmlParseDoc')
229
+ asplode "libxslt" unless find_library("xslt", 'xsltParseStylesheetDoc')
230
+ asplode "libexslt" unless find_library("exslt", 'exsltFuncRegister')
123
231
 
124
232
  unless have_func('xmlHasFeature')
125
233
  abort "-----\nThe function 'xmlHasFeature' is missing from your installation of libxml2. Likely this means that your installed version of libxml2 is old enough that nokogiri will not work well. To get around this problem, please upgrade your installation of libxml2.
@@ -141,4 +249,5 @@ if ENV['CPUPROFILE']
141
249
  end
142
250
 
143
251
  create_makefile('nokogiri/nokogiri')
252
+
144
253
  # :startdoc:
@@ -90,6 +90,16 @@ void Init_nokogiri()
90
90
  NOKOGIRI_STR_NEW2(xmlParserVersion)
91
91
  );
92
92
 
93
+ #ifdef NOKOGIRI_USE_PACKAGED_LIBRARIES
94
+ rb_const_set(mNokogiri, rb_intern("NOKOGIRI_USE_PACKAGED_LIBRARIES"), Qtrue);
95
+ rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATH"), NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXML2_PATH));
96
+ rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATH"), NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXSLT_PATH));
97
+ #else
98
+ rb_const_set(mNokogiri, rb_intern("NOKOGIRI_USE_PACKAGED_LIBRARIES"), Qfalse);
99
+ rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATH"), Qnil);
100
+ rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATH"), Qnil);
101
+ #endif
102
+
93
103
  #ifdef LIBXML_ICONV_ENABLED
94
104
  rb_const_set(mNokogiri, rb_intern("LIBXML_ICONV_ENABLED"), Qtrue);
95
105
  #else
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.5.11'
3
+ VERSION = '1.6.0'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -12,7 +12,7 @@ module Nokogiri
12
12
  end
13
13
 
14
14
  def loaded_parser_version
15
- LIBXML_PARSER_VERSION.scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first.collect{ |j|
15
+ LIBXML_PARSER_VERSION.scan(/^(.*)(..)(..)$/).first.collect{ |j|
16
16
  j.to_i
17
17
  }.join(".")
18
18
  end
@@ -25,6 +25,14 @@ module Nokogiri
25
25
  defined?(LIBXML_VERSION)
26
26
  end
27
27
 
28
+ def libxml2_using_system?
29
+ ! libxml2_using_packaged?
30
+ end
31
+
32
+ def libxml2_using_packaged?
33
+ NOKOGIRI_USE_PACKAGED_LIBRARIES
34
+ end
35
+
28
36
  def warnings
29
37
  return [] unless libxml2?
30
38
 
@@ -49,6 +57,13 @@ module Nokogiri
49
57
  if libxml2?
50
58
  hash_info['libxml'] = {}
51
59
  hash_info['libxml']['binding'] = 'extension'
60
+ if libxml2_using_packaged?
61
+ hash_info['libxml']['source'] = "packaged"
62
+ hash_info['libxml']['libxml2_path'] = NOKOGIRI_LIBXML2_PATH
63
+ hash_info['libxml']['libxslt_path'] = NOKOGIRI_LIBXSLT_PATH
64
+ else
65
+ hash_info['libxml']['source'] = "system"
66
+ end
52
67
  hash_info['libxml']['compiled'] = compiled_parser_version
53
68
  hash_info['libxml']['loaded'] = loaded_parser_version
54
69
  hash_info['warnings'] = warnings
@@ -3,11 +3,11 @@ require 'rake/extensioncompiler'
3
3
  HOST = Rake::ExtensionCompiler.mingw_host
4
4
 
5
5
  require 'mini_portile'
6
+ dependencies = YAML.load_file("dependencies.yml")
6
7
  $recipes = {}
7
- $recipes["zlib"] = MiniPortile.new "zlib", "1.2.7"
8
- $recipes["libiconv"] = MiniPortile.new "libiconv", "1.13.1"
9
- $recipes["libxml2"] = MiniPortile.new "libxml2", "2.7.7"
10
- $recipes["libxslt"] = MiniPortile.new "libxslt", "1.1.26"
8
+ %w[zlib libiconv libxml2 libxslt].each do |lib|
9
+ $recipes[lib] = MiniPortile.new lib, dependencies[lib]
10
+ end
11
11
  $recipes.each { |_, recipe| recipe.host = HOST }
12
12
 
13
13
  file "lib/nokogiri/nokogiri.rb" do
@@ -90,15 +90,6 @@ namespace :cross do
90
90
  "--without-readline",
91
91
  "CFLAGS='-DIN_LIBXML'"
92
92
  ]
93
- class << recipe
94
- def download
95
- Dir.chdir archives_path do
96
- @files.each do |url|
97
- sh "wget #{url} || curl -O #{url}"
98
- end
99
- end
100
- end
101
- end
102
93
 
103
94
  checkpoint = "#{CROSS_DIR}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
104
95
  unless File.exist?(checkpoint)
@@ -120,15 +111,6 @@ namespace :cross do
120
111
  "--without-crypto",
121
112
  "CFLAGS='-DIN_LIBXML'"
122
113
  ]
123
- class << recipe
124
- def download
125
- Dir.chdir archives_path do
126
- @files.each do |url|
127
- sh "wget #{url} || curl -O #{url}"
128
- end
129
- end
130
- end
131
- end
132
114
 
133
115
  checkpoint = "#{CROSS_DIR}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
134
116
  unless File.exist?(checkpoint)
@@ -139,12 +121,12 @@ namespace :cross do
139
121
  end
140
122
 
141
123
  task :file_list do
142
- HOE.spec.files += Dir["lib/nokogiri/nokogiri.rb"]
143
- HOE.spec.files += Dir["lib/nokogiri/{1.8,1.9,2.0}/nokogiri.so"]
124
+ add_file_to_gem "lib/nokogiri/nokogiri.rb"
144
125
  end
126
+
145
127
  end
146
128
 
147
129
  require 'rake/clean'
148
130
  CLOBBER.include("#{CROSS_DIR}/*.installed", "#{CROSS_DIR}/#{HOST}", "tmp/#{HOST}")
149
131
 
150
- task :cross => ["cross:libxslt", "lib/nokogiri/nokogiri.rb", "cross:file_list"]
132
+ task :cross2 => ["cross:libxslt", "lib/nokogiri/nokogiri.rb", "cross", "cross:file_list"]