nokogiri 1.6.1-java → 1.6.2-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/.editorconfig +17 -0
- data/.travis.yml +6 -6
- data/CHANGELOG.ja.rdoc +61 -8
- data/CHANGELOG.rdoc +58 -3
- data/Gemfile +3 -3
- data/Manifest.txt +57 -1
- data/README.ja.rdoc +22 -17
- data/README.rdoc +23 -18
- data/ROADMAP.md +1 -2
- data/Rakefile +162 -58
- data/build_all +56 -31
- data/dependencies.yml +3 -3
- data/ext/java/nokogiri/NokogiriService.java +9 -5
- data/ext/java/nokogiri/XmlDocument.java +95 -54
- data/ext/java/nokogiri/XmlNode.java +93 -42
- data/ext/java/nokogiri/XmlReader.java +1 -1
- data/ext/java/nokogiri/XmlSaxParserContext.java +33 -0
- data/ext/java/nokogiri/XmlSchema.java +4 -2
- data/ext/java/nokogiri/XmlXpathContext.java +118 -76
- data/ext/java/nokogiri/internals/IgnoreSchemaErrorsErrorHandler.java +20 -0
- data/ext/java/nokogiri/internals/NokogiriHandler.java +3 -10
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +40 -23
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +59 -54
- data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +1 -1
- data/ext/java/nokogiri/internals/ParserContext.java +1 -4
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +6 -2
- data/ext/java/nokogiri/internals/c14n/AttrCompare.java +119 -0
- data/ext/java/nokogiri/internals/c14n/C14nHelper.java +159 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalFilter.java +37 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizationException.java +93 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer.java +252 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11.java +639 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_OmitComments.java +38 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer11_WithComments.java +38 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java +368 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java +295 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclOmitComments.java +40 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315ExclWithComments.java +44 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315OmitComments.java +44 -0
- data/ext/java/nokogiri/internals/c14n/Canonicalizer20010315WithComments.java +43 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerBase.java +630 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerPhysical.java +173 -0
- data/ext/java/nokogiri/internals/c14n/CanonicalizerSpi.java +76 -0
- data/ext/java/nokogiri/internals/c14n/Constants.java +42 -0
- data/ext/java/nokogiri/internals/c14n/ElementProxy.java +293 -0
- data/ext/java/nokogiri/internals/c14n/HelperNodeList.java +93 -0
- data/ext/java/nokogiri/internals/c14n/IgnoreAllErrorHandler.java +79 -0
- data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +165 -0
- data/ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java +76 -0
- data/ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java +402 -0
- data/ext/java/nokogiri/internals/c14n/NodeFilter.java +51 -0
- data/ext/java/nokogiri/internals/c14n/UtfHelpper.java +179 -0
- data/ext/java/nokogiri/internals/c14n/XMLUtils.java +507 -0
- data/ext/nokogiri/extconf.rb +429 -128
- data/ext/nokogiri/html_document.c +2 -2
- data/ext/nokogiri/nokogiri.c +6 -1
- data/ext/nokogiri/xml_document.c +5 -4
- data/ext/nokogiri/xml_node.c +76 -7
- data/ext/nokogiri/xml_reader.c +1 -1
- data/ext/nokogiri/xml_sax_parser_context.c +40 -0
- data/ext/nokogiri/xml_syntax_error.c +10 -5
- data/ext/nokogiri/xml_syntax_error.h +1 -1
- data/ext/nokogiri/xml_xpath_context.c +2 -14
- data/ext/nokogiri/xslt_stylesheet.c +1 -1
- data/lib/nokogiri.rb +31 -22
- data/lib/nokogiri/css/node.rb +0 -50
- data/lib/nokogiri/css/parser.rb +213 -218
- data/lib/nokogiri/css/parser.y +21 -30
- data/lib/nokogiri/css/xpath_visitor.rb +62 -14
- data/lib/nokogiri/html/document.rb +97 -18
- data/lib/nokogiri/html/sax/parser.rb +2 -2
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/builder.rb +1 -1
- data/lib/nokogiri/xml/document.rb +2 -2
- data/lib/nokogiri/xml/dtd.rb +10 -0
- data/lib/nokogiri/xml/node.rb +26 -1
- data/lib/nokogiri/xml/sax/parser.rb +1 -1
- data/ports/patches/libxml2/0001-Fix-parser-local-buffers-size-problems.patch +265 -0
- data/ports/patches/libxml2/0002-Fix-entities-local-buffers-size-problems.patch +102 -0
- data/ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch +26 -0
- data/ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch +26 -0
- data/ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch +158 -0
- data/ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch +78 -0
- data/ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch +480 -0
- data/ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch +315 -0
- data/ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch +37 -0
- data/ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch +222 -0
- data/ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch +53 -0
- data/ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch +60 -0
- data/ports/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch +42 -0
- data/ports/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch +164 -0
- data/ports/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch +587 -0
- data/ports/patches/libxslt/0008-Fix-direct-pattern-matching.patch +80 -0
- data/ports/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch +185 -0
- data/ports/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch +126 -0
- data/ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch +25 -0
- data/ports/patches/libxslt/0014-Fix-for-bug-436589.patch +43 -0
- data/ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch +41 -0
- data/suppressions/README.txt +1 -0
- data/suppressions/nokogiri_ree-1.8.7.358.supp +61 -0
- data/suppressions/nokogiri_ruby-1.8.7.370.supp +0 -0
- data/suppressions/nokogiri_ruby-1.9.2.320.supp +28 -0
- data/suppressions/nokogiri_ruby-1.9.3.327.supp +28 -0
- data/test/css/test_nthiness.rb +65 -2
- data/test/css/test_parser.rb +27 -10
- data/test/css/test_tokenizer.rb +1 -1
- data/test/css/test_xpath_visitor.rb +6 -1
- data/test/files/atom.xml +344 -0
- data/test/files/shift_jis_no_charset.html +9 -0
- data/test/helper.rb +10 -0
- data/test/html/test_document.rb +74 -7
- data/test/html/test_document_encoding.rb +10 -0
- data/test/html/test_document_fragment.rb +9 -3
- data/test/namespaces/test_namespaces_aliased_default.rb +24 -0
- data/test/namespaces/test_namespaces_in_cloned_doc.rb +31 -0
- data/test/namespaces/test_namespaces_preservation.rb +31 -0
- data/test/test_nokogiri.rb +6 -0
- data/test/test_reader.rb +7 -4
- data/test/test_xslt_transforms.rb +25 -0
- data/test/xml/sax/test_parser.rb +16 -0
- data/test/xml/sax/test_parser_context.rb +9 -0
- data/test/xml/test_builder.rb +9 -0
- data/test/xml/test_c14n.rb +12 -2
- data/test/xml/test_document.rb +66 -0
- data/test/xml/test_document_fragment.rb +5 -0
- data/test/xml/test_dtd.rb +84 -0
- data/test/xml/test_entity_reference.rb +3 -3
- data/test/xml/test_node.rb +21 -3
- data/test/xml/test_node_attributes.rb +17 -0
- data/test/xml/test_schema.rb +26 -0
- data/test/xml/test_text.rb +15 -0
- data/test/xml/test_xpath.rb +87 -0
- data/test_all +3 -3
- metadata +119 -68
- data/tasks/cross_compile.rb +0 -134
data/README.rdoc
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
= Nokogiri {<img src="https://secure.travis-ci.org/sparklemotion/nokogiri.png?rvm=1.9.3" />}[http://travis-ci.org/sparklemotion/nokogiri] {<img src="https://codeclimate.com/
|
1
|
+
= Nokogiri {<img src="https://secure.travis-ci.org/sparklemotion/nokogiri.png?rvm=1.9.3" />}[http://travis-ci.org/sparklemotion/nokogiri] {<img src="https://codeclimate.com/github/sparklemotion/nokogiri.png" />}[https://codeclimate.com/github/sparklemotion/nokogiri] {<img src="https://www.versioneye.com/ruby/nokogiri/badge.png" alt="Dependency Status" />}[https://www.versioneye.com/ruby/nokogiri]
|
2
2
|
|
3
3
|
* http://nokogiri.org
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* http://github.com/sparklemotion/nokogiri/issues
|
4
|
+
* https://github.com/sparklemotion/nokogiri
|
5
|
+
* https://groups.google.com/group/nokogiri-talk
|
6
|
+
* https://github.com/sparklemotion/nokogiri/issues
|
8
7
|
|
9
8
|
== DESCRIPTION:
|
10
9
|
|
@@ -16,12 +15,12 @@ enough of it.
|
|
16
15
|
|
17
16
|
== FEATURES:
|
18
17
|
|
19
|
-
* XPath support for document searching
|
18
|
+
* XPath 1.0 support for document searching
|
20
19
|
* CSS3 selector support for document searching
|
21
20
|
* XML/HTML builder
|
22
21
|
|
23
22
|
Nokogiri parses and searches XML/HTML very quickly, and also has
|
24
|
-
correctly implemented CSS3 selector support as well as XPath support.
|
23
|
+
correctly implemented CSS3 selector support as well as XPath 1.0 support.
|
25
24
|
|
26
25
|
== SUPPORT:
|
27
26
|
|
@@ -29,15 +28,15 @@ Before filing a bug report, please read our {submission guidelines}[http://nokog
|
|
29
28
|
|
30
29
|
* http://nokogiri.org/tutorials/getting_help.html
|
31
30
|
|
32
|
-
The Nokogiri {mailing list}[
|
31
|
+
The Nokogiri {mailing list}[https://groups.google.com/group/nokogiri-talk]
|
33
32
|
is available here:
|
34
33
|
|
35
|
-
*
|
34
|
+
* https://groups.google.com/group/nokogiri-talk
|
36
35
|
|
37
|
-
The {bug tracker}[
|
36
|
+
The {bug tracker}[https://github.com/sparklemotion/nokogiri/issues]
|
38
37
|
is available here:
|
39
38
|
|
40
|
-
*
|
39
|
+
* https://github.com/sparklemotion/nokogiri/issues
|
41
40
|
|
42
41
|
The IRC channel is #nokogiri on freenode.
|
43
42
|
|
@@ -73,11 +72,16 @@ The IRC channel is #nokogiri on freenode.
|
|
73
72
|
|
74
73
|
== REQUIREMENTS:
|
75
74
|
|
76
|
-
* ruby 1.
|
77
|
-
|
78
|
-
* libxml2
|
79
|
-
|
80
|
-
|
75
|
+
* ruby 1.9.3 or higher
|
76
|
+
|
77
|
+
* in Nokogiri 1.6.0 and later libxml2 and libxslt are bundled with the
|
78
|
+
gem, but if you want to use them installed on the system:
|
79
|
+
|
80
|
+
* libxml2 >=2.6.21 and <2.9.0, with iconv support
|
81
|
+
(libxml2-dev/-devel is required too)
|
82
|
+
|
83
|
+
* libxslt, built with and supported by the given libxml2
|
84
|
+
(libxslt-dev/-devel is required too)
|
81
85
|
|
82
86
|
== ENCODING:
|
83
87
|
|
@@ -111,7 +115,7 @@ explicitly setting the encoding to EUC-JP on the parser:
|
|
111
115
|
|
112
116
|
Binary packages are available for:
|
113
117
|
|
114
|
-
* SuSE[
|
118
|
+
* SuSE[https://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/]
|
115
119
|
* Fedora[http://s390.koji.fedoraproject.org/koji/packageinfo?packageID=6756]
|
116
120
|
|
117
121
|
== DEVELOPMENT:
|
@@ -146,7 +150,7 @@ Then run rake:
|
|
146
150
|
|
147
151
|
(The MIT License)
|
148
152
|
|
149
|
-
Copyright (c) 2008 -
|
153
|
+
Copyright (c) 2008 - 2013:
|
150
154
|
|
151
155
|
* {Aaron Patterson}[http://tenderlovemaking.com]
|
152
156
|
* {Mike Dalessio}[http://mike.daless.io]
|
@@ -154,6 +158,7 @@ Copyright (c) 2008 - 2012:
|
|
154
158
|
* {Sergio Arbeo}[http://www.serabe.com]
|
155
159
|
* {Patrick Mahoney}[http://polycrystal.org]
|
156
160
|
* {Yoko Harada}[http://yokolet.blogspot.com]
|
161
|
+
* {Akinori MUSHA}[https://akinori.org]
|
157
162
|
|
158
163
|
Permission is hereby granted, free of charge, to any person obtaining
|
159
164
|
a copy of this software and associated documentation files (the
|
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
|
-
|
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
|
-
|
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,33 @@ 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'
|
112
|
+
|
113
|
+
license "MIT"
|
29
114
|
|
30
115
|
self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
|
31
116
|
self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
|
32
117
|
|
33
118
|
self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
|
34
119
|
|
35
|
-
self.licenses = ['MIT']
|
36
120
|
|
37
121
|
self.clean_globs += [
|
38
122
|
'nokogiri.gemspec',
|
39
123
|
'lib/nokogiri/nokogiri.{bundle,jar,rb,so}',
|
40
|
-
'lib/nokogiri/
|
124
|
+
'lib/nokogiri/[0-9].[0-9]',
|
125
|
+
'ports/*.installed',
|
126
|
+
'ports/{i[3-6]86,x86_64}-{w64-,}mingw32*',
|
127
|
+
'ports/libxml2',
|
128
|
+
'ports/libxslt',
|
41
129
|
# GENERATED_PARSER,
|
42
130
|
# GENERATED_TOKENIZER
|
43
131
|
]
|
44
132
|
|
45
|
-
|
46
|
-
[
|
47
|
-
|
133
|
+
unless java?
|
134
|
+
self.extra_deps += [
|
135
|
+
["mini_portile", "~> 0.5.2"],
|
136
|
+
]
|
137
|
+
end
|
48
138
|
|
49
139
|
self.extra_dev_deps += [
|
50
140
|
["hoe-bundler", ">= 1.1"],
|
@@ -53,7 +143,7 @@ HOE = Hoe.spec 'nokogiri' do
|
|
53
143
|
["hoe-git", ">= 1.4"],
|
54
144
|
["minitest", "~> 2.2.2"],
|
55
145
|
["rake", ">= 0.9"],
|
56
|
-
["rake-compiler", "~> 0.
|
146
|
+
["rake-compiler", "~> 0.9.2"],
|
57
147
|
["racc", ">= 1.4.6"],
|
58
148
|
["rexical", ">= 1.0.5"]
|
59
149
|
]
|
@@ -77,7 +167,7 @@ def add_file_to_gem relative_path
|
|
77
167
|
target_dir = File.dirname(target_path)
|
78
168
|
mkdir_p target_dir unless File.directory?(target_dir)
|
79
169
|
rm_f target_path
|
80
|
-
|
170
|
+
safe_ln relative_path, target_path
|
81
171
|
HOE.spec.files += [relative_path]
|
82
172
|
end
|
83
173
|
|
@@ -92,6 +182,8 @@ if java?
|
|
92
182
|
jruby_home = RbConfig::CONFIG['prefix']
|
93
183
|
ext.ext_dir = 'ext/java'
|
94
184
|
ext.lib_dir = 'lib/nokogiri'
|
185
|
+
ext.source_version = '1.6'
|
186
|
+
ext.target_version = '1.6'
|
95
187
|
jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
|
96
188
|
ext.classpath = jars.map { |x| File.expand_path x }.join ':'
|
97
189
|
end
|
@@ -100,9 +192,11 @@ if java?
|
|
100
192
|
add_file_to_gem 'lib/nokogiri/nokogiri.jar'
|
101
193
|
end
|
102
194
|
else
|
103
|
-
mingw_available = true
|
104
195
|
begin
|
105
|
-
require '
|
196
|
+
require 'rake/extensioncompiler'
|
197
|
+
# Ensure mingw compiler is installed
|
198
|
+
Rake::ExtensionCompiler.mingw_host
|
199
|
+
mingw_available = true
|
106
200
|
rescue
|
107
201
|
puts "WARNING: cross compilation not available: #{$!}"
|
108
202
|
mingw_available = false
|
@@ -111,18 +205,24 @@ else
|
|
111
205
|
|
112
206
|
HOE.spec.files.reject! { |f| f =~ %r{\.(java|jar)$} }
|
113
207
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
add_file_to_gem
|
125
|
-
|
208
|
+
dependencies = YAML.load_file("dependencies.yml")
|
209
|
+
|
210
|
+
task gem_build_path do
|
211
|
+
%w[libxml2 libxslt].each do |lib|
|
212
|
+
version = dependencies[lib]
|
213
|
+
archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz")
|
214
|
+
add_file_to_gem archive
|
215
|
+
patchesdir = File.join("ports", "patches", lib)
|
216
|
+
patches = `#{['git', 'ls-files', patchesdir].shelljoin}`.split("\n").grep(/\.patch\z/)
|
217
|
+
patches.each { |patch|
|
218
|
+
add_file_to_gem patch
|
219
|
+
}
|
220
|
+
(untracked = Dir[File.join(patchesdir, '*.patch')] - patches).empty? or
|
221
|
+
at_exit {
|
222
|
+
untracked.each { |patch|
|
223
|
+
puts "** WARNING: untracked patch file not added to gem: #{patch}"
|
224
|
+
}
|
225
|
+
}
|
126
226
|
end
|
127
227
|
end
|
128
228
|
|
@@ -131,12 +231,16 @@ else
|
|
131
231
|
ext.config_options << ENV['EXTOPTS']
|
132
232
|
if mingw_available
|
133
233
|
ext.cross_compile = true
|
134
|
-
ext.cross_platform =
|
135
|
-
ext.cross_config_options << "--
|
136
|
-
ext.
|
137
|
-
|
138
|
-
|
139
|
-
|
234
|
+
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
235
|
+
ext.cross_config_options << "--enable-cross-build"
|
236
|
+
ext.cross_compiling do |spec|
|
237
|
+
libs = dependencies.map { |name, version| "#{name}-#{version}" }.join(', ')
|
238
|
+
|
239
|
+
spec.post_install_message = <<-EOS
|
240
|
+
Nokogiri is built with the packaged libraries: #{libs}.
|
241
|
+
EOS
|
242
|
+
spec.files.reject! { |path| File.fnmatch?('ports/*', path) }
|
243
|
+
end
|
140
244
|
end
|
141
245
|
end
|
142
246
|
end
|
@@ -193,9 +297,9 @@ task :java_debug do
|
|
193
297
|
end
|
194
298
|
|
195
299
|
if java?
|
196
|
-
task :
|
197
|
-
task :
|
198
|
-
ENV['JRUBY_OPTS'] = "--
|
300
|
+
task :test_19 => :test
|
301
|
+
task :test_20 do
|
302
|
+
ENV['JRUBY_OPTS'] = "--2.0"
|
199
303
|
Rake::Task["test"].invoke
|
200
304
|
end
|
201
305
|
end
|
@@ -212,37 +316,37 @@ end
|
|
212
316
|
|
213
317
|
# ----------------------------------------
|
214
318
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
319
|
+
def verify_dll(dll, cross_ruby)
|
320
|
+
dll_imports = cross_ruby.dlls
|
321
|
+
dump = `#{['env', 'LANG=C', cross_ruby.tool('objdump'), '-p', dll].shelljoin}`
|
322
|
+
raise "unexpected file format for generated dll #{dll}" unless /file format #{Regexp.quote(cross_ruby.target)}\s/ === dump
|
323
|
+
raise "export function Init_nokogiri not in dll #{dll}" unless /Table.*\sInit_nokogiri\s/mi === dump
|
324
|
+
|
325
|
+
# Verify that the expected DLL dependencies match the actual dependencies
|
326
|
+
# and that no further dependencies exist.
|
327
|
+
dll_imports_is = dump.scan(/DLL Name: (.*)$/).map(&:first).map(&:downcase).uniq
|
328
|
+
if dll_imports_is.sort != dll_imports.sort
|
329
|
+
raise "unexpected dll imports #{dll_imports_is.inspect} in #{dll}"
|
330
|
+
end
|
331
|
+
puts "#{dll}: Looks good!"
|
332
|
+
end
|
220
333
|
|
334
|
+
task :cross do
|
335
|
+
rake_compiler_config_path = File.expand_path("~/.rake-compiler/config.yml")
|
221
336
|
unless File.exists? rake_compiler_config_path
|
222
|
-
raise "rake-compiler has not installed any cross rubies.
|
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
|
337
|
+
raise "rake-compiler has not installed any cross rubies. Try using rake-compiler-dev-box for building binary windows gems.'"
|
235
338
|
end
|
236
339
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
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!")
|
340
|
+
CROSS_RUBIES.each do |cross_ruby|
|
341
|
+
task "tmp/#{cross_ruby.platform}/nokogiri/#{cross_ruby.ver}/nokogiri.so" do |t|
|
342
|
+
# To reduce the gem file size strip mingw32 dlls before packaging
|
343
|
+
sh [cross_ruby.tool('strip'), '-S', t.name].shelljoin
|
344
|
+
verify_dll t.name, cross_ruby
|
345
|
+
end
|
346
|
+
end
|
246
347
|
end
|
247
348
|
|
349
|
+
desc "build a windows gem without all the ceremony."
|
350
|
+
task "gem:windows" => %w[cross native gem]
|
351
|
+
|
248
352
|
# 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
|
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
|
-
#
|
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
|
-
|
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
|
-
|
56
|
-
rvm_use
|
57
|
-
|
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
|
-
|
77
|
-
|
78
|
-
|
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-
|
114
|
+
cp -v pkg/nokogiri*{x86,x64}-mingw32*.gem gems
|
91
115
|
|
92
116
|
# MRI
|
93
|
-
|
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
|
126
|
+
rvm_use $DEFAULT_RUBY
|
102
127
|
bundle exec rake generate
|
103
128
|
rvm_use jruby
|
104
129
|
bundle exec rake gem
|