nokogiri 1.11.0.rc3-java → 1.11.4-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.

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