ruby_on_ruby 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. data/.gitignore +18 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE +22 -0
  5. data/README.md +66 -0
  6. data/Rakefile +1 -0
  7. data/lib/ruby_on_ruby.rb +5 -0
  8. data/lib/ruby_on_ruby/console.rb +7 -0
  9. data/lib/ruby_on_ruby/context.rb +33 -0
  10. data/lib/ruby_on_ruby/file_loader.rb +31 -0
  11. data/lib/ruby_on_ruby/ruby_stream.rb +27 -0
  12. data/lib/ruby_on_ruby/version.rb +3 -0
  13. data/lib/rubyonruby.rb +1 -0
  14. data/ruby_in_ruby.gemspec +19 -0
  15. data/vendor/javascripts/emscripted-ruby/lib/.document +106 -0
  16. data/vendor/javascripts/emscripted-ruby/lib/English.rb +155 -0
  17. data/vendor/javascripts/emscripted-ruby/lib/Env.rb +18 -0
  18. data/vendor/javascripts/emscripted-ruby/lib/README +96 -0
  19. data/vendor/javascripts/emscripted-ruby/lib/abbrev.rb +103 -0
  20. data/vendor/javascripts/emscripted-ruby/lib/base64.rb +133 -0
  21. data/vendor/javascripts/emscripted-ruby/lib/benchmark.rb +572 -0
  22. data/vendor/javascripts/emscripted-ruby/lib/cgi-lib.rb +272 -0
  23. data/vendor/javascripts/emscripted-ruby/lib/cgi.rb +2308 -0
  24. data/vendor/javascripts/emscripted-ruby/lib/cgi/.document +2 -0
  25. data/vendor/javascripts/emscripted-ruby/lib/cgi/session.rb +498 -0
  26. data/vendor/javascripts/emscripted-ruby/lib/cgi/session/pstore.rb +111 -0
  27. data/vendor/javascripts/emscripted-ruby/lib/complex.rb +663 -0
  28. data/vendor/javascripts/emscripted-ruby/lib/csv.rb +992 -0
  29. data/vendor/javascripts/emscripted-ruby/lib/date.rb +1767 -0
  30. data/vendor/javascripts/emscripted-ruby/lib/date/format.rb +1190 -0
  31. data/vendor/javascripts/emscripted-ruby/lib/date2.rb +5 -0
  32. data/vendor/javascripts/emscripted-ruby/lib/debug.rb +947 -0
  33. data/vendor/javascripts/emscripted-ruby/lib/delegate.rb +337 -0
  34. data/vendor/javascripts/emscripted-ruby/lib/drb.rb +2 -0
  35. data/vendor/javascripts/emscripted-ruby/lib/drb/acl.rb +146 -0
  36. data/vendor/javascripts/emscripted-ruby/lib/drb/drb.rb +1782 -0
  37. data/vendor/javascripts/emscripted-ruby/lib/drb/eq.rb +16 -0
  38. data/vendor/javascripts/emscripted-ruby/lib/drb/extserv.rb +64 -0
  39. data/vendor/javascripts/emscripted-ruby/lib/drb/extservm.rb +89 -0
  40. data/vendor/javascripts/emscripted-ruby/lib/drb/gw.rb +122 -0
  41. data/vendor/javascripts/emscripted-ruby/lib/drb/invokemethod.rb +36 -0
  42. data/vendor/javascripts/emscripted-ruby/lib/drb/observer.rb +22 -0
  43. data/vendor/javascripts/emscripted-ruby/lib/drb/ssl.rb +190 -0
  44. data/vendor/javascripts/emscripted-ruby/lib/drb/timeridconv.rb +91 -0
  45. data/vendor/javascripts/emscripted-ruby/lib/drb/unix.rb +108 -0
  46. data/vendor/javascripts/emscripted-ruby/lib/e2mmap.rb +195 -0
  47. data/vendor/javascripts/emscripted-ruby/lib/erb.rb +880 -0
  48. data/vendor/javascripts/emscripted-ruby/lib/eregex.rb +37 -0
  49. data/vendor/javascripts/emscripted-ruby/lib/fileutils.rb +1591 -0
  50. data/vendor/javascripts/emscripted-ruby/lib/finalize.rb +193 -0
  51. data/vendor/javascripts/emscripted-ruby/lib/find.rb +79 -0
  52. data/vendor/javascripts/emscripted-ruby/lib/forwardable.rb +218 -0
  53. data/vendor/javascripts/emscripted-ruby/lib/ftools.rb +261 -0
  54. data/vendor/javascripts/emscripted-ruby/lib/generator.rb +418 -0
  55. data/vendor/javascripts/emscripted-ruby/lib/getoptlong.rb +621 -0
  56. data/vendor/javascripts/emscripted-ruby/lib/getopts.rb +127 -0
  57. data/vendor/javascripts/emscripted-ruby/lib/gserver.rb +253 -0
  58. data/vendor/javascripts/emscripted-ruby/lib/importenv.rb +33 -0
  59. data/vendor/javascripts/emscripted-ruby/lib/ipaddr.rb +814 -0
  60. data/vendor/javascripts/emscripted-ruby/lib/irb.rb +346 -0
  61. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/chws.rb +33 -0
  62. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/fork.rb +39 -0
  63. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/help.rb +34 -0
  64. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/load.rb +67 -0
  65. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/nop.rb +39 -0
  66. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/pushws.rb +39 -0
  67. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/subirb.rb +43 -0
  68. data/vendor/javascripts/emscripted-ruby/lib/irb/completion.rb +205 -0
  69. data/vendor/javascripts/emscripted-ruby/lib/irb/context.rb +255 -0
  70. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/change-ws.rb +62 -0
  71. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/history.rb +110 -0
  72. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/loader.rb +120 -0
  73. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/math-mode.rb +37 -0
  74. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/multi-irb.rb +241 -0
  75. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/save-history.rb +85 -0
  76. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/tracer.rb +61 -0
  77. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/use-loader.rb +65 -0
  78. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/workspaces.rb +56 -0
  79. data/vendor/javascripts/emscripted-ruby/lib/irb/extend-command.rb +264 -0
  80. data/vendor/javascripts/emscripted-ruby/lib/irb/frame.rb +67 -0
  81. data/vendor/javascripts/emscripted-ruby/lib/irb/help.rb +33 -0
  82. data/vendor/javascripts/emscripted-ruby/lib/irb/init.rb +259 -0
  83. data/vendor/javascripts/emscripted-ruby/lib/irb/input-method.rb +120 -0
  84. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/error.rb +30 -0
  85. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/help-message +35 -0
  86. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/error.rb +27 -0
  87. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/help-message +36 -0
  88. data/vendor/javascripts/emscripted-ruby/lib/irb/locale.rb +184 -0
  89. data/vendor/javascripts/emscripted-ruby/lib/irb/notifier.rb +145 -0
  90. data/vendor/javascripts/emscripted-ruby/lib/irb/output-method.rb +85 -0
  91. data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-lex.rb +1149 -0
  92. data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-token.rb +273 -0
  93. data/vendor/javascripts/emscripted-ruby/lib/irb/slex.rb +285 -0
  94. data/vendor/javascripts/emscripted-ruby/lib/irb/version.rb +16 -0
  95. data/vendor/javascripts/emscripted-ruby/lib/irb/workspace.rb +107 -0
  96. data/vendor/javascripts/emscripted-ruby/lib/irb/ws-for-case-2.rb +15 -0
  97. data/vendor/javascripts/emscripted-ruby/lib/irb/xmp.rb +86 -0
  98. data/vendor/javascripts/emscripted-ruby/lib/jcode.rb +220 -0
  99. data/vendor/javascripts/emscripted-ruby/lib/logger.rb +703 -0
  100. data/vendor/javascripts/emscripted-ruby/lib/mailread.rb +62 -0
  101. data/vendor/javascripts/emscripted-ruby/lib/mathn.rb +308 -0
  102. data/vendor/javascripts/emscripted-ruby/lib/matrix.rb +1278 -0
  103. data/vendor/javascripts/emscripted-ruby/lib/mkmf.rb +1811 -0
  104. data/vendor/javascripts/emscripted-ruby/lib/monitor.rb +352 -0
  105. data/vendor/javascripts/emscripted-ruby/lib/mutex_m.rb +122 -0
  106. data/vendor/javascripts/emscripted-ruby/lib/net/ftp.rb +927 -0
  107. data/vendor/javascripts/emscripted-ruby/lib/net/http.rb +2277 -0
  108. data/vendor/javascripts/emscripted-ruby/lib/net/https.rb +173 -0
  109. data/vendor/javascripts/emscripted-ruby/lib/net/imap.rb +3371 -0
  110. data/vendor/javascripts/emscripted-ruby/lib/net/pop.rb +999 -0
  111. data/vendor/javascripts/emscripted-ruby/lib/net/protocol.rb +392 -0
  112. data/vendor/javascripts/emscripted-ruby/lib/net/smtp.rb +1014 -0
  113. data/vendor/javascripts/emscripted-ruby/lib/net/telnet.rb +756 -0
  114. data/vendor/javascripts/emscripted-ruby/lib/observer.rb +192 -0
  115. data/vendor/javascripts/emscripted-ruby/lib/open-uri.rb +678 -0
  116. data/vendor/javascripts/emscripted-ruby/lib/open3.rb +101 -0
  117. data/vendor/javascripts/emscripted-ruby/lib/optparse.rb +1790 -0
  118. data/vendor/javascripts/emscripted-ruby/lib/optparse/date.rb +17 -0
  119. data/vendor/javascripts/emscripted-ruby/lib/optparse/shellwords.rb +6 -0
  120. data/vendor/javascripts/emscripted-ruby/lib/optparse/time.rb +10 -0
  121. data/vendor/javascripts/emscripted-ruby/lib/optparse/uri.rb +6 -0
  122. data/vendor/javascripts/emscripted-ruby/lib/optparse/version.rb +70 -0
  123. data/vendor/javascripts/emscripted-ruby/lib/ostruct.rb +146 -0
  124. data/vendor/javascripts/emscripted-ruby/lib/parsearg.rb +87 -0
  125. data/vendor/javascripts/emscripted-ruby/lib/parsedate.rb +53 -0
  126. data/vendor/javascripts/emscripted-ruby/lib/pathname.rb +1062 -0
  127. data/vendor/javascripts/emscripted-ruby/lib/ping.rb +64 -0
  128. data/vendor/javascripts/emscripted-ruby/lib/pp.rb +654 -0
  129. data/vendor/javascripts/emscripted-ruby/lib/prettyprint.rb +896 -0
  130. data/vendor/javascripts/emscripted-ruby/lib/profile.rb +6 -0
  131. data/vendor/javascripts/emscripted-ruby/lib/profiler.rb +59 -0
  132. data/vendor/javascripts/emscripted-ruby/lib/pstore.rb +395 -0
  133. data/vendor/javascripts/emscripted-ruby/lib/racc/parser.rb +442 -0
  134. data/vendor/javascripts/emscripted-ruby/lib/rational.rb +564 -0
  135. data/vendor/javascripts/emscripted-ruby/lib/readbytes.rb +41 -0
  136. data/vendor/javascripts/emscripted-ruby/lib/resolv-replace.rb +62 -0
  137. data/vendor/javascripts/emscripted-ruby/lib/resolv.rb +2210 -0
  138. data/vendor/javascripts/emscripted-ruby/lib/rexml/attlistdecl.rb +62 -0
  139. data/vendor/javascripts/emscripted-ruby/lib/rexml/attribute.rb +185 -0
  140. data/vendor/javascripts/emscripted-ruby/lib/rexml/cdata.rb +67 -0
  141. data/vendor/javascripts/emscripted-ruby/lib/rexml/child.rb +96 -0
  142. data/vendor/javascripts/emscripted-ruby/lib/rexml/comment.rb +80 -0
  143. data/vendor/javascripts/emscripted-ruby/lib/rexml/doctype.rb +271 -0
  144. data/vendor/javascripts/emscripted-ruby/lib/rexml/document.rb +208 -0
  145. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
  146. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/dtd.rb +51 -0
  147. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/elementdecl.rb +17 -0
  148. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/entitydecl.rb +56 -0
  149. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/notationdecl.rb +39 -0
  150. data/vendor/javascripts/emscripted-ruby/lib/rexml/element.rb +1227 -0
  151. data/vendor/javascripts/emscripted-ruby/lib/rexml/encoding.rb +71 -0
  152. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/CP-1252.rb +103 -0
  153. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
  154. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ICONV.rb +22 -0
  155. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
  156. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
  157. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
  158. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
  159. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UNILE.rb +34 -0
  160. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
  161. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-16.rb +35 -0
  162. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-8.rb +18 -0
  163. data/vendor/javascripts/emscripted-ruby/lib/rexml/entity.rb +165 -0
  164. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/default.rb +109 -0
  165. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/pretty.rb +137 -0
  166. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/transitive.rb +56 -0
  167. data/vendor/javascripts/emscripted-ruby/lib/rexml/functions.rb +382 -0
  168. data/vendor/javascripts/emscripted-ruby/lib/rexml/instruction.rb +70 -0
  169. data/vendor/javascripts/emscripted-ruby/lib/rexml/light/node.rb +196 -0
  170. data/vendor/javascripts/emscripted-ruby/lib/rexml/namespace.rb +47 -0
  171. data/vendor/javascripts/emscripted-ruby/lib/rexml/node.rb +75 -0
  172. data/vendor/javascripts/emscripted-ruby/lib/rexml/output.rb +24 -0
  173. data/vendor/javascripts/emscripted-ruby/lib/rexml/parent.rb +166 -0
  174. data/vendor/javascripts/emscripted-ruby/lib/rexml/parseexception.rb +51 -0
  175. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/baseparser.rb +503 -0
  176. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/lightparser.rb +60 -0
  177. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/pullparser.rb +196 -0
  178. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/sax2parser.rb +238 -0
  179. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/streamparser.rb +46 -0
  180. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/treeparser.rb +97 -0
  181. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
  182. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/xpathparser.rb +698 -0
  183. data/vendor/javascripts/emscripted-ruby/lib/rexml/quickpath.rb +266 -0
  184. data/vendor/javascripts/emscripted-ruby/lib/rexml/rexml.rb +32 -0
  185. data/vendor/javascripts/emscripted-ruby/lib/rexml/sax2listener.rb +97 -0
  186. data/vendor/javascripts/emscripted-ruby/lib/rexml/source.rb +251 -0
  187. data/vendor/javascripts/emscripted-ruby/lib/rexml/streamlistener.rb +92 -0
  188. data/vendor/javascripts/emscripted-ruby/lib/rexml/syncenumerator.rb +33 -0
  189. data/vendor/javascripts/emscripted-ruby/lib/rexml/text.rb +344 -0
  190. data/vendor/javascripts/emscripted-ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
  191. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/relaxng.rb +559 -0
  192. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validation.rb +155 -0
  193. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validationexception.rb +9 -0
  194. data/vendor/javascripts/emscripted-ruby/lib/rexml/xmldecl.rb +119 -0
  195. data/vendor/javascripts/emscripted-ruby/lib/rexml/xmltokens.rb +18 -0
  196. data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath.rb +66 -0
  197. data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath_parser.rb +792 -0
  198. data/vendor/javascripts/emscripted-ruby/lib/rinda/rinda.rb +283 -0
  199. data/vendor/javascripts/emscripted-ruby/lib/rinda/ring.rb +271 -0
  200. data/vendor/javascripts/emscripted-ruby/lib/rinda/tuplespace.rb +642 -0
  201. data/vendor/javascripts/emscripted-ruby/lib/rss.rb +19 -0
  202. data/vendor/javascripts/emscripted-ruby/lib/rss/0.9.rb +428 -0
  203. data/vendor/javascripts/emscripted-ruby/lib/rss/1.0.rb +452 -0
  204. data/vendor/javascripts/emscripted-ruby/lib/rss/2.0.rb +111 -0
  205. data/vendor/javascripts/emscripted-ruby/lib/rss/atom.rb +749 -0
  206. data/vendor/javascripts/emscripted-ruby/lib/rss/content.rb +31 -0
  207. data/vendor/javascripts/emscripted-ruby/lib/rss/content/1.0.rb +10 -0
  208. data/vendor/javascripts/emscripted-ruby/lib/rss/content/2.0.rb +12 -0
  209. data/vendor/javascripts/emscripted-ruby/lib/rss/converter.rb +162 -0
  210. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore.rb +161 -0
  211. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/1.0.rb +13 -0
  212. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/2.0.rb +13 -0
  213. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/atom.rb +17 -0
  214. data/vendor/javascripts/emscripted-ruby/lib/rss/image.rb +193 -0
  215. data/vendor/javascripts/emscripted-ruby/lib/rss/itunes.rb +410 -0
  216. data/vendor/javascripts/emscripted-ruby/lib/rss/maker.rb +44 -0
  217. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/0.9.rb +467 -0
  218. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/1.0.rb +434 -0
  219. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/2.0.rb +223 -0
  220. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/atom.rb +172 -0
  221. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/base.rb +868 -0
  222. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/content.rb +21 -0
  223. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/dublincore.rb +124 -0
  224. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/entry.rb +163 -0
  225. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/feed.rb +429 -0
  226. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/image.rb +111 -0
  227. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/itunes.rb +242 -0
  228. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/slash.rb +33 -0
  229. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/syndication.rb +18 -0
  230. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/taxonomy.rb +118 -0
  231. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/trackback.rb +61 -0
  232. data/vendor/javascripts/emscripted-ruby/lib/rss/parser.rb +541 -0
  233. data/vendor/javascripts/emscripted-ruby/lib/rss/rexmlparser.rb +54 -0
  234. data/vendor/javascripts/emscripted-ruby/lib/rss/rss.rb +1312 -0
  235. data/vendor/javascripts/emscripted-ruby/lib/rss/slash.rb +49 -0
  236. data/vendor/javascripts/emscripted-ruby/lib/rss/syndication.rb +67 -0
  237. data/vendor/javascripts/emscripted-ruby/lib/rss/taxonomy.rb +145 -0
  238. data/vendor/javascripts/emscripted-ruby/lib/rss/trackback.rb +288 -0
  239. data/vendor/javascripts/emscripted-ruby/lib/rss/utils.rb +111 -0
  240. data/vendor/javascripts/emscripted-ruby/lib/rss/xml-stylesheet.rb +105 -0
  241. data/vendor/javascripts/emscripted-ruby/lib/rss/xml.rb +71 -0
  242. data/vendor/javascripts/emscripted-ruby/lib/rss/xmlparser.rb +93 -0
  243. data/vendor/javascripts/emscripted-ruby/lib/rss/xmlscanner.rb +121 -0
  244. data/vendor/javascripts/emscripted-ruby/lib/rubyunit.rb +6 -0
  245. data/vendor/javascripts/emscripted-ruby/lib/runit/assert.rb +73 -0
  246. data/vendor/javascripts/emscripted-ruby/lib/runit/cui/testrunner.rb +51 -0
  247. data/vendor/javascripts/emscripted-ruby/lib/runit/error.rb +9 -0
  248. data/vendor/javascripts/emscripted-ruby/lib/runit/testcase.rb +45 -0
  249. data/vendor/javascripts/emscripted-ruby/lib/runit/testresult.rb +44 -0
  250. data/vendor/javascripts/emscripted-ruby/lib/runit/testsuite.rb +26 -0
  251. data/vendor/javascripts/emscripted-ruby/lib/runit/topublic.rb +8 -0
  252. data/vendor/javascripts/emscripted-ruby/lib/scanf.rb +702 -0
  253. data/vendor/javascripts/emscripted-ruby/lib/securerandom.rb +137 -0
  254. data/vendor/javascripts/emscripted-ruby/lib/set.rb +1233 -0
  255. data/vendor/javascripts/emscripted-ruby/lib/shell.rb +269 -0
  256. data/vendor/javascripts/emscripted-ruby/lib/shell/builtin-command.rb +154 -0
  257. data/vendor/javascripts/emscripted-ruby/lib/shell/command-processor.rb +592 -0
  258. data/vendor/javascripts/emscripted-ruby/lib/shell/error.rb +26 -0
  259. data/vendor/javascripts/emscripted-ruby/lib/shell/filter.rb +110 -0
  260. data/vendor/javascripts/emscripted-ruby/lib/shell/process-controller.rb +260 -0
  261. data/vendor/javascripts/emscripted-ruby/lib/shell/system-command.rb +168 -0
  262. data/vendor/javascripts/emscripted-ruby/lib/shell/version.rb +16 -0
  263. data/vendor/javascripts/emscripted-ruby/lib/shellwords.rb +172 -0
  264. data/vendor/javascripts/emscripted-ruby/lib/singleton.rb +360 -0
  265. data/vendor/javascripts/emscripted-ruby/lib/soap/attachment.rb +107 -0
  266. data/vendor/javascripts/emscripted-ruby/lib/soap/baseData.rb +942 -0
  267. data/vendor/javascripts/emscripted-ruby/lib/soap/element.rb +258 -0
  268. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/aspDotNetHandler.rb +213 -0
  269. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/handler.rb +100 -0
  270. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/literalHandler.rb +226 -0
  271. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/soapHandler.rb +582 -0
  272. data/vendor/javascripts/emscripted-ruby/lib/soap/generator.rb +268 -0
  273. data/vendor/javascripts/emscripted-ruby/lib/soap/header/handler.rb +57 -0
  274. data/vendor/javascripts/emscripted-ruby/lib/soap/header/handlerset.rb +70 -0
  275. data/vendor/javascripts/emscripted-ruby/lib/soap/header/simplehandler.rb +44 -0
  276. data/vendor/javascripts/emscripted-ruby/lib/soap/httpconfigloader.rb +119 -0
  277. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping.rb +10 -0
  278. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/factory.rb +355 -0
  279. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/mapping.rb +381 -0
  280. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/registry.rb +541 -0
  281. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/rubytypeFactory.rb +475 -0
  282. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/typeMap.rb +50 -0
  283. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlencodedregistry.rb +280 -0
  284. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlliteralregistry.rb +418 -0
  285. data/vendor/javascripts/emscripted-ruby/lib/soap/marshal.rb +59 -0
  286. data/vendor/javascripts/emscripted-ruby/lib/soap/mimemessage.rb +240 -0
  287. data/vendor/javascripts/emscripted-ruby/lib/soap/netHttpClient.rb +190 -0
  288. data/vendor/javascripts/emscripted-ruby/lib/soap/parser.rb +251 -0
  289. data/vendor/javascripts/emscripted-ruby/lib/soap/processor.rb +66 -0
  290. data/vendor/javascripts/emscripted-ruby/lib/soap/property.rb +333 -0
  291. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/cgistub.rb +206 -0
  292. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/driver.rb +254 -0
  293. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/element.rb +325 -0
  294. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/httpserver.rb +129 -0
  295. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/proxy.rb +497 -0
  296. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/router.rb +594 -0
  297. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/rpc.rb +25 -0
  298. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/soaplet.rb +162 -0
  299. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/standaloneServer.rb +43 -0
  300. data/vendor/javascripts/emscripted-ruby/lib/soap/soap.rb +140 -0
  301. data/vendor/javascripts/emscripted-ruby/lib/soap/streamHandler.rb +229 -0
  302. data/vendor/javascripts/emscripted-ruby/lib/soap/wsdlDriver.rb +575 -0
  303. data/vendor/javascripts/emscripted-ruby/lib/sync.rb +311 -0
  304. data/vendor/javascripts/emscripted-ruby/lib/tempfile.rb +209 -0
  305. data/vendor/javascripts/emscripted-ruby/lib/test/unit.rb +280 -0
  306. data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertionfailederror.rb +14 -0
  307. data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertions.rb +622 -0
  308. data/vendor/javascripts/emscripted-ruby/lib/test/unit/autorunner.rb +220 -0
  309. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector.rb +43 -0
  310. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/dir.rb +107 -0
  311. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/objectspace.rb +34 -0
  312. data/vendor/javascripts/emscripted-ruby/lib/test/unit/error.rb +56 -0
  313. data/vendor/javascripts/emscripted-ruby/lib/test/unit/failure.rb +51 -0
  314. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testcase.rb +160 -0
  315. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testresult.rb +80 -0
  316. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testsuite.rb +76 -0
  317. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/console/testrunner.rb +127 -0
  318. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/fox/testrunner.rb +268 -0
  319. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk/testrunner.rb +416 -0
  320. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk2/testrunner.rb +465 -0
  321. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnermediator.rb +68 -0
  322. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnerutilities.rb +46 -0
  323. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/tk/testrunner.rb +260 -0
  324. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/backtracefilter.rb +40 -0
  325. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/observable.rb +90 -0
  326. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/procwrapper.rb +48 -0
  327. data/vendor/javascripts/emscripted-ruby/lib/thread.rb +479 -0
  328. data/vendor/javascripts/emscripted-ruby/lib/thwait.rb +169 -0
  329. data/vendor/javascripts/emscripted-ruby/lib/time.rb +797 -0
  330. data/vendor/javascripts/emscripted-ruby/lib/timeout.rb +122 -0
  331. data/vendor/javascripts/emscripted-ruby/lib/tmpdir.rb +130 -0
  332. data/vendor/javascripts/emscripted-ruby/lib/tracer.rb +167 -0
  333. data/vendor/javascripts/emscripted-ruby/lib/tsort.rb +290 -0
  334. data/vendor/javascripts/emscripted-ruby/lib/un.rb +235 -0
  335. data/vendor/javascripts/emscripted-ruby/lib/uri.rb +29 -0
  336. data/vendor/javascripts/emscripted-ruby/lib/uri/common.rb +611 -0
  337. data/vendor/javascripts/emscripted-ruby/lib/uri/ftp.rb +198 -0
  338. data/vendor/javascripts/emscripted-ruby/lib/uri/generic.rb +1122 -0
  339. data/vendor/javascripts/emscripted-ruby/lib/uri/http.rb +100 -0
  340. data/vendor/javascripts/emscripted-ruby/lib/uri/https.rb +20 -0
  341. data/vendor/javascripts/emscripted-ruby/lib/uri/ldap.rb +190 -0
  342. data/vendor/javascripts/emscripted-ruby/lib/uri/ldaps.rb +12 -0
  343. data/vendor/javascripts/emscripted-ruby/lib/uri/mailto.rb +266 -0
  344. data/vendor/javascripts/emscripted-ruby/lib/weakref.rb +100 -0
  345. data/vendor/javascripts/emscripted-ruby/lib/webrick.rb +29 -0
  346. data/vendor/javascripts/emscripted-ruby/lib/webrick/accesslog.rb +67 -0
  347. data/vendor/javascripts/emscripted-ruby/lib/webrick/cgi.rb +257 -0
  348. data/vendor/javascripts/emscripted-ruby/lib/webrick/compat.rb +15 -0
  349. data/vendor/javascripts/emscripted-ruby/lib/webrick/config.rb +97 -0
  350. data/vendor/javascripts/emscripted-ruby/lib/webrick/cookie.rb +110 -0
  351. data/vendor/javascripts/emscripted-ruby/lib/webrick/htmlutils.rb +25 -0
  352. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth.rb +45 -0
  353. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/authenticator.rb +79 -0
  354. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/basicauth.rb +65 -0
  355. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/digestauth.rb +343 -0
  356. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htdigest.rb +91 -0
  357. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htgroup.rb +61 -0
  358. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
  359. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/userdb.rb +29 -0
  360. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpproxy.rb +254 -0
  361. data/vendor/javascripts/emscripted-ruby/lib/webrick/httprequest.rb +365 -0
  362. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpresponse.rb +327 -0
  363. data/vendor/javascripts/emscripted-ruby/lib/webrick/https.rb +63 -0
  364. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpserver.rb +210 -0
  365. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet.rb +22 -0
  366. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/abstract.rb +71 -0
  367. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  368. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgihandler.rb +108 -0
  369. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
  370. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
  371. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
  372. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpstatus.rb +126 -0
  373. data/vendor/javascripts/emscripted-ruby/lib/webrick/httputils.rb +399 -0
  374. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpversion.rb +49 -0
  375. data/vendor/javascripts/emscripted-ruby/lib/webrick/log.rb +88 -0
  376. data/vendor/javascripts/emscripted-ruby/lib/webrick/server.rb +200 -0
  377. data/vendor/javascripts/emscripted-ruby/lib/webrick/ssl.rb +126 -0
  378. data/vendor/javascripts/emscripted-ruby/lib/webrick/utils.rb +100 -0
  379. data/vendor/javascripts/emscripted-ruby/lib/webrick/version.rb +13 -0
  380. data/vendor/javascripts/emscripted-ruby/lib/wsdl/binding.rb +65 -0
  381. data/vendor/javascripts/emscripted-ruby/lib/wsdl/data.rb +64 -0
  382. data/vendor/javascripts/emscripted-ruby/lib/wsdl/definitions.rb +250 -0
  383. data/vendor/javascripts/emscripted-ruby/lib/wsdl/documentation.rb +32 -0
  384. data/vendor/javascripts/emscripted-ruby/lib/wsdl/import.rb +80 -0
  385. data/vendor/javascripts/emscripted-ruby/lib/wsdl/importer.rb +38 -0
  386. data/vendor/javascripts/emscripted-ruby/lib/wsdl/info.rb +39 -0
  387. data/vendor/javascripts/emscripted-ruby/lib/wsdl/message.rb +54 -0
  388. data/vendor/javascripts/emscripted-ruby/lib/wsdl/operation.rb +130 -0
  389. data/vendor/javascripts/emscripted-ruby/lib/wsdl/operationBinding.rb +108 -0
  390. data/vendor/javascripts/emscripted-ruby/lib/wsdl/param.rb +85 -0
  391. data/vendor/javascripts/emscripted-ruby/lib/wsdl/parser.rb +163 -0
  392. data/vendor/javascripts/emscripted-ruby/lib/wsdl/part.rb +52 -0
  393. data/vendor/javascripts/emscripted-ruby/lib/wsdl/port.rb +84 -0
  394. data/vendor/javascripts/emscripted-ruby/lib/wsdl/portType.rb +73 -0
  395. data/vendor/javascripts/emscripted-ruby/lib/wsdl/service.rb +61 -0
  396. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/address.rb +40 -0
  397. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/binding.rb +49 -0
  398. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/body.rb +56 -0
  399. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/cgiStubCreator.rb +76 -0
  400. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreator.rb +314 -0
  401. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreatorSupport.rb +126 -0
  402. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/clientSkeltonCreator.rb +78 -0
  403. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/complexType.rb +161 -0
  404. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/data.rb +42 -0
  405. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/definitions.rb +149 -0
  406. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/driverCreator.rb +95 -0
  407. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/element.rb +28 -0
  408. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/fault.rb +56 -0
  409. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/header.rb +86 -0
  410. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/headerfault.rb +56 -0
  411. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/mappingRegistryCreator.rb +92 -0
  412. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/methodDefCreator.rb +228 -0
  413. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/operation.rb +122 -0
  414. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/servantSkeltonCreator.rb +67 -0
  415. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/standaloneServerStubCreator.rb +85 -0
  416. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/wsdl2ruby.rb +176 -0
  417. data/vendor/javascripts/emscripted-ruby/lib/wsdl/types.rb +43 -0
  418. data/vendor/javascripts/emscripted-ruby/lib/wsdl/wsdl.rb +23 -0
  419. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/all.rb +69 -0
  420. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/annotation.rb +34 -0
  421. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/any.rb +56 -0
  422. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/attribute.rb +127 -0
  423. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/choice.rb +69 -0
  424. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexContent.rb +92 -0
  425. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexType.rb +139 -0
  426. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/content.rb +96 -0
  427. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/data.rb +80 -0
  428. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/element.rb +154 -0
  429. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/enumeration.rb +36 -0
  430. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/import.rb +65 -0
  431. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/importer.rb +87 -0
  432. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/include.rb +54 -0
  433. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/length.rb +35 -0
  434. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/parser.rb +166 -0
  435. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/pattern.rb +36 -0
  436. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/schema.rb +143 -0
  437. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/sequence.rb +69 -0
  438. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleContent.rb +65 -0
  439. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleExtension.rb +54 -0
  440. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleRestriction.rb +73 -0
  441. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleType.rb +73 -0
  442. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/unique.rb +34 -0
  443. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/xsd2ruby.rb +107 -0
  444. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/.document +1 -0
  445. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/README.txt +31 -0
  446. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/base64.rb +81 -0
  447. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/client.rb +624 -0
  448. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/config.rb +40 -0
  449. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/create.rb +290 -0
  450. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/datetime.rb +142 -0
  451. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/httpserver.rb +178 -0
  452. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/marshal.rb +76 -0
  453. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/parser.rb +813 -0
  454. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/server.rb +780 -0
  455. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/utils.rb +165 -0
  456. data/vendor/javascripts/emscripted-ruby/lib/xsd/charset.rb +187 -0
  457. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen.rb +12 -0
  458. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/classdef.rb +203 -0
  459. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/commentdef.rb +34 -0
  460. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/gensupport.rb +166 -0
  461. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/methoddef.rb +63 -0
  462. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/moduledef.rb +191 -0
  463. data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes.rb +1269 -0
  464. data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes1999.rb +20 -0
  465. data/vendor/javascripts/emscripted-ruby/lib/xsd/iconvcharset.rb +33 -0
  466. data/vendor/javascripts/emscripted-ruby/lib/xsd/mapping.rb +42 -0
  467. data/vendor/javascripts/emscripted-ruby/lib/xsd/namedelements.rb +95 -0
  468. data/vendor/javascripts/emscripted-ruby/lib/xsd/ns.rb +140 -0
  469. data/vendor/javascripts/emscripted-ruby/lib/xsd/qname.rb +78 -0
  470. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser.rb +61 -0
  471. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/parser.rb +96 -0
  472. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/rexmlparser.rb +54 -0
  473. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlparser.rb +50 -0
  474. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlscanner.rb +147 -0
  475. data/vendor/javascripts/emscripted-ruby/lib/yaml.rb +440 -0
  476. data/vendor/javascripts/emscripted-ruby/lib/yaml/baseemitter.rb +247 -0
  477. data/vendor/javascripts/emscripted-ruby/lib/yaml/basenode.rb +216 -0
  478. data/vendor/javascripts/emscripted-ruby/lib/yaml/constants.rb +45 -0
  479. data/vendor/javascripts/emscripted-ruby/lib/yaml/dbm.rb +111 -0
  480. data/vendor/javascripts/emscripted-ruby/lib/yaml/encoding.rb +33 -0
  481. data/vendor/javascripts/emscripted-ruby/lib/yaml/error.rb +34 -0
  482. data/vendor/javascripts/emscripted-ruby/lib/yaml/loader.rb +14 -0
  483. data/vendor/javascripts/emscripted-ruby/lib/yaml/rubytypes.rb +408 -0
  484. data/vendor/javascripts/emscripted-ruby/lib/yaml/store.rb +43 -0
  485. data/vendor/javascripts/emscripted-ruby/lib/yaml/stream.rb +40 -0
  486. data/vendor/javascripts/emscripted-ruby/lib/yaml/stringio.rb +83 -0
  487. data/vendor/javascripts/emscripted-ruby/lib/yaml/syck.rb +19 -0
  488. data/vendor/javascripts/emscripted-ruby/lib/yaml/tag.rb +91 -0
  489. data/vendor/javascripts/emscripted-ruby/lib/yaml/types.rb +192 -0
  490. data/vendor/javascripts/emscripted-ruby/lib/yaml/yamlnode.rb +54 -0
  491. data/vendor/javascripts/emscripted-ruby/lib/yaml/ypath.rb +52 -0
  492. data/vendor/javascripts/emscripted-ruby/ruby.closure.js +7201 -0
  493. metadata +554 -0
