nokogiri 1.11.0.rc1-java → 1.11.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.

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