@@ -0,0 +1,1811 @@
1
+ # module to create Makefile for extension modules
2
+ # invoke like: ruby -r mkmf extconf.rb
3
+
4
+ require 'rbconfig'
5
+ require 'fileutils'
6
+ require 'shellwords'
7
+
8
+ CONFIG = Config::MAKEFILE_CONFIG
9
+ ORIG_LIBPATH = ENV['LIB']
10
+
11
+ CXX_EXT = %w[cc cxx cpp]
12
+ if /mswin|bccwin|mingw|msdosdjgpp|human|os2/ !~ CONFIG['build_os']
13
+ CXX_EXT.concat(%w[C])
14
+ end
15
+ SRC_EXT = %w[c m] << CXX_EXT
16
+ $static = $config_h = nil
17
+ $default_static = $static
18
+
19
+ unless defined? $configure_args
20
+ $configure_args = {}
21
+ args = CONFIG["configure_args"]
22
+ if ENV["CONFIGURE_ARGS"]
23
+ args << " " << ENV["CONFIGURE_ARGS"]
24
+ end
25
+ for arg in Shellwords::shellwords(args)
26
+ arg, val = arg.split('=', 2)
27
+ next unless arg
28
+ arg.tr!('_', '-')
29
+ if arg.sub!(/^(?!--)/, '--')
30
+ val or next
31
+ arg.downcase!
32
+ end
33
+ next if /^--(?:top|topsrc|src|cur)dir$/ =~ arg
34
+ $configure_args[arg] = val || true
35
+ end
36
+ for arg in ARGV
37
+ arg, val = arg.split('=', 2)
38
+ next unless arg
39
+ arg.tr!('_', '-')
40
+ if arg.sub!(/^(?!--)/, '--')
41
+ val or next
42
+ arg.downcase!
43
+ end
44
+ $configure_args[arg] = val || true
45
+ end
46
+ end
47
+
48
+ $libdir = CONFIG["libdir"]
49
+ $rubylibdir = CONFIG["rubylibdir"]
50
+ $archdir = CONFIG["archdir"]
51
+ $sitedir = CONFIG["sitedir"]
52
+ $sitelibdir = CONFIG["sitelibdir"]
53
+ $sitearchdir = CONFIG["sitearchdir"]
54
+ $vendordir = CONFIG["vendordir"]
55
+ $vendorlibdir = CONFIG["vendorlibdir"]
56
+ $vendorarchdir = CONFIG["vendorarchdir"]
57
+
58
+ $mswin = /mswin/ =~ RUBY_PLATFORM
59
+ $bccwin = /bccwin/ =~ RUBY_PLATFORM
60
+ $mingw = /mingw/ =~ RUBY_PLATFORM
61
+ $cygwin = /cygwin/ =~ RUBY_PLATFORM
62
+ $human = /human/ =~ RUBY_PLATFORM
63
+ $netbsd = /netbsd/ =~ RUBY_PLATFORM
64
+ $os2 = /os2/ =~ RUBY_PLATFORM
65
+ $beos = /beos/ =~ RUBY_PLATFORM
66
+ $solaris = /solaris/ =~ RUBY_PLATFORM
67
+ $dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/)
68
+
69
+ # :stopdoc:
70
+
71
+ def config_string(key, config = CONFIG)
72
+ s = config[key] and !s.empty? and block_given? ? yield(s) : s
73
+ end
74
+
75
+ def dir_re(dir)
76
+ Regexp.new('\$(?:\('+dir+'\)|\{'+dir+'\})(?:\$(?:\(target_prefix\)|\{target_prefix\}))?')
77
+ end
78
+
79
+ INSTALL_DIRS = [
80
+ [dir_re('commondir'), "$(RUBYCOMMONDIR)"],
81
+ [dir_re('sitedir'), "$(RUBYCOMMONDIR)"],
82
+ [dir_re('vendordir'), "$(RUBYCOMMONDIR)"],
83
+ [dir_re('rubylibdir'), "$(RUBYLIBDIR)"],
84
+ [dir_re('archdir'), "$(RUBYARCHDIR)"],
85
+ [dir_re('sitelibdir'), "$(RUBYLIBDIR)"],
86
+ [dir_re('vendorlibdir'), "$(RUBYLIBDIR)"],
87
+ [dir_re('sitearchdir'), "$(RUBYARCHDIR)"],
88
+ [dir_re('bindir'), "$(BINDIR)"],
89
+ [dir_re('vendorarchdir'), "$(RUBYARCHDIR)"],
90
+ ]
91
+
92
+ def install_dirs(target_prefix = nil)
93
+ if $extout
94
+ dirs = [
95
+ ['BINDIR', '$(extout)/bin'],
96
+ ['RUBYCOMMONDIR', '$(extout)/common'],
97
+ ['RUBYLIBDIR', '$(RUBYCOMMONDIR)$(target_prefix)'],
98
+ ['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
99
+ ['extout', "#$extout"],
100
+ ['extout_prefix', "#$extout_prefix"],
101
+ ]
102
+ elsif $extmk
103
+ dirs = [
104
+ ['BINDIR', '$(bindir)'],
105
+ ['RUBYCOMMONDIR', '$(rubylibdir)'],
106
+ ['RUBYLIBDIR', '$(rubylibdir)$(target_prefix)'],
107
+ ['RUBYARCHDIR', '$(archdir)$(target_prefix)'],
108
+ ]
109
+ elsif $configure_args.has_key?('--vendor')
110
+ dirs = [
111
+ ['BINDIR', '$(bindir)'],
112
+ ['RUBYCOMMONDIR', '$(vendordir)$(target_prefix)'],
113
+ ['RUBYLIBDIR', '$(vendorlibdir)$(target_prefix)'],
114
+ ['RUBYARCHDIR', '$(vendorarchdir)$(target_prefix)'],
115
+ ]
116
+ else
117
+ dirs = [
118
+ ['BINDIR', '$(bindir)'],
119
+ ['RUBYCOMMONDIR', '$(sitedir)$(target_prefix)'],
120
+ ['RUBYLIBDIR', '$(sitelibdir)$(target_prefix)'],
121
+ ['RUBYARCHDIR', '$(sitearchdir)$(target_prefix)'],
122
+ ]
123
+ end
124
+ dirs << ['target_prefix', (target_prefix ? "/#{target_prefix}" : "")]
125
+ dirs
126
+ end
127
+
128
+ def map_dir(dir, map = nil)
129
+ map ||= INSTALL_DIRS
130
+ map.inject(dir) {|dir, (orig, new)| dir.gsub(orig, new)}
131
+ end
132
+
133
+ topdir = File.dirname(libdir = File.dirname(__FILE__))
134
+ extdir = File.expand_path("ext", topdir)
135
+ $extmk = File.expand_path($0)[0, extdir.size+1] == extdir+"/"
136
+ if not $extmk and File.exist?(($hdrdir = Config::CONFIG["archdir"]) + "/ruby.h")
137
+ $topdir = $hdrdir
138
+ elsif File.exist?(($hdrdir = ($top_srcdir ||= topdir)) + "/ruby.h") and
139
+ File.exist?(($topdir ||= Config::CONFIG["topdir"]) + "/config.h")
140
+ else
141
+ abort "mkmf.rb can't find header files for ruby at #{$hdrdir}/ruby.h"
142
+ end
143
+
144
+ OUTFLAG = CONFIG['OUTFLAG']
145
+ CPPOUTFILE = CONFIG['CPPOUTFILE']
146
+
147
+ CONFTEST_C = "conftest.c"
148
+
149
+ class String
150
+ # Wraps a string in escaped quotes if it contains whitespace.
151
+ def quote
152
+ /\s/ =~ self ? "\"#{self}\"" : "#{self}"
153
+ end
154
+
155
+ # Generates a string used as cpp macro name.
156
+ def tr_cpp
157
+ strip.upcase.tr_s("^A-Z0-9_", "_")
158
+ end
159
+ end
160
+ class Array
161
+ # Wraps all strings in escaped quotes if they contain whitespace.
162
+ def quote
163
+ map {|s| s.quote}
164
+ end
165
+ end
166
+
167
+ def rm_f(*files)
168
+ FileUtils.rm_f(Dir[files.join("\0")])
169
+ end
170
+
171
+ # Returns time stamp of the +target+ file if it exists and is newer
172
+ # than or equal to all of +times+.
173
+ def modified?(target, times)
174
+ (t = File.mtime(target)) rescue return nil
175
+ Array === times or times = [times]
176
+ t if times.all? {|n| n <= t}
177
+ end
178
+
179
+ def merge_libs(*libs)
180
+ libs.inject([]) do |x, y|
181
+ xy = x & y
182
+ xn = yn = 0
183
+ y = y.inject([]) {|ary, e| ary.last == e ? ary : ary << e}
184
+ y.each_with_index do |v, yi|
185
+ if xy.include?(v)
186
+ xi = [x.index(v), xn].max()
187
+ x[xi, 1] = y[yn..yi]
188
+ xn, yn = xi + (yi - yn + 1), yi + 1
189
+ end
190
+ end
191
+ x.concat(y[yn..-1] || [])
192
+ end
193
+ end
194
+
195
+ # This is a custom logging module. It generates an mkmf.log file when you
196
+ # run your extconf.rb script. This can be useful for debugging unexpected
197
+ # failures.
198
+ #
199
+ # This module and its associated methods are meant for internal use only.
200
+ #
201
+ module Logging
202
+ @log = nil
203
+ @logfile = 'mkmf.log'
204
+ @orgerr = $stderr.dup
205
+ @orgout = $stdout.dup
206
+ @postpone = 0
207
+ @quiet = $extmk
208
+
209
+ def self::open
210
+ @log ||= File::open(@logfile, 'w')
211
+ @log.sync = true
212
+ $stderr.reopen(@log)
213
+ $stdout.reopen(@log)
214
+ yield
215
+ ensure
216
+ $stderr.reopen(@orgerr)
217
+ $stdout.reopen(@orgout)
218
+ end
219
+
220
+ def self::message(*s)
221
+ @log ||= File::open(@logfile, 'w')
222
+ @log.sync = true
223
+ @log.printf(*s)
224
+ end
225
+
226
+ def self::logfile file
227
+ @logfile = file
228
+ if @log and not @log.closed?
229
+ @log.flush
230
+ @log.close
231
+ @log = nil
232
+ end
233
+ end
234
+
235
+ def self::postpone
236
+ tmplog = "mkmftmp#{@postpone += 1}.log"
237
+ open do
238
+ log, *save = @log, @logfile, @orgout, @orgerr
239
+ @log, @logfile, @orgout, @orgerr = nil, tmplog, log, log
240
+ begin
241
+ log.print(open {yield})
242
+ @log.close
243
+ File::open(tmplog) {|t| FileUtils.copy_stream(t, log)}
244
+ ensure
245
+ @log, @logfile, @orgout, @orgerr = log, *save
246
+ @postpone -= 1
247
+ rm_f tmplog
248
+ end
249
+ end
250
+ end
251
+
252
+ class << self
253
+ attr_accessor :quiet
254
+ end
255
+ end
256
+
257
+ def xsystem command
258
+ varpat = /\$\((\w+)\)|\$\{(\w+)\}/
259
+ if varpat =~ command
260
+ vars = Hash.new {|h, k| h[k] = ''; ENV[k]}
261
+ command = command.dup
262
+ nil while command.gsub!(varpat) {vars[$1||$2]}
263
+ end
264
+ Logging::open do
265
+ puts command.quote
266
+ system(command)
267
+ end
268
+ end
269
+
270
+ def xpopen command, *mode, &block
271
+ Logging::open do
272
+ case mode[0]
273
+ when nil, /^r/
274
+ puts "#{command} |"
275
+ else
276
+ puts "| #{command}"
277
+ end
278
+ IO.popen(command, *mode, &block)
279
+ end
280
+ end
281
+
282
+ def log_src(src)
283
+ src = src.split(/^/)
284
+ fmt = "%#{src.size.to_s.size}d: %s"
285
+ Logging::message <<"EOM"
286
+ checked program was:
287
+ /* begin */
288
+ EOM
289
+ src.each_with_index {|line, no| Logging::message fmt, no+1, line}
290
+ Logging::message <<"EOM"
291
+ /* end */
292
+
293
+ EOM
294
+ end
295
+
296
+ def create_tmpsrc(src)
297
+ src = yield(src) if block_given?
298
+ src = src.gsub(/[ \t]+$/, '').gsub(/\A\n+|^\n+$/, '').sub(/[^\n]\z/, "\\&\n")
299
+ open(CONFTEST_C, "wb") do |cfile|
300
+ cfile.print src
301
+ end
302
+ src
303
+ end
304
+
305
+ def try_do(src, command, &b)
306
+ src = create_tmpsrc(src, &b)
307
+ xsystem(command)
308
+ ensure
309
+ log_src(src)
310
+ end
311
+
312
+ def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
313
+ conf = Config::CONFIG.merge('hdrdir' => $hdrdir.quote,
314
+ 'src' => CONFTEST_C,
315
+ 'INCFLAGS' => $INCFLAGS,
316
+ 'CPPFLAGS' => $CPPFLAGS,
317
+ 'CFLAGS' => "#$CFLAGS",
318
+ 'ARCH_FLAG' => "#$ARCH_FLAG",
319
+ 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
320
+ 'LIBPATH' => libpathflag(libpath),
321
+ 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
322
+ 'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")
323
+ Config::expand(TRY_LINK.dup, conf)
324
+ end
325
+
326
+ def cc_command(opt="")
327
+ conf = Config::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote)
328
+ Config::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
329
+ conf)
330
+ end
331
+
332
+ def cpp_command(outfile, opt="")
333
+ conf = Config::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote)
334
+ Config::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
335
+ conf)
336
+ end
337
+
338
+ def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
339
+ libpath.map{|x|
340
+ case x
341
+ when "$(topdir)", /\A\./
342
+ LIBPATHFLAG
343
+ else
344
+ LIBPATHFLAG+RPATHFLAG
345
+ end % x.quote
346
+ }.join
347
+ end
348
+
349
+ def try_link0(src, opt="", &b)
350
+ try_do(src, link_command("", opt), &b)
351
+ end
352
+
353
+ def try_link(src, opt="", &b)
354
+ try_link0(src, opt, &b)
355
+ ensure
356
+ rm_f "conftest*", "c0x32*"
357
+ end
358
+
359
+ def try_compile(src, opt="", &b)
360
+ try_do(src, cc_command(opt), &b)
361
+ ensure
362
+ rm_f "conftest*"
363
+ end
364
+
365
+ def try_cpp(src, opt="", &b)
366
+ try_do(src, cpp_command(CPPOUTFILE, opt), &b)
367
+ ensure
368
+ rm_f "conftest*"
369
+ end
370
+
371
+ def cpp_include(header)
372
+ if header
373
+ header = [header] unless header.kind_of? Array
374
+ header.map {|h| "#include <#{h}>\n"}.join
375
+ else
376
+ ""
377
+ end
378
+ end
379
+
380
+ def with_cppflags(flags)
381
+ cppflags = $CPPFLAGS
382
+ $CPPFLAGS = flags
383
+ ret = yield
384
+ ensure
385
+ $CPPFLAGS = cppflags unless ret
386
+ end
387
+
388
+ def with_cflags(flags)
389
+ cflags = $CFLAGS
390
+ $CFLAGS = flags
391
+ ret = yield
392
+ ensure
393
+ $CFLAGS = cflags unless ret
394
+ end
395
+
396
+ def with_ldflags(flags)
397
+ ldflags = $LDFLAGS
398
+ $LDFLAGS = flags
399
+ ret = yield
400
+ ensure
401
+ $LDFLAGS = ldflags unless ret
402
+ end
403
+
404
+ def try_static_assert(expr, headers = nil, opt = "", &b)
405
+ headers = cpp_include(headers)
406
+ try_compile(<<SRC, opt, &b)
407
+ #{COMMON_HEADERS}
408
+ #{headers}
409
+ /*top*/
410
+ int conftest_const[(#{expr}) ? 1 : -1];
411
+ SRC
412
+ end
413
+
414
+ def try_constant(const, headers = nil, opt = "", &b)
415
+ includes = cpp_include(headers)
416
+ if CROSS_COMPILING
417
+ if try_static_assert("#{const} > 0", headers, opt)
418
+ # positive constant
419
+ elsif try_static_assert("#{const} < 0", headers, opt)
420
+ neg = true
421
+ const = "-(#{const})"
422
+ elsif try_static_assert("#{const} == 0", headers, opt)
423
+ return 0
424
+ else
425
+ # not a constant
426
+ return nil
427
+ end
428
+ upper = 1
429
+ lower = 0
430
+ until try_static_assert("#{const} <= #{upper}", headers, opt)
431
+ lower = upper
432
+ upper <<= 1
433
+ end
434
+ return nil unless lower
435
+ while upper > lower + 1
436
+ mid = (upper + lower) / 2
437
+ if try_static_assert("#{const} > #{mid}", headers, opt)
438
+ lower = mid
439
+ else
440
+ upper = mid
441
+ end
442
+ end
443
+ upper = -upper if neg
444
+ return upper
445
+ else
446
+ src = %{#{COMMON_HEADERS}
447
+ #{includes}
448
+ #include <stdio.h>
449
+ /*top*/
450
+ int conftest_const = (int)(#{const});
451
+ int main() {printf("%d\\n", conftest_const); return 0;}
452
+ }
453
+ if try_link0(src, opt, &b)
454
+ xpopen("./conftest") do |f|
455
+ return Integer(f.gets)
456
+ end
457
+ end
458
+ end
459
+ nil
460
+ end
461
+
462
+ def try_func(func, libs, headers = nil, &b)
463
+ headers = cpp_include(headers)
464
+ try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
465
+ #{COMMON_HEADERS}
466
+ #{headers}
467
+ /*top*/
468
+ int main() { return 0; }
469
+ int t() { void ((*volatile p)()); p = (void ((*)()))#{func}; return 0; }
470
+ SRC
471
+ #{headers}
472
+ /*top*/
473
+ int main() { return 0; }
474
+ int t() { #{func}(); return 0; }
475
+ SRC
476
+ end
477
+
478
+ def try_var(var, headers = nil, &b)
479
+ headers = cpp_include(headers)
480
+ try_compile(<<"SRC", &b)
481
+ #{COMMON_HEADERS}
482
+ #{headers}
483
+ /*top*/
484
+ int main() { return 0; }
485
+ int t() { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
486
+ SRC
487
+ end
488
+
489
+ def egrep_cpp(pat, src, opt = "", &b)
490
+ src = create_tmpsrc(src, &b)
491
+ xpopen(cpp_command('', opt)) do |f|
492
+ if Regexp === pat
493
+ puts(" ruby -ne 'print if #{pat.inspect}'")
494
+ f.grep(pat) {|l|
495
+ puts "#{f.lineno}: #{l}"
496
+ return true
497
+ }
498
+ false
499
+ else
500
+ puts(" egrep '#{pat}'")
501
+ begin
502
+ stdin = $stdin.dup
503
+ $stdin.reopen(f)
504
+ system("egrep", pat)
505
+ ensure
506
+ $stdin.reopen(stdin)
507
+ end
508
+ end
509
+ end
510
+ ensure
511
+ rm_f "conftest*"
512
+ log_src(src)
513
+ end
514
+
515
+ # This is used internally by the have_macro? method.
516
+ def macro_defined?(macro, src, opt = "", &b)
517
+ src = src.sub(/[^\n]\z/, "\\&\n")
518
+ try_compile(src + <<"SRC", opt, &b)
519
+ /*top*/
520
+ #ifndef #{macro}
521
+ # error
522
+ >>>>>> #{macro} undefined <<<<<<
523
+ #endif
524
+ SRC
525
+ end
526
+
527
+ def try_run(src, opt = "", &b)
528
+ if try_link0(src, opt, &b)
529
+ xsystem("./conftest")
530
+ else
531
+ nil
532
+ end
533
+ ensure
534
+ rm_f "conftest*"
535
+ end
536
+
537
+ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
538
+ ifiles or return
539
+ ifiles.empty? and return
540
+ srcprefix ||= '$(srcdir)'
541
+ Config::expand(srcdir = srcprefix.dup)
542
+ dirs = []
543
+ path = Hash.new {|h, i| h[i] = dirs.push([i])[-1]}
544
+ ifiles.each do |files, dir, prefix|
545
+ dir = map_dir(dir, map)
546
+ prefix &&= %r|\A#{Regexp.quote(prefix)}/?|
547
+ if /\A\.\// =~ files
548
+ # install files which are in current working directory.
549
+ files = files[2..-1]
550
+ len = nil
551
+ else
552
+ # install files which are under the $(srcdir).
553
+ files = File.join(srcdir, files)
554
+ len = srcdir.size
555
+ end
556
+ f = nil
557
+ Dir.glob(files) do |f|
558
+ f[0..len] = "" if len
559
+ case File.basename(f)
560
+ when *$NONINSTALLFILES
561
+ next
562
+ end
563
+ d = File.dirname(f)
564
+ d.sub!(prefix, "") if prefix
565
+ d = (d.empty? || d == ".") ? dir : File.join(dir, d)
566
+ f = File.join(srcprefix, f) if len
567
+ path[d] << f
568
+ end
569
+ unless len or f
570
+ d = File.dirname(files)
571
+ d.sub!(prefix, "") if prefix
572
+ d = (d.empty? || d == ".") ? dir : File.join(dir, d)
573
+ path[d] << files
574
+ end
575
+ end
576
+ dirs
577
+ end
578
+
579
+ def install_rb(mfile, dest, srcdir = nil)
580
+ install_files(mfile, [["lib/**/*.rb", dest, "lib"]], nil, srcdir)
581
+ end
582
+
583
+ def append_library(libs, lib) # :no-doc:
584
+ format(LIBARG, lib) + " " + libs
585
+ end
586
+
587
+ def message(*s)
588
+ unless Logging.quiet and not $VERBOSE
589
+ printf(*s)
590
+ $stdout.flush
591
+ end
592
+ end
593
+
594
+ # This emits a string to stdout that allows users to see the results of the
595
+ # various have* and find* methods as they are tested.
596
+ #
597
+ # Internal use only.
598
+ #
599
+ def checking_for(m, fmt = nil)
600
+ f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim
601
+ m = "checking #{/\Acheck/ =~ f ? '' : 'for '}#{m}... "
602
+ message "%s", m
603
+ a = r = nil
604
+ Logging::postpone do
605
+ r = yield
606
+ a = (fmt ? fmt % r : r ? "yes" : "no") << "\n"
607
+ "#{f}#{m}-------------------- #{a}\n"
608
+ end
609
+ message(a)
610
+ Logging::message "--------------------\n\n"
611
+ r
612
+ end
613
+
614
+ def checking_message(target, place = nil, opt = nil)
615
+ [["in", place], ["with", opt]].inject("#{target}") do |msg, (pre, noun)|
616
+ if noun
617
+ [[:to_str], [:join, ","], [:to_s]].each do |meth, *args|
618
+ if noun.respond_to?(meth)
619
+ break noun = noun.send(meth, *args)
620
+ end
621
+ end
622
+ msg << " #{pre} #{noun}" unless noun.empty?
623
+ end
624
+ msg
625
+ end
626
+ end
627
+
628
+ # :startdoc:
629
+
630
+ # Returns whether or not +macro+ is defined either in the common header
631
+ # files or within any +headers+ you provide.
632
+ #
633
+ # Any options you pass to +opt+ are passed along to the compiler.
634
+ #
635
+ def have_macro(macro, headers = nil, opt = "", &b)
636
+ checking_for checking_message(macro, headers, opt) do
637
+ macro_defined?(macro, cpp_include(headers), opt, &b)
638
+ end
639
+ end
640
+
641
+ # Returns whether or not the given entry point +func+ can be found within
642
+ # +lib+. If +func+ is nil, the 'main()' entry point is used by default.
643
+ # If found, it adds the library to list of libraries to be used when linking
644
+ # your extension.
645
+ #
646
+ # If +headers+ are provided, it will include those header files as the
647
+ # header files it looks in when searching for +func+.
648
+ #
649
+ # The real name of the library to be linked can be altered by
650
+ # '--with-FOOlib' configuration option.
651
+ #
652
+ def have_library(lib, func = nil, headers = nil, &b)
653
+ func = "main" if !func or func.empty?
654
+ lib = with_config(lib+'lib', lib)
655
+ checking_for checking_message("#{func}()", LIBARG%lib) do
656
+ if COMMON_LIBS.include?(lib)
657
+ true
658
+ else
659
+ libs = append_library($libs, lib)
660
+ if try_func(func, libs, headers, &b)
661
+ $libs = libs
662
+ true
663
+ else
664
+ false
665
+ end
666
+ end
667
+ end
668
+ end
669
+
670
+ # Returns whether or not the entry point +func+ can be found within the library
671
+ # +lib+ in one of the +paths+ specified, where +paths+ is an array of strings.
672
+ # If +func+ is nil , then the main() function is used as the entry point.
673
+ #
674
+ # If +lib+ is found, then the path it was found on is added to the list of
675
+ # library paths searched and linked against.
676
+ #
677
+ def find_library(lib, func, *paths, &b)
678
+ func = "main" if !func or func.empty?
679
+ lib = with_config(lib+'lib', lib)
680
+ paths = paths.collect {|path| path.split(File::PATH_SEPARATOR)}.flatten
681
+ checking_for "#{func}() in #{LIBARG%lib}" do
682
+ libpath = $LIBPATH
683
+ libs = append_library($libs, lib)
684
+ begin
685
+ until r = try_func(func, libs, &b) or paths.empty?
686
+ $LIBPATH = libpath | [paths.shift]
687
+ end
688
+ if r
689
+ $libs = libs
690
+ libpath = nil
691
+ end
692
+ ensure
693
+ $LIBPATH = libpath if libpath
694
+ end
695
+ r
696
+ end
697
+ end
698
+
699
+ # Returns whether or not the function +func+ can be found in the common
700
+ # header files, or within any +headers+ that you provide. If found, a
701
+ # macro is passed as a preprocessor constant to the compiler using the
702
+ # function name, in uppercase, prepended with 'HAVE_'.
703
+ #
704
+ # For example, if have_func('foo') returned true, then the HAVE_FOO
705
+ # preprocessor macro would be passed to the compiler.
706
+ #
707
+ def have_func(func, headers = nil, &b)
708
+ checking_for checking_message("#{func}()", headers) do
709
+ if try_func(func, $libs, headers, &b)
710
+ $defs.push(format("-DHAVE_%s", func.tr_cpp))
711
+ true
712
+ else
713
+ false
714
+ end
715
+ end
716
+ end
717
+
718
+ # Returns whether or not the variable +var+ can be found in the common
719
+ # header files, or within any +headers+ that you provide. If found, a
720
+ # macro is passed as a preprocessor constant to the compiler using the
721
+ # variable name, in uppercase, prepended with 'HAVE_'.
722
+ #
723
+ # For example, if have_var('foo') returned true, then the HAVE_FOO
724
+ # preprocessor macro would be passed to the compiler.
725
+ #
726
+ def have_var(var, headers = nil, &b)
727
+ checking_for checking_message(var, headers) do
728
+ if try_var(var, headers, &b)
729
+ $defs.push(format("-DHAVE_%s", var.tr_cpp))
730
+ true
731
+ else
732
+ false
733
+ end
734
+ end
735
+ end
736
+
737
+ # Returns whether or not the given +header+ file can be found on your system.
738
+ # If found, a macro is passed as a preprocessor constant to the compiler using
739
+ # the header file name, in uppercase, prepended with 'HAVE_'.
740
+ #
741
+ # For example, if have_header('foo.h') returned true, then the HAVE_FOO_H
742
+ # preprocessor macro would be passed to the compiler.
743
+ #
744
+ def have_header(header, &b)
745
+ checking_for header do
746
+ if try_cpp(cpp_include(header), &b)
747
+ $defs.push(format("-DHAVE_%s", header.tr("a-z./\055", "A-Z___")))
748
+ true
749
+ else
750
+ false
751
+ end
752
+ end
753
+ end
754
+
755
+ # Instructs mkmf to search for the given +header+ in any of the +paths+
756
+ # provided, and returns whether or not it was found in those paths.
757
+ #
758
+ # If the header is found then the path it was found on is added to the list
759
+ # of included directories that are sent to the compiler (via the -I switch).
760
+ #
761
+ def find_header(header, *paths)
762
+ message = checking_message(header, paths)
763
+ header = cpp_include(header)
764
+ checking_for message do
765
+ if try_cpp(header)
766
+ true
767
+ else
768
+ found = false
769
+ paths.each do |dir|
770
+ opt = "-I#{dir}".quote
771
+ if try_cpp(header, opt)
772
+ $INCFLAGS << " " << opt
773
+ found = true
774
+ break
775
+ end
776
+ end
777
+ found
778
+ end
779
+ end
780
+ end
781
+
782
+ # Returns whether or not the struct of type +type+ contains +member+. If
783
+ # it does not, or the struct type can't be found, then false is returned. You
784
+ # may optionally specify additional +headers+ in which to look for the struct
785
+ # (in addition to the common header files).
786
+ #
787
+ # If found, a macro is passed as a preprocessor constant to the compiler using
788
+ # the member name, in uppercase, prepended with 'HAVE_ST_'.
789
+ #
790
+ # For example, if have_struct_member('struct foo', 'bar') returned true, then the
791
+ # HAVE_ST_BAR preprocessor macro would be passed to the compiler.
792
+ #
793
+ def have_struct_member(type, member, headers = nil, &b)
794
+ checking_for checking_message("#{type}.#{member}", headers) do
795
+ if try_compile(<<"SRC", &b)
796
+ #{COMMON_HEADERS}
797
+ #{cpp_include(headers)}
798
+ /*top*/
799
+ int main() { return 0; }
800
+ int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
801
+ SRC
802
+ $defs.push(format("-DHAVE_ST_%s", member.tr_cpp))
803
+ true
804
+ else
805
+ false
806
+ end
807
+ end
808
+ end
809
+
810
+ def try_type(type, headers = nil, opt = "", &b)
811
+ if try_compile(<<"SRC", opt, &b)
812
+ #{COMMON_HEADERS}
813
+ #{cpp_include(headers)}
814
+ /*top*/
815
+ typedef #{type} conftest_type;
816
+ int conftestval[sizeof(conftest_type)?1:-1];
817
+ SRC
818
+ $defs.push(format("-DHAVE_TYPE_%s", type.tr_cpp))
819
+ true
820
+ else
821
+ false
822
+ end
823
+ end
824
+
825
+ # Returns whether or not the static type +type+ is defined. You may
826
+ # optionally pass additional +headers+ to check against in addition to the
827
+ # common header files.
828
+ #
829
+ # You may also pass additional flags to +opt+ which are then passed along to
830
+ # the compiler.
831
+ #
832
+ # If found, a macro is passed as a preprocessor constant to the compiler using
833
+ # the type name, in uppercase, prepended with 'HAVE_TYPE_'.
834
+ #
835
+ # For example, if have_type('foo') returned true, then the HAVE_TYPE_FOO
836
+ # preprocessor macro would be passed to the compiler.
837
+ #
838
+ def have_type(type, headers = nil, opt = "", &b)
839
+ checking_for checking_message(type, headers, opt) do
840
+ try_type(type, headers, opt, &b)
841
+ end
842
+ end
843
+
844
+ # Returns where the static type +type+ is defined.
845
+ #
846
+ # You may also pass additional flags to +opt+ which are then passed along to
847
+ # the compiler.
848
+ #
849
+ # See also +have_type+.
850
+ #
851
+ def find_type(type, opt, *headers, &b)
852
+ opt ||= ""
853
+ fmt = "not found"
854
+ def fmt.%(x)
855
+ x ? x.respond_to?(:join) ? x.join(",") : x : self
856
+ end
857
+ checking_for checking_message(type, nil, opt), fmt do
858
+ headers.find do |h|
859
+ try_type(type, h, opt, &b)
860
+ end
861
+ end
862
+ end
863
+
864
+ def try_const(const, headers = nil, opt = "", &b)
865
+ const, type = *const
866
+ if try_compile(<<"SRC", opt, &b)
867
+ #{COMMON_HEADERS}
868
+ #{cpp_include(headers)}
869
+ /*top*/
870
+ typedef #{type || 'int'} conftest_type;
871
+ conftest_type conftestval = #{type ? '' : '(int)'}#{const};
872
+ SRC
873
+ $defs.push(format("-DHAVE_CONST_%s", const.tr_cpp))
874
+ true
875
+ else
876
+ false
877
+ end
878
+ end
879
+
880
+ # Returns whether or not the constant +const+ is defined. You may
881
+ # optionally pass the +type+ of +const+ as <code>[const, type]</code>,
882
+ # like as:
883
+ #
884
+ # have_const(%w[PTHREAD_MUTEX_INITIALIZER pthread_mutex_t], "pthread.h")
885
+ #
886
+ # You may also pass additional +headers+ to check against in addition
887
+ # to the common header files, and additional flags to +opt+ which are
888
+ # then passed along to the compiler.
889
+ #
890
+ # If found, a macro is passed as a preprocessor constant to the compiler using
891
+ # the type name, in uppercase, prepended with 'HAVE_CONST_'.
892
+ #
893
+ # For example, if have_const('foo') returned true, then the HAVE_CONST_FOO
894
+ # preprocessor macro would be passed to the compiler.
895
+ #
896
+ def have_const(const, headers = nil, opt = "", &b)
897
+ checking_for checking_message([*const].compact.join(' '), headers, opt) do
898
+ try_const(const, headers, opt, &b)
899
+ end
900
+ end
901
+
902
+ # Returns the size of the given +type+. You may optionally specify additional
903
+ # +headers+ to search in for the +type+.
904
+ #
905
+ # If found, a macro is passed as a preprocessor constant to the compiler using
906
+ # the type name, in uppercase, prepended with 'SIZEOF_', followed by the type
907
+ # name, followed by '=X' where 'X' is the actual size.
908
+ #
909
+ # For example, if check_sizeof('mystruct') returned 12, then the
910
+ # SIZEOF_MYSTRUCT=12 preprocessor macro would be passed to the compiler.
911
+ #
912
+ def check_sizeof(type, headers = nil, &b)
913
+ expr = "sizeof(#{type})"
914
+ fmt = "%d"
915
+ def fmt.%(x)
916
+ x ? super : "failed"
917
+ end
918
+ checking_for checking_message("size of #{type}", headers), fmt do
919
+ if size = try_constant(expr, headers, &b)
920
+ $defs.push(format("-DSIZEOF_%s=%d", type.tr_cpp, size))
921
+ size
922
+ end
923
+ end
924
+ end
925
+
926
+ # :stopdoc:
927
+
928
+ # Used internally by the what_type? method to determine if +type+ is a scalar
929
+ # pointer.
930
+ def scalar_ptr_type?(type, member = nil, headers = nil, &b)
931
+ try_compile(<<"SRC", &b) # pointer
932
+ #{COMMON_HEADERS}
933
+ #{cpp_include(headers)}
934
+ /*top*/
935
+ volatile #{type} conftestval;
936
+ int main() { return 0; }
937
+ int t() {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));}
938
+ SRC
939
+ end
940
+
941
+ # Used internally by the what_type? method to determine if +type+ is a scalar
942
+ # pointer.
943
+ def scalar_type?(type, member = nil, headers = nil, &b)
944
+ try_compile(<<"SRC", &b) # pointer
945
+ #{COMMON_HEADERS}
946
+ #{cpp_include(headers)}
947
+ /*top*/
948
+ volatile #{type} conftestval;
949
+ int main() { return 0; }
950
+ int t() {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
951
+ SRC
952
+ end
953
+
954
+ def what_type?(type, member = nil, headers = nil, &b)
955
+ m = "#{type}"
956
+ name = type
957
+ if member
958
+ m << "." << member
959
+ name = "(((#{type} *)0)->#{member})"
960
+ end
961
+ fmt = "seems %s"
962
+ def fmt.%(x)
963
+ x ? super : "unknown"
964
+ end
965
+ checking_for checking_message(m, headers), fmt do
966
+ if scalar_ptr_type?(type, member, headers, &b)
967
+ if try_static_assert("sizeof(*#{name}) == 1", headers)
968
+ "string"
969
+ end
970
+ elsif scalar_type?(type, member, headers, &b)
971
+ if try_static_assert("sizeof(#{name}) > sizeof(long)", headers)
972
+ "long long"
973
+ elsif try_static_assert("sizeof(#{name}) > sizeof(int)", headers)
974
+ "long"
975
+ elsif try_static_assert("sizeof(#{name}) > sizeof(short)", headers)
976
+ "int"
977
+ elsif try_static_assert("sizeof(#{name}) > 1", headers)
978
+ "short"
979
+ else
980
+ "char"
981
+ end
982
+ end
983
+ end
984
+ end
985
+
986
+ # This method is used internally by the find_executable method.
987
+ #
988
+ # Internal use only.
989
+ #
990
+ def find_executable0(bin, path = nil)
991
+ ext = config_string('EXEEXT')
992
+ if File.expand_path(bin) == bin
993
+ return bin if File.executable?(bin)
994
+ ext and File.executable?(file = bin + ext) and return file
995
+ return nil
996
+ end
997
+ if path ||= ENV['PATH']
998
+ path = path.split(File::PATH_SEPARATOR)
999
+ else
1000
+ path = %w[/usr/local/bin /usr/ucb /usr/bin /bin]
1001
+ end
1002
+ file = nil
1003
+ path.each do |dir|
1004
+ return file if File.executable?(file = File.join(dir, bin))
1005
+ return file if ext and File.executable?(file << ext)
1006
+ end
1007
+ nil
1008
+ end
1009
+
1010
+ # :startdoc:
1011
+
1012
+ # Searches for the executable +bin+ on +path+. The default path is your
1013
+ # PATH environment variable. If that isn't defined, it will resort to
1014
+ # searching /usr/local/bin, /usr/ucb, /usr/bin and /bin.
1015
+ #
1016
+ # If found, it will return the full path, including the executable name,
1017
+ # of where it was found.
1018
+ #
1019
+ # Note that this method does not actually affect the generated Makefile.
1020
+ #
1021
+ def find_executable(bin, path = nil)
1022
+ checking_for checking_message(bin, path) do
1023
+ find_executable0(bin, path)
1024
+ end
1025
+ end
1026
+
1027
+ # :stopdoc:
1028
+
1029
+ def arg_config(config, *defaults, &block)
1030
+ $arg_config << [config, *defaults]
1031
+ defaults << nil if !block and defaults.empty?
1032
+ $configure_args.fetch(config.tr('_', '-'), *defaults, &block)
1033
+ end
1034
+
1035
+ # :startdoc:
1036
+
1037
+ # Tests for the presence of a --with-<tt>config</tt> or --without-<tt>config</tt>
1038
+ # option. Returns true if the with option is given, false if the without
1039
+ # option is given, and the default value otherwise.
1040
+ #
1041
+ # This can be useful for adding custom definitions, such as debug information.
1042
+ #
1043
+ # Example:
1044
+ #
1045
+ # if with_config("debug")
1046
+ # $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
1047
+ # end
1048
+ #
1049
+ def with_config(config, *defaults)
1050
+ config = config.sub(/^--with[-_]/, '')
1051
+ val = arg_config("--with-"+config) do
1052
+ if arg_config("--without-"+config)
1053
+ false
1054
+ elsif block_given?
1055
+ yield(config, *defaults)
1056
+ else
1057
+ break *defaults
1058
+ end
1059
+ end
1060
+ case val
1061
+ when "yes"
1062
+ true
1063
+ when "no"
1064
+ false
1065
+ else
1066
+ val
1067
+ end
1068
+ end
1069
+
1070
+ # Tests for the presence of an --enable-<tt>config</tt> or
1071
+ # --disable-<tt>config</tt> option. Returns true if the enable option is given,
1072
+ # false if the disable option is given, and the default value otherwise.
1073
+ #
1074
+ # This can be useful for adding custom definitions, such as debug information.
1075
+ #
1076
+ # Example:
1077
+ #
1078
+ # if enable_config("debug")
1079
+ # $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
1080
+ # end
1081
+ #
1082
+ def enable_config(config, *defaults)
1083
+ if arg_config("--enable-"+config)
1084
+ true
1085
+ elsif arg_config("--disable-"+config)
1086
+ false
1087
+ elsif block_given?
1088
+ yield(config, *defaults)
1089
+ else
1090
+ return *defaults
1091
+ end
1092
+ end
1093
+
1094
+ # Generates a header file consisting of the various macro definitions generated
1095
+ # by other methods such as have_func and have_header. These are then wrapped in
1096
+ # a custom #ifndef based on the +header+ file name, which defaults to
1097
+ # 'extconf.h'.
1098
+ #
1099
+ # For example:
1100
+ #
1101
+ # # extconf.rb
1102
+ # require 'mkmf'
1103
+ # have_func('realpath')
1104
+ # have_header('sys/utime.h')
1105
+ # create_header
1106
+ # create_makefile('foo')
1107
+ #
1108
+ # The above script would generate the following extconf.h file:
1109
+ #
1110
+ # #ifndef EXTCONF_H
1111
+ # #define EXTCONF_H
1112
+ # #define HAVE_REALPATH 1
1113
+ # #define HAVE_SYS_UTIME_H 1
1114
+ # #endif
1115
+ #
1116
+ # Given that the create_header method generates a file based on definitions
1117
+ # set earlier in your extconf.rb file, you will probably want to make this
1118
+ # one of the last methods you call in your script.
1119
+ #
1120
+ def create_header(header = "extconf.h")
1121
+ message "creating %s\n", header
1122
+ sym = header.tr("a-z./\055", "A-Z___")
1123
+ hdr = ["#ifndef #{sym}\n#define #{sym}\n"]
1124
+ for line in $defs
1125
+ case line
1126
+ when /^-D([^=]+)(?:=(.*))?/
1127
+ hdr << "#define #$1 #{$2 ? Shellwords.shellwords($2)[0] : 1}\n"
1128
+ when /^-U(.*)/
1129
+ hdr << "#undef #$1\n"
1130
+ end
1131
+ end
1132
+ hdr << "#endif\n"
1133
+ hdr = hdr.join
1134
+ unless (IO.read(header) == hdr rescue false)
1135
+ open(header, "w") do |hfile|
1136
+ hfile.write(hdr)
1137
+ end
1138
+ end
1139
+ $extconf_h = header
1140
+ end
1141
+
1142
+ # Sets a +target+ name that the user can then use to configure various 'with'
1143
+ # options with on the command line by using that name. For example, if the
1144
+ # target is set to "foo", then the user could use the --with-foo-dir command
1145
+ # line option.
1146
+ #
1147
+ # You may pass along additional 'include' or 'lib' defaults via the +idefault+
1148
+ # and +ldefault+ parameters, respectively.
1149
+ #
1150
+ # Note that dir_config only adds to the list of places to search for libraries
1151
+ # and include files. It does not link the libraries into your application.
1152
+ #
1153
+ def dir_config(target, idefault=nil, ldefault=nil)
1154
+ if dir = with_config(target + "-dir", (idefault unless ldefault))
1155
+ defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)
1156
+ idefault = ldefault = nil
1157
+ end
1158
+
1159
+ idir = with_config(target + "-include", idefault)
1160
+ $arg_config.last[1] ||= "${#{target}-dir}/include"
1161
+ ldir = with_config(target + "-lib", ldefault)
1162
+ $arg_config.last[1] ||= "${#{target}-dir}/lib"
1163
+
1164
+ idirs = idir ? Array === idir ? idir : idir.split(File::PATH_SEPARATOR) : []
1165
+ if defaults
1166
+ idirs.concat(defaults.collect {|dir| dir + "/include"})
1167
+ idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR)
1168
+ end
1169
+ unless idirs.empty?
1170
+ idirs.collect! {|dir| "-I" + dir}
1171
+ idirs -= Shellwords.shellwords($CPPFLAGS)
1172
+ unless idirs.empty?
1173
+ $CPPFLAGS = (idirs.quote << $CPPFLAGS).join(" ")
1174
+ end
1175
+ end
1176
+
1177
+ ldirs = ldir ? Array === ldir ? ldir : ldir.split(File::PATH_SEPARATOR) : []
1178
+ if defaults
1179
+ ldirs.concat(defaults.collect {|dir| dir + "/lib"})
1180
+ ldir = ([ldir] + ldirs).compact.join(File::PATH_SEPARATOR)
1181
+ end
1182
+ $LIBPATH = ldirs | $LIBPATH
1183
+
1184
+ [idir, ldir]
1185
+ end
1186
+
1187
+ # :stopdoc:
1188
+
1189
+ # Handles meta information about installed libraries. Uses your platform's
1190
+ # pkg-config program if it has one.
1191
+ def pkg_config(pkg)
1192
+ if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
1193
+ # iff package specific config command is given
1194
+ get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
1195
+ elsif ($PKGCONFIG ||=
1196
+ (pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
1197
+ find_executable0(pkgconfig) && pkgconfig) and
1198
+ system("#{$PKGCONFIG} --exists #{pkg}")
1199
+ # default to pkg-config command
1200
+ get = proc {|opt| `#{$PKGCONFIG} --#{opt} #{pkg}`.chomp}
1201
+ elsif find_executable0(pkgconfig = "#{pkg}-config")
1202
+ # default to package specific config command, as a last resort.
1203
+ get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
1204
+ end
1205
+ if get
1206
+ cflags = get['cflags']
1207
+ ldflags = get['libs']
1208
+ libs = get['libs-only-l']
1209
+ ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
1210
+ $CFLAGS += " " << cflags
1211
+ $LDFLAGS += " " << ldflags
1212
+ $libs += " " << libs
1213
+ Logging::message "package configuration for %s\n", pkg
1214
+ Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
1215
+ cflags, ldflags, libs
1216
+ [cflags, ldflags, libs]
1217
+ else
1218
+ Logging::message "package configuration for %s is not found\n", pkg
1219
+ nil
1220
+ end
1221
+ end
1222
+
1223
+ def with_destdir(dir)
1224
+ dir = dir.sub($dest_prefix_pattern, '')
1225
+ /\A\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
1226
+ end
1227
+
1228
+ # Converts forward slashes to backslashes. Aimed at MS Windows.
1229
+ #
1230
+ # Internal use only.
1231
+ #
1232
+ def winsep(s)
1233
+ s.tr('/', '\\')
1234
+ end
1235
+
1236
+ def configuration(srcdir)
1237
+ mk = []
1238
+ vpath = %w[$(srcdir) $(topdir) $(hdrdir)]
1239
+ if !CROSS_COMPILING
1240
+ case CONFIG['build_os']
1241
+ when 'cygwin'
1242
+ if CONFIG['target_os'] != 'cygwin'
1243
+ vpath.each {|p| p.sub!(/.*/, '$(shell cygpath -u \&)')}
1244
+ end
1245
+ when 'msdosdjgpp', 'mingw32'
1246
+ CONFIG['PATH_SEPARATOR'] = ';'
1247
+ end
1248
+ end
1249
+ mk << %{
1250
+ SHELL = /bin/sh
1251
+
1252
+ #### Start of system configuration section. ####
1253
+ #{
1254
+ if $extmk
1255
+ "top_srcdir = " + $top_srcdir.sub(%r"\A#{Regexp.quote($topdir)}/", "$(topdir)/")
1256
+ end
1257
+ }
1258
+ srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {CONFIG[$1||$2]}.quote}
1259
+ topdir = #{($extmk ? CONFIG["topdir"] : $topdir).quote}
1260
+ hdrdir = #{$extmk ? CONFIG["hdrdir"].quote : '$(topdir)'}
1261
+ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
1262
+ }
1263
+ if $extmk
1264
+ mk << "RUBYLIB = -\nRUBYOPT = -rpurelib.rb\n"
1265
+ end
1266
+ if destdir = CONFIG["prefix"][$dest_prefix_pattern, 1]
1267
+ mk << "\nDESTDIR = #{destdir}\n"
1268
+ end
1269
+ CONFIG.each do |key, var|
1270
+ next unless /prefix$/ =~ key
1271
+ mk << "#{key} = #{with_destdir(var)}\n"
1272
+ end
1273
+ CONFIG.each do |key, var|
1274
+ next if /^abs_/ =~ key
1275
+ next unless /^(?:src|top|hdr|(.*))dir$/ =~ key and $1
1276
+ mk << "#{key} = #{with_destdir(var)}\n"
1277
+ end
1278
+ if !$extmk and !$configure_args.has_key?('--ruby') and
1279
+ sep = config_string('BUILD_FILE_SEPARATOR')
1280
+ sep = ":/=#{sep}"
1281
+ else
1282
+ sep = ""
1283
+ end
1284
+ extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : $defs.join(" ")<<" "
1285
+ mk << %{
1286
+ CC = #{CONFIG['CC']}
1287
+ LIBRUBY = #{CONFIG['LIBRUBY']}
1288
+ LIBRUBY_A = #{CONFIG['LIBRUBY_A']}
1289
+ LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED
1290
+ LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC
1291
+
1292
+ RUBY_EXTCONF_H = #{$extconf_h}
1293
+ CFLAGS = #{$static ? '' : CONFIG['CCDLFLAGS']} #$CFLAGS #$ARCH_FLAG
1294
+ INCFLAGS = -I. #$INCFLAGS
1295
+ DEFS = #{CONFIG['DEFS']}
1296
+ CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
1297
+ CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
1298
+ ldflags = #{$LDFLAGS}
1299
+ dldflags = #{$DLDFLAGS}
1300
+ archflag = #{$ARCH_FLAG}
1301
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
1302
+ LDSHARED = #{CONFIG['LDSHARED']}
1303
+ AR = #{CONFIG['AR']}
1304
+ EXEEXT = #{CONFIG['EXEEXT']}
1305
+
1306
+ RUBY_INSTALL_NAME = #{CONFIG['RUBY_INSTALL_NAME']}
1307
+ RUBY_SO_NAME = #{CONFIG['RUBY_SO_NAME']}
1308
+ arch = #{CONFIG['arch']}
1309
+ sitearch = #{CONFIG['sitearch']}
1310
+ ruby_version = #{Config::CONFIG['ruby_version']}
1311
+ ruby = #{$ruby}
1312
+ RUBY = $(ruby#{sep})
1313
+ RM = #{config_string('RM') || '$(RUBY) -run -e rm -- -f'}
1314
+ MAKEDIRS = #{config_string('MAKEDIRS') || '@$(RUBY) -run -e mkdir -- -p'}
1315
+ INSTALL = #{config_string('INSTALL') || '@$(RUBY) -run -e install -- -vp'}
1316
+ INSTALL_PROG = #{config_string('INSTALL_PROG') || '$(INSTALL) -m 0755'}
1317
+ INSTALL_DATA = #{config_string('INSTALL_DATA') || '$(INSTALL) -m 0644'}
1318
+ COPY = #{config_string('CP') || '@$(RUBY) -run -e cp -- -v'}
1319
+
1320
+ #### End of system configuration section. ####
1321
+
1322
+ preload = #{$preload ? $preload.join(' ') : ''}
1323
+ }
1324
+ if $nmake == ?b
1325
+ mk.each do |x|
1326
+ x.gsub!(/^(MAKEDIRS|INSTALL_(?:PROG|DATA))+\s*=.*\n/) do
1327
+ "!ifndef " + $1 + "\n" +
1328
+ $& +
1329
+ "!endif\n"
1330
+ end
1331
+ end
1332
+ end
1333
+ mk
1334
+ end
1335
+
1336
+ def dummy_makefile(srcdir)
1337
+ configuration(srcdir) << <<RULES << CLEANINGS
1338
+ CLEANFILES = #{$cleanfiles.join(' ')}
1339
+ DISTCLEANFILES = #{$distcleanfiles.join(' ')}
1340
+
1341
+ all install static install-so install-rb: Makefile
1342
+
1343
+ RULES
1344
+ end
1345
+ # :startdoc:
1346
+
1347
+ # Generates the Makefile for your extension, passing along any options and
1348
+ # preprocessor constants that you may have generated through other methods.
1349
+ #
1350
+ # The +target+ name should correspond the name of the global function name
1351
+ # defined within your C extension, minus the 'Init_'. For example, if your
1352
+ # C extension is defined as 'Init_foo', then your target would simply be 'foo'.
1353
+ #
1354
+ # If any '/' characters are present in the target name, only the last name
1355
+ # is interpreted as the target name, and the rest are considered toplevel
1356
+ # directory names, and the generated Makefile will be altered accordingly to
1357
+ # follow that directory structure.
1358
+ #
1359
+ # For example, if you pass 'test/foo' as a target name, your extension will
1360
+ # be installed under the 'test' directory. This means that in order to
1361
+ # load the file within a Ruby program later, that directory structure will
1362
+ # have to be followed, e.g. "require 'test/foo'".
1363
+ #
1364
+ # The +srcprefix+ should be used when your source files are not in the same
1365
+ # directory as your build script. This will not only eliminate the need for
1366
+ # you to manually copy the source files into the same directory as your build
1367
+ # script, but it also sets the proper +target_prefix+ in the generated
1368
+ # Makefile.
1369
+ #
1370
+ # Setting the +target_prefix+ will, in turn, install the generated binary in
1371
+ # a directory under your Config::CONFIG['sitearchdir'] that mimics your local
1372
+ # filesystem when you run 'make install'.
1373
+ #
1374
+ # For example, given the following file tree:
1375
+ #
1376
+ # ext/
1377
+ # extconf.rb
1378
+ # test/
1379
+ # foo.c
1380
+ #
1381
+ # And given the following code:
1382
+ #
1383
+ # create_makefile('test/foo', 'test')
1384
+ #
1385
+ # That will set the +target_prefix+ in the generated Makefile to 'test'. That,
1386
+ # in turn, will create the following file tree when installed via the
1387
+ # 'make install' command:
1388
+ #
1389
+ # /path/to/ruby/sitearchdir/test/foo.so
1390
+ #
1391
+ # It is recommended that you use this approach to generate your makefiles,
1392
+ # instead of copying files around manually, because some third party
1393
+ # libraries may depend on the +target_prefix+ being set properly.
1394
+ #
1395
+ # The +srcprefix+ argument can be used to override the default source
1396
+ # directory, i.e. the current directory . It is included as part of the VPATH
1397
+ # and added to the list of INCFLAGS.
1398
+ #
1399
+ def create_makefile(target, srcprefix = nil)
1400
+ $target = target
1401
+ libpath = $DEFLIBPATH|$LIBPATH
1402
+ message "creating Makefile\n"
1403
+ rm_f "conftest*"
1404
+ if CONFIG["DLEXT"] == $OBJEXT
1405
+ for lib in libs = $libs.split
1406
+ lib.sub!(/-l(.*)/, %%"lib\\1.#{$LIBEXT}"%)
1407
+ end
1408
+ $defs.push(format("-DEXTLIB='%s'", libs.join(",")))
1409
+ end
1410
+
1411
+ if target.include?('/')
1412
+ target_prefix, target = File.split(target)
1413
+ target_prefix[0,0] = '/'
1414
+ else
1415
+ target_prefix = ""
1416
+ end
1417
+
1418
+ srcprefix ||= '$(srcdir)'
1419
+ Config::expand(srcdir = srcprefix.dup)
1420
+
1421
+ if not $objs
1422
+ $objs = []
1423
+ srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
1424
+ for f in srcs
1425
+ obj = File.basename(f, ".*") << ".o"
1426
+ $objs.push(obj) unless $objs.index(obj)
1427
+ end
1428
+ elsif !(srcs = $srcs)
1429
+ srcs = $objs.collect {|obj| obj.sub(/\.o\z/, '.c')}
1430
+ end
1431
+ $srcs = srcs
1432
+ for i in $objs
1433
+ i.sub!(/\.o\z/, ".#{$OBJEXT}")
1434
+ end
1435
+ $objs = $objs.join(" ")
1436
+
1437
+ target = nil if $objs == ""
1438
+
1439
+ if target and EXPORT_PREFIX
1440
+ if File.exist?(File.join(srcdir, target + '.def'))
1441
+ deffile = "$(srcdir)/$(TARGET).def"
1442
+ unless EXPORT_PREFIX.empty?
1443
+ makedef = %{-pe "sub!(/^(?=\\w)/,'#{EXPORT_PREFIX}') unless 1../^EXPORTS$/i"}
1444
+ end
1445
+ else
1446
+ makedef = %{-e "puts 'EXPORTS', '#{EXPORT_PREFIX}Init_$(TARGET)'"}
1447
+ end
1448
+ if makedef
1449
+ $distcleanfiles << '$(DEFFILE)'
1450
+ origdef = deffile
1451
+ deffile = "$(TARGET)-$(arch).def"
1452
+ end
1453
+ end
1454
+ origdef ||= ''
1455
+
1456
+ libpath = libpathflag(libpath)
1457
+
1458
+ dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
1459
+ staticlib = target ? "$(TARGET).#$LIBEXT" : ""
1460
+ mfile = open("Makefile", "wb")
1461
+ mfile.print configuration(srcprefix)
1462
+ mfile.print "
1463
+ libpath = #{($DEFLIBPATH|$LIBPATH).join(" ")}
1464
+ LIBPATH = #{libpath}
1465
+ DEFFILE = #{deffile}
1466
+
1467
+ CLEANFILES = #{$cleanfiles.join(' ')}
1468
+ DISTCLEANFILES = #{$distcleanfiles.join(' ')}
1469
+
1470
+ extout = #{$extout}
1471
+ extout_prefix = #{$extout_prefix}
1472
+ target_prefix = #{target_prefix}
1473
+ LOCAL_LIBS = #{$LOCAL_LIBS}
1474
+ LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
1475
+ SRCS = #{srcs.collect(&File.method(:basename)).join(' ')}
1476
+ OBJS = #{$objs}
1477
+ TARGET = #{target}
1478
+ DLLIB = #{dllib}
1479
+ EXTSTATIC = #{$static || ""}
1480
+ STATIC_LIB = #{staticlib unless $static.nil?}
1481
+ #{!$extout && defined?($installed_list) ? "INSTALLED_LIST = #{$installed_list}\n" : ""}
1482
+ "
1483
+ install_dirs.each {|d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
1484
+ n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET).'
1485
+ mfile.print "
1486
+ TARGET_SO = #{($extout ? '$(RUBYARCHDIR)/' : '')}$(DLLIB)
1487
+ CLEANLIBS = #{n}#{CONFIG['DLEXT']} #{n}il? #{n}tds #{n}map
1488
+ CLEANOBJS = *.#{$OBJEXT} *.#{$LIBEXT} *.s[ol] *.pdb *.exp *.bak
1489
+
1490
+ all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
1491
+ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
1492
+ "
1493
+ mfile.print CLEANINGS
1494
+ dirs = []
1495
+ mfile.print "install: install-so install-rb\n\n"
1496
+ sodir = (dir = "$(RUBYARCHDIR)").dup
1497
+ mfile.print("install-so: ")
1498
+ if target
1499
+ f = "$(DLLIB)"
1500
+ dest = "#{dir}/#{f}"
1501
+ mfile.puts dir, "install-so: #{dest}"
1502
+ unless $extout
1503
+ mfile.print "#{dest}: #{f}\n"
1504
+ if (sep = config_string('BUILD_FILE_SEPARATOR'))
1505
+ f.gsub!("/", sep)
1506
+ dir.gsub!("/", sep)
1507
+ sep = ":/="+sep
1508
+ f.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
1509
+ f.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
1510
+ dir.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
1511
+ dir.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
1512
+ end
1513
+ mfile.print "\t$(INSTALL_PROG) #{f} #{dir}\n"
1514
+ if defined?($installed_list)
1515
+ mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
1516
+ end
1517
+ end
1518
+ else
1519
+ mfile.puts "Makefile"
1520
+ end
1521
+ mfile.print("install-rb: pre-install-rb install-rb-default\n")
1522
+ mfile.print("install-rb-default: pre-install-rb-default\n")
1523
+ mfile.print("pre-install-rb: Makefile\n")
1524
+ mfile.print("pre-install-rb-default: Makefile\n")
1525
+ for sfx, i in [["-default", [["lib/**/*.rb", "$(RUBYLIBDIR)", "lib"]]], ["", $INSTALLFILES]]
1526
+ files = install_files(mfile, i, nil, srcprefix) or next
1527
+ for dir, *files in files
1528
+ unless dirs.include?(dir)
1529
+ dirs << dir
1530
+ mfile.print "pre-install-rb#{sfx}: #{dir}\n"
1531
+ end
1532
+ files.each do |f|
1533
+ dest = "#{dir}/#{File.basename(f)}"
1534
+ mfile.print("install-rb#{sfx}: #{dest}\n")
1535
+ mfile.print("#{dest}: #{f} #{dir}\n\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ")
1536
+ sep = config_string('BUILD_FILE_SEPARATOR')
1537
+ if sep
1538
+ f = f.gsub("/", sep)
1539
+ sep = ":/="+sep
1540
+ f = f.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
1541
+ f = f.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
1542
+ else
1543
+ sep = ""
1544
+ end
1545
+ mfile.print("#{f} $(@D#{sep})\n")
1546
+ if defined?($installed_list) and !$extout
1547
+ mfile.print("\t@echo #{dest}>>$(INSTALLED_LIST)\n")
1548
+ end
1549
+ end
1550
+ end
1551
+ end
1552
+ dirs.unshift(sodir) if target and !dirs.include?(sodir)
1553
+ dirs.each {|dir| mfile.print "#{dir}:\n\t$(MAKEDIRS) $@\n"}
1554
+
1555
+ mfile.print <<-SITEINSTALL
1556
+
1557
+ site-install: site-install-so site-install-rb
1558
+ site-install-so: install-so
1559
+ site-install-rb: install-rb
1560
+
1561
+ SITEINSTALL
1562
+
1563
+ return unless target
1564
+
1565
+ mfile.puts SRC_EXT.collect {|ext| ".path.#{ext} = $(VPATH)"} if $nmake == ?b
1566
+ mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
1567
+ mfile.print "\n"
1568
+
1569
+ CXX_EXT.each do |ext|
1570
+ COMPILE_RULES.each do |rule|
1571
+ mfile.printf(rule, ext, $OBJEXT)
1572
+ mfile.printf("\n\t%s\n\n", COMPILE_CXX)
1573
+ end
1574
+ end
1575
+ %w[c].each do |ext|
1576
+ COMPILE_RULES.each do |rule|
1577
+ mfile.printf(rule, ext, $OBJEXT)
1578
+ mfile.printf("\n\t%s\n\n", COMPILE_C)
1579
+ end
1580
+ end
1581
+
1582
+ mfile.print "$(RUBYARCHDIR)/" if $extout
1583
+ mfile.print "$(DLLIB): ", (makedef ? "$(DEFFILE) " : ""), "$(OBJS)\n"
1584
+ mfile.print "\t@-$(RM) $@\n"
1585
+ mfile.print "\t@-$(MAKEDIRS) $(@D)\n" if $extout
1586
+ link_so = LINK_SO.gsub(/^/, "\t")
1587
+ mfile.print link_so, "\n\n"
1588
+ unless $static.nil?
1589
+ mfile.print "$(STATIC_LIB): $(OBJS)\n\t"
1590
+ mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)"
1591
+ config_string('RANLIB') do |ranlib|
1592
+ mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true"
1593
+ end
1594
+ end
1595
+ mfile.print "\n\n"
1596
+ if makedef
1597
+ mfile.print "$(DEFFILE): #{origdef}\n"
1598
+ mfile.print "\t$(RUBY) #{makedef} #{origdef} > $@\n\n"
1599
+ end
1600
+
1601
+ depend = File.join(srcdir, "depend")
1602
+ if File.exist?(depend)
1603
+ suffixes = []
1604
+ depout = []
1605
+ open(depend, "r") do |dfile|
1606
+ mfile.printf "###\n"
1607
+ cont = implicit = nil
1608
+ impconv = proc do
1609
+ COMPILE_RULES.each {|rule| depout << (rule % implicit[0]) << implicit[1]}
1610
+ implicit = nil
1611
+ end
1612
+ ruleconv = proc do |line|
1613
+ if implicit
1614
+ if /\A\t/ =~ line
1615
+ implicit[1] << line
1616
+ next
1617
+ else
1618
+ impconv[]
1619
+ end
1620
+ end
1621
+ if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
1622
+ suffixes << m[1] << m[2]
1623
+ implicit = [[m[1], m[2]], [m.post_match]]
1624
+ next
1625
+ elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
1626
+ line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
1627
+ end
1628
+ depout << line
1629
+ end
1630
+ while line = dfile.gets()
1631
+ line.gsub!(/\.o\b/, ".#{$OBJEXT}")
1632
+ line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h) if $config_h
1633
+ if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
1634
+ (cont ||= []) << line
1635
+ next
1636
+ elsif cont
1637
+ line = (cont << line).join
1638
+ cont = nil
1639
+ end
1640
+ ruleconv.call(line)
1641
+ end
1642
+ if cont
1643
+ ruleconv.call(cont.join)
1644
+ elsif implicit
1645
+ impconv.call
1646
+ end
1647
+ end
1648
+ unless suffixes.empty?
1649
+ mfile.print ".SUFFIXES: .", suffixes.uniq.join(" ."), "\n\n"
1650
+ end
1651
+ mfile.print "$(OBJS): $(RUBY_EXTCONF_H)\n\n" if $extconf_h
1652
+ mfile.print depout
1653
+ else
1654
+ headers = %w[ruby.h defines.h]
1655
+ if RULE_SUBST
1656
+ headers.each {|h| h.sub!(/.*/) {|*m| RULE_SUBST % m}}
1657
+ end
1658
+ headers << $config_h if $config_h
1659
+ headers << "$(RUBY_EXTCONF_H)" if $extconf_h
1660
+ mfile.print "$(OBJS): ", headers.join(' '), "\n"
1661
+ end
1662
+
1663
+ $makefile_created = true
1664
+ ensure
1665
+ mfile.close if mfile
1666
+ end
1667
+
1668
+ # :stopdoc:
1669
+
1670
+ def init_mkmf(config = CONFIG)
1671
+ $makefile_created = false
1672
+ $arg_config = []
1673
+ $enable_shared = config['ENABLE_SHARED'] == 'yes'
1674
+ $defs = []
1675
+ $extconf_h = nil
1676
+ $CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup
1677
+ $ARCH_FLAG = with_config("arch_flag", arg_config("ARCH_FLAG", config["ARCH_FLAG"])).dup
1678
+ $CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup
1679
+ $LDFLAGS = with_config("ldflags", arg_config("LDFLAGS", config["LDFLAGS"])).dup
1680
+ $INCFLAGS = "-I$(topdir) -I$(hdrdir) -I$(srcdir)"
1681
+ $DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
1682
+ $LIBEXT = config['LIBEXT'].dup
1683
+ $OBJEXT = config["OBJEXT"].dup
1684
+ $LIBS = "#{config['LIBS']} #{config['DLDLIBS']}"
1685
+ $LIBRUBYARG = ""
1686
+ $LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
1687
+ $LIBRUBYARG_SHARED = config['LIBRUBYARG_SHARED']
1688
+ $DEFLIBPATH = $extmk ? ["$(topdir)"] : CROSS_COMPILING ? [] : ["$(libdir)"]
1689
+ $DEFLIBPATH.unshift(".")
1690
+ $LIBPATH = []
1691
+ $INSTALLFILES = []
1692
+ $NONINSTALLFILES = [/~\z/, /\A#.*#\z/, /\A\.#/, /\.bak\z/i, /\.orig\z/, /\.rej\z/, /\.l[ao]\z/, /\.o\z/]
1693
+
1694
+ $objs = nil
1695
+ $srcs = nil
1696
+ $libs = ""
1697
+ if $enable_shared or Config.expand(config["LIBRUBY"].dup) != Config.expand(config["LIBRUBY_A"].dup)
1698
+ $LIBRUBYARG = config['LIBRUBYARG']
1699
+ end
1700
+
1701
+ $LOCAL_LIBS = ""
1702
+
1703
+ $cleanfiles = config_string('CLEANFILES') {|s| Shellwords.shellwords(s)} || []
1704
+ $cleanfiles << "mkmf.log"
1705
+ $distcleanfiles = config_string('DISTCLEANFILES') {|s| Shellwords.shellwords(s)} || []
1706
+
1707
+ $extout ||= nil
1708
+ $extout_prefix ||= nil
1709
+
1710
+ $arg_config.clear
1711
+ dir_config("opt")
1712
+ end
1713
+
1714
+ FailedMessage = <<MESSAGE
1715
+ Could not create Makefile due to some reason, probably lack of
1716
+ necessary libraries and/or headers. Check the mkmf.log file for more
1717
+ details. You may need configuration options.
1718
+
1719
+ Provided configuration options:
1720
+ MESSAGE
1721
+
1722
+ # Returns whether or not the Makefile was successfully generated. If not,
1723
+ # the script will abort with an error message.
1724
+ #
1725
+ # Internal use only.
1726
+ #
1727
+ def mkmf_failed(path)
1728
+ unless $makefile_created or File.exist?("Makefile")
1729
+ opts = $arg_config.collect {|t, n| "\t#{t}#{n ? "=#{n}" : ""}\n"}
1730
+ abort "*** #{path} failed ***\n" + FailedMessage + opts.join
1731
+ end
1732
+ end
1733
+
1734
+ # :startdoc:
1735
+
1736
+ init_mkmf
1737
+
1738
+ $make = with_config("make-prog", ENV["MAKE"] || "make")
1739
+ make, = Shellwords.shellwords($make)
1740
+ $nmake = nil
1741
+ case
1742
+ when $mswin
1743
+ $nmake = ?m if /nmake/i =~ make
1744
+ when $bccwin
1745
+ $nmake = ?b if /Borland/i =~ `#{make} -h`
1746
+ end
1747
+
1748
+ Config::CONFIG["srcdir"] = CONFIG["srcdir"] =
1749
+ $srcdir = arg_config("--srcdir", File.dirname($0))
1750
+ $configure_args["--topsrcdir"] ||= $srcdir
1751
+ if $curdir = arg_config("--curdir")
1752
+ Config.expand(curdir = $curdir.dup)
1753
+ else
1754
+ curdir = $curdir = "."
1755
+ end
1756
+ unless File.expand_path(Config::CONFIG["topdir"]) == File.expand_path(curdir)
1757
+ CONFIG["topdir"] = $curdir
1758
+ Config::CONFIG["topdir"] = curdir
1759
+ end
1760
+ $configure_args["--topdir"] ||= $curdir
1761
+ $ruby = arg_config("--ruby", File.join(Config::CONFIG["bindir"], CONFIG["ruby_install_name"]))
1762
+
1763
+ split = Shellwords.method(:shellwords).to_proc
1764
+
1765
+ EXPORT_PREFIX = config_string('EXPORT_PREFIX') {|s| s.strip}
1766
+
1767
+ hdr = []
1768
+ config_string('COMMON_MACROS') do |s|
1769
+ Shellwords.shellwords(s).each do |w|
1770
+ hdr << "#define " + w.split(/=/, 2).join(" ")
1771
+ end
1772
+ end
1773
+ config_string('COMMON_HEADERS') do |s|
1774
+ Shellwords.shellwords(s).each {|s| hdr << "#include <#{s}>"}
1775
+ end
1776
+ COMMON_HEADERS = hdr.join("\n")
1777
+ COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
1778
+
1779
+ COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]
1780
+ RULE_SUBST = config_string('RULE_SUBST')
1781
+ COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<'
1782
+ COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<'
1783
+ TRY_LINK = config_string('TRY_LINK') ||
1784
+ "$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
1785
+ "$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
1786
+ LINK_SO = config_string('LINK_SO') ||
1787
+ if CONFIG["DLEXT"] == $OBJEXT
1788
+ "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
1789
+ else
1790
+ "$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \
1791
+ "$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)"
1792
+ end
1793
+ LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'
1794
+ RPATHFLAG = config_string('RPATHFLAG') || ''
1795
+ LIBARG = config_string('LIBARG') || '-l%s'
1796
+
1797
+ sep = config_string('BUILD_FILE_SEPARATOR') {|sep| ":/=#{sep}" if sep != "/"} || ""
1798
+ CLEANINGS = "
1799
+ clean:
1800
+ @-$(RM) $(CLEANLIBS#{sep}) $(CLEANOBJS#{sep}) $(CLEANFILES#{sep})
1801
+
1802
+ distclean: clean
1803
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
1804
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
1805
+
1806
+ realclean: distclean
1807
+ "
1808
+
1809
+ if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0)
1810
+ END {mkmf_failed($0)}
1811
+ end