shoesgem 0.1424.0

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 (808) hide show
  1. data/LICENSE +30 -0
  2. data/README.rdoc +31 -0
  3. data/lib/shoes.rb +4 -0
  4. data/shoes/CHANGELOG.txt +21 -0
  5. data/shoes/COPYING.txt +30 -0
  6. data/shoes/README.txt +117 -0
  7. data/shoes/VERSION.txt +1 -0
  8. data/shoes/fonts/Coolvetica.ttf +0 -0
  9. data/shoes/fonts/Lacuna.ttf +0 -0
  10. data/shoes/freetype6.dll +0 -0
  11. data/shoes/lib/shoes/cache.rb +54 -0
  12. data/shoes/lib/shoes/data.rb +39 -0
  13. data/shoes/lib/shoes/help.rb +421 -0
  14. data/shoes/lib/shoes/image.rb +25 -0
  15. data/shoes/lib/shoes/inspect.rb +128 -0
  16. data/shoes/lib/shoes/log.rb +48 -0
  17. data/shoes/lib/shoes/minitar.rb +986 -0
  18. data/shoes/lib/shoes/override.rb +38 -0
  19. data/shoes/lib/shoes/pack.rb +503 -0
  20. data/shoes/lib/shoes/search.rb +46 -0
  21. data/shoes/lib/shoes/setup.rb +329 -0
  22. data/shoes/lib/shoes/shy.rb +131 -0
  23. data/shoes/lib/shoes/shybuilder.rb +44 -0
  24. data/shoes/lib/shoes.rb +522 -0
  25. data/shoes/libcairo-2.dll +0 -0
  26. data/shoes/libeay32.dll +0 -0
  27. data/shoes/libexpat-1.dll +0 -0
  28. data/shoes/libfontconfig-1.dll +0 -0
  29. data/shoes/libgio-2.0-0.dll +0 -0
  30. data/shoes/libglib-2.0-0.dll +0 -0
  31. data/shoes/libgmodule-2.0-0.dll +0 -0
  32. data/shoes/libgobject-2.0-0.dll +0 -0
  33. data/shoes/libgthread-2.0-0.dll +0 -0
  34. data/shoes/libiconv2.dll +0 -0
  35. data/shoes/libjpeg-8.dll +0 -0
  36. data/shoes/libpango-1.0-0.dll +0 -0
  37. data/shoes/libpangocairo-1.0-0.dll +0 -0
  38. data/shoes/libpangoft2-1.0-0.dll +0 -0
  39. data/shoes/libpangowin32-1.0-0.dll +0 -0
  40. data/shoes/libpng14-14.dll +0 -0
  41. data/shoes/libportaudio-2.dll +0 -0
  42. data/shoes/libshoes.dll +0 -0
  43. data/shoes/libssl32.dll +0 -0
  44. data/shoes/libungif4.dll +0 -0
  45. data/shoes/msvcrt-ruby191.dll +0 -0
  46. data/shoes/readline5.dll +0 -0
  47. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/fast_xs.so +0 -0
  48. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/blankslate.rb +63 -0
  49. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/builder.rb +216 -0
  50. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/elements.rb +510 -0
  51. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/htmlinfo.rb +691 -0
  52. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/inspect.rb +103 -0
  53. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/modules.rb +40 -0
  54. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb +38 -0
  55. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tag.rb +202 -0
  56. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tags.rb +164 -0
  57. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/traverse.rb +838 -0
  58. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/xchar.rb +94 -0
  59. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot.rb +26 -0
  60. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot_scan.so +0 -0
  61. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/core.rb +135 -0
  62. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/rails.rb +58 -0
  63. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/common.rb +354 -0
  64. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/generator.so +0 -0
  65. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/parser.so +0 -0
  66. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext.rb +13 -0
  67. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/version.rb +9 -0
  68. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json.rb +8 -0
  69. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/constants.rb +49 -0
  70. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/database.rb +721 -0
  71. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/api.rb +152 -0
  72. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/driver.rb +307 -0
  73. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/native/driver.rb +219 -0
  74. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/errors.rb +68 -0
  75. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/pragmas.rb +271 -0
  76. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/resultset.rb +180 -0
  77. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/statement.rb +231 -0
  78. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/translator.rb +109 -0
  79. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/value.rb +57 -0
  80. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/version.rb +16 -0
  81. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3.rb +1 -0
  82. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3_api.so +0 -0
  83. data/shoes/ruby/gems/1.9.1/specifications/hpricot-0.8.1.gemspec +32 -0
  84. data/shoes/ruby/gems/1.9.1/specifications/json-shoes-1.1.3.gemspec +34 -0
  85. data/shoes/ruby/gems/1.9.1/specifications/sqlite3-ruby-1.2.5-x86-mswin32.gemspec +46 -0
  86. data/shoes/ruby/lib/English.rb +155 -0
  87. data/shoes/ruby/lib/Win32API.rb +28 -0
  88. data/shoes/ruby/lib/abbrev.rb +103 -0
  89. data/shoes/ruby/lib/base64.rb +91 -0
  90. data/shoes/ruby/lib/benchmark.rb +573 -0
  91. data/shoes/ruby/lib/bigdecimal/jacobian.rb +85 -0
  92. data/shoes/ruby/lib/bigdecimal/ludcmp.rb +86 -0
  93. data/shoes/ruby/lib/bigdecimal/math.rb +237 -0
  94. data/shoes/ruby/lib/bigdecimal/newton.rb +77 -0
  95. data/shoes/ruby/lib/bigdecimal/util.rb +53 -0
  96. data/shoes/ruby/lib/cgi/cookie.rb +144 -0
  97. data/shoes/ruby/lib/cgi/core.rb +786 -0
  98. data/shoes/ruby/lib/cgi/html.rb +1021 -0
  99. data/shoes/ruby/lib/cgi/session/pstore.rb +111 -0
  100. data/shoes/ruby/lib/cgi/session.rb +537 -0
  101. data/shoes/ruby/lib/cgi/util.rb +181 -0
  102. data/shoes/ruby/lib/cgi.rb +274 -0
  103. data/shoes/ruby/lib/cmath.rb +233 -0
  104. data/shoes/ruby/lib/complex.rb +24 -0
  105. data/shoes/ruby/lib/csv.rb +2320 -0
  106. data/shoes/ruby/lib/date/format.rb +1313 -0
  107. data/shoes/ruby/lib/date.rb +1834 -0
  108. data/shoes/ruby/lib/debug.rb +907 -0
  109. data/shoes/ruby/lib/delegate.rb +311 -0
  110. data/shoes/ruby/lib/digest/hmac.rb +274 -0
  111. data/shoes/ruby/lib/digest/sha2.rb +74 -0
  112. data/shoes/ruby/lib/digest.rb +50 -0
  113. data/shoes/ruby/lib/dl/callback.rb +69 -0
  114. data/shoes/ruby/lib/dl/cparser.rb +109 -0
  115. data/shoes/ruby/lib/dl/func.rb +153 -0
  116. data/shoes/ruby/lib/dl/import.rb +215 -0
  117. data/shoes/ruby/lib/dl/pack.rb +173 -0
  118. data/shoes/ruby/lib/dl/stack.rb +146 -0
  119. data/shoes/ruby/lib/dl/struct.rb +213 -0
  120. data/shoes/ruby/lib/dl/types.rb +40 -0
  121. data/shoes/ruby/lib/dl/value.rb +112 -0
  122. data/shoes/ruby/lib/drb/acl.rb +146 -0
  123. data/shoes/ruby/lib/drb/drb.rb +1778 -0
  124. data/shoes/ruby/lib/drb/eq.rb +16 -0
  125. data/shoes/ruby/lib/drb/extserv.rb +71 -0
  126. data/shoes/ruby/lib/drb/extservm.rb +85 -0
  127. data/shoes/ruby/lib/drb/gw.rb +122 -0
  128. data/shoes/ruby/lib/drb/invokemethod.rb +34 -0
  129. data/shoes/ruby/lib/drb/observer.rb +22 -0
  130. data/shoes/ruby/lib/drb/ssl.rb +190 -0
  131. data/shoes/ruby/lib/drb/timeridconv.rb +91 -0
  132. data/shoes/ruby/lib/drb/unix.rb +108 -0
  133. data/shoes/ruby/lib/drb.rb +2 -0
  134. data/shoes/ruby/lib/e2mmap.rb +172 -0
  135. data/shoes/ruby/lib/erb.rb +902 -0
  136. data/shoes/ruby/lib/fileutils.rb +1592 -0
  137. data/shoes/ruby/lib/find.rb +81 -0
  138. data/shoes/ruby/lib/forwardable.rb +270 -0
  139. data/shoes/ruby/lib/ftsearch/analysis/analyzer.rb +16 -0
  140. data/shoes/ruby/lib/ftsearch/analysis/simple_identifier_analyzer.rb +23 -0
  141. data/shoes/ruby/lib/ftsearch/analysis/whitespace_analyzer.rb +22 -0
  142. data/shoes/ruby/lib/ftsearch/document_map_reader.rb +106 -0
  143. data/shoes/ruby/lib/ftsearch/document_map_writer.rb +46 -0
  144. data/shoes/ruby/lib/ftsearch/field_infos.rb +46 -0
  145. data/shoes/ruby/lib/ftsearch/fragment_writer.rb +114 -0
  146. data/shoes/ruby/lib/ftsearch/fulltext_reader.rb +52 -0
  147. data/shoes/ruby/lib/ftsearch/fulltext_writer.rb +75 -0
  148. data/shoes/ruby/lib/ftsearch/suffix_array_reader.rb +275 -0
  149. data/shoes/ruby/lib/ftsearch/suffix_array_writer.rb +99 -0
  150. data/shoes/ruby/lib/ftsearch/util.rb +21 -0
  151. data/shoes/ruby/lib/getoptlong.rb +610 -0
  152. data/shoes/ruby/lib/gserver.rb +253 -0
  153. data/shoes/ruby/lib/i386-mingw32/bigdecimal.so +0 -0
  154. data/shoes/ruby/lib/i386-mingw32/binject.so +0 -0
  155. data/shoes/ruby/lib/i386-mingw32/bloops.so +0 -0
  156. data/shoes/ruby/lib/i386-mingw32/continuation.so +0 -0
  157. data/shoes/ruby/lib/i386-mingw32/coverage.so +0 -0
  158. data/shoes/ruby/lib/i386-mingw32/curses.so +0 -0
  159. data/shoes/ruby/lib/i386-mingw32/digest/bubblebabble.so +0 -0
  160. data/shoes/ruby/lib/i386-mingw32/digest/md5.so +0 -0
  161. data/shoes/ruby/lib/i386-mingw32/digest/rmd160.so +0 -0
  162. data/shoes/ruby/lib/i386-mingw32/digest/sha1.so +0 -0
  163. data/shoes/ruby/lib/i386-mingw32/digest/sha2.so +0 -0
  164. data/shoes/ruby/lib/i386-mingw32/digest.so +0 -0
  165. data/shoes/ruby/lib/i386-mingw32/dl.so +0 -0
  166. data/shoes/ruby/lib/i386-mingw32/enc/big5.so +0 -0
  167. data/shoes/ruby/lib/i386-mingw32/enc/cp949.so +0 -0
  168. data/shoes/ruby/lib/i386-mingw32/enc/emacs_mule.so +0 -0
  169. data/shoes/ruby/lib/i386-mingw32/enc/encdb.so +0 -0
  170. data/shoes/ruby/lib/i386-mingw32/enc/euc_jp.so +0 -0
  171. data/shoes/ruby/lib/i386-mingw32/enc/euc_kr.so +0 -0
  172. data/shoes/ruby/lib/i386-mingw32/enc/euc_tw.so +0 -0
  173. data/shoes/ruby/lib/i386-mingw32/enc/gb18030.so +0 -0
  174. data/shoes/ruby/lib/i386-mingw32/enc/gb2312.so +0 -0
  175. data/shoes/ruby/lib/i386-mingw32/enc/gbk.so +0 -0
  176. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_1.so +0 -0
  177. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_10.so +0 -0
  178. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_11.so +0 -0
  179. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_13.so +0 -0
  180. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_14.so +0 -0
  181. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_15.so +0 -0
  182. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_16.so +0 -0
  183. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_2.so +0 -0
  184. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_3.so +0 -0
  185. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_4.so +0 -0
  186. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_5.so +0 -0
  187. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_6.so +0 -0
  188. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_7.so +0 -0
  189. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_8.so +0 -0
  190. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_9.so +0 -0
  191. data/shoes/ruby/lib/i386-mingw32/enc/koi8_r.so +0 -0
  192. data/shoes/ruby/lib/i386-mingw32/enc/koi8_u.so +0 -0
  193. data/shoes/ruby/lib/i386-mingw32/enc/shift_jis.so +0 -0
  194. data/shoes/ruby/lib/i386-mingw32/enc/trans/big5.so +0 -0
  195. data/shoes/ruby/lib/i386-mingw32/enc/trans/chinese.so +0 -0
  196. data/shoes/ruby/lib/i386-mingw32/enc/trans/escape.so +0 -0
  197. data/shoes/ruby/lib/i386-mingw32/enc/trans/gb18030.so +0 -0
  198. data/shoes/ruby/lib/i386-mingw32/enc/trans/gbk.so +0 -0
  199. data/shoes/ruby/lib/i386-mingw32/enc/trans/iso2022.so +0 -0
  200. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese.so +0 -0
  201. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_euc.so +0 -0
  202. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_sjis.so +0 -0
  203. data/shoes/ruby/lib/i386-mingw32/enc/trans/korean.so +0 -0
  204. data/shoes/ruby/lib/i386-mingw32/enc/trans/single_byte.so +0 -0
  205. data/shoes/ruby/lib/i386-mingw32/enc/trans/transdb.so +0 -0
  206. data/shoes/ruby/lib/i386-mingw32/enc/trans/utf_16_32.so +0 -0
  207. data/shoes/ruby/lib/i386-mingw32/enc/utf_16be.so +0 -0
  208. data/shoes/ruby/lib/i386-mingw32/enc/utf_16le.so +0 -0
  209. data/shoes/ruby/lib/i386-mingw32/enc/utf_32be.so +0 -0
  210. data/shoes/ruby/lib/i386-mingw32/enc/utf_32le.so +0 -0
  211. data/shoes/ruby/lib/i386-mingw32/enc/windows_1251.so +0 -0
  212. data/shoes/ruby/lib/i386-mingw32/etc.so +0 -0
  213. data/shoes/ruby/lib/i386-mingw32/fcntl.so +0 -0
  214. data/shoes/ruby/lib/i386-mingw32/fiber.so +0 -0
  215. data/shoes/ruby/lib/i386-mingw32/ftsearchrt.so +0 -0
  216. data/shoes/ruby/lib/i386-mingw32/gdbm.so +0 -0
  217. data/shoes/ruby/lib/i386-mingw32/iconv.so +0 -0
  218. data/shoes/ruby/lib/i386-mingw32/io/wait.so +0 -0
  219. data/shoes/ruby/lib/i386-mingw32/json/ext/generator.so +0 -0
  220. data/shoes/ruby/lib/i386-mingw32/json/ext/parser.so +0 -0
  221. data/shoes/ruby/lib/i386-mingw32/mathn/complex.so +0 -0
  222. data/shoes/ruby/lib/i386-mingw32/mathn/rational.so +0 -0
  223. data/shoes/ruby/lib/i386-mingw32/nkf.so +0 -0
  224. data/shoes/ruby/lib/i386-mingw32/openssl.so +0 -0
  225. data/shoes/ruby/lib/i386-mingw32/racc/cparse.so +0 -0
  226. data/shoes/ruby/lib/i386-mingw32/rbconfig.rb +196 -0
  227. data/shoes/ruby/lib/i386-mingw32/readline.so +0 -0
  228. data/shoes/ruby/lib/i386-mingw32/ripper.so +0 -0
  229. data/shoes/ruby/lib/i386-mingw32/sdbm.so +0 -0
  230. data/shoes/ruby/lib/i386-mingw32/socket.so +0 -0
  231. data/shoes/ruby/lib/i386-mingw32/stringio.so +0 -0
  232. data/shoes/ruby/lib/i386-mingw32/strscan.so +0 -0
  233. data/shoes/ruby/lib/i386-mingw32/syck.so +0 -0
  234. data/shoes/ruby/lib/i386-mingw32/win32ole.so +0 -0
  235. data/shoes/ruby/lib/i386-mingw32/zlib.so +0 -0
  236. data/shoes/ruby/lib/io/nonblock.rb +23 -0
  237. data/shoes/ruby/lib/ipaddr.rb +813 -0
  238. data/shoes/ruby/lib/irb/cmd/chws.rb +32 -0
  239. data/shoes/ruby/lib/irb/cmd/fork.rb +38 -0
  240. data/shoes/ruby/lib/irb/cmd/help.rb +36 -0
  241. data/shoes/ruby/lib/irb/cmd/load.rb +66 -0
  242. data/shoes/ruby/lib/irb/cmd/nop.rb +38 -0
  243. data/shoes/ruby/lib/irb/cmd/pushws.rb +38 -0
  244. data/shoes/ruby/lib/irb/cmd/subirb.rb +42 -0
  245. data/shoes/ruby/lib/irb/completion.rb +207 -0
  246. data/shoes/ruby/lib/irb/context.rb +255 -0
  247. data/shoes/ruby/lib/irb/ext/change-ws.rb +61 -0
  248. data/shoes/ruby/lib/irb/ext/history.rb +109 -0
  249. data/shoes/ruby/lib/irb/ext/loader.rb +119 -0
  250. data/shoes/ruby/lib/irb/ext/math-mode.rb +36 -0
  251. data/shoes/ruby/lib/irb/ext/multi-irb.rb +240 -0
  252. data/shoes/ruby/lib/irb/ext/save-history.rb +100 -0
  253. data/shoes/ruby/lib/irb/ext/tracer.rb +60 -0
  254. data/shoes/ruby/lib/irb/ext/use-loader.rb +64 -0
  255. data/shoes/ruby/lib/irb/ext/workspaces.rb +55 -0
  256. data/shoes/ruby/lib/irb/extend-command.rb +272 -0
  257. data/shoes/ruby/lib/irb/frame.rb +66 -0
  258. data/shoes/ruby/lib/irb/help.rb +35 -0
  259. data/shoes/ruby/lib/irb/init.rb +288 -0
  260. data/shoes/ruby/lib/irb/input-method.rb +142 -0
  261. data/shoes/ruby/lib/irb/lc/error.rb +29 -0
  262. data/shoes/ruby/lib/irb/lc/help-message +38 -0
  263. data/shoes/ruby/lib/irb/lc/ja/encoding_aliases.rb +8 -0
  264. data/shoes/ruby/lib/irb/lc/ja/error.rb +27 -0
  265. data/shoes/ruby/lib/irb/lc/ja/help-message +39 -0
  266. data/shoes/ruby/lib/irb/locale.rb +195 -0
  267. data/shoes/ruby/lib/irb/magic-file.rb +36 -0
  268. data/shoes/ruby/lib/irb/notifier.rb +144 -0
  269. data/shoes/ruby/lib/irb/output-method.rb +69 -0
  270. data/shoes/ruby/lib/irb/ruby-lex.rb +1188 -0
  271. data/shoes/ruby/lib/irb/ruby-token.rb +270 -0
  272. data/shoes/ruby/lib/irb/slex.rb +282 -0
  273. data/shoes/ruby/lib/irb/src_encoding.rb +4 -0
  274. data/shoes/ruby/lib/irb/version.rb +15 -0
  275. data/shoes/ruby/lib/irb/workspace.rb +108 -0
  276. data/shoes/ruby/lib/irb/ws-for-case-2.rb +14 -0
  277. data/shoes/ruby/lib/irb/xmp.rb +97 -0
  278. data/shoes/ruby/lib/irb.rb +354 -0
  279. data/shoes/ruby/lib/json/add/core.rb +135 -0
  280. data/shoes/ruby/lib/json/add/rails.rb +58 -0
  281. data/shoes/ruby/lib/json/common.rb +354 -0
  282. data/shoes/ruby/lib/json/editor.rb +1371 -0
  283. data/shoes/ruby/lib/json/ext.rb +15 -0
  284. data/shoes/ruby/lib/json/version.rb +9 -0
  285. data/shoes/ruby/lib/json.rb +297 -0
  286. data/shoes/ruby/lib/kconv.rb +282 -0
  287. data/shoes/ruby/lib/logger.rb +732 -0
  288. data/shoes/ruby/lib/mathn.rb +206 -0
  289. data/shoes/ruby/lib/matrix.rb +1381 -0
  290. data/shoes/ruby/lib/minitest/autorun.rb +9 -0
  291. data/shoes/ruby/lib/minitest/mock.rb +37 -0
  292. data/shoes/ruby/lib/minitest/spec.rb +89 -0
  293. data/shoes/ruby/lib/minitest/unit.rb +497 -0
  294. data/shoes/ruby/lib/mkmf.rb +1958 -0
  295. data/shoes/ruby/lib/monitor.rb +265 -0
  296. data/shoes/ruby/lib/mutex_m.rb +91 -0
  297. data/shoes/ruby/lib/net/ftp.rb +981 -0
  298. data/shoes/ruby/lib/net/http.rb +2399 -0
  299. data/shoes/ruby/lib/net/https.rb +136 -0
  300. data/shoes/ruby/lib/net/imap.rb +3500 -0
  301. data/shoes/ruby/lib/net/pop.rb +1000 -0
  302. data/shoes/ruby/lib/net/protocol.rb +382 -0
  303. data/shoes/ruby/lib/net/smtp.rb +1014 -0
  304. data/shoes/ruby/lib/net/telnet.rb +759 -0
  305. data/shoes/ruby/lib/observer.rb +193 -0
  306. data/shoes/ruby/lib/open-uri.rb +832 -0
  307. data/shoes/ruby/lib/open3.rb +98 -0
  308. data/shoes/ruby/lib/openssl/bn.rb +35 -0
  309. data/shoes/ruby/lib/openssl/buffering.rb +242 -0
  310. data/shoes/ruby/lib/openssl/cipher.rb +65 -0
  311. data/shoes/ruby/lib/openssl/digest.rb +61 -0
  312. data/shoes/ruby/lib/openssl/ssl.rb +178 -0
  313. data/shoes/ruby/lib/openssl/x509.rb +155 -0
  314. data/shoes/ruby/lib/openssl.rb +24 -0
  315. data/shoes/ruby/lib/optparse/date.rb +17 -0
  316. data/shoes/ruby/lib/optparse/shellwords.rb +6 -0
  317. data/shoes/ruby/lib/optparse/time.rb +10 -0
  318. data/shoes/ruby/lib/optparse/uri.rb +6 -0
  319. data/shoes/ruby/lib/optparse/version.rb +70 -0
  320. data/shoes/ruby/lib/optparse.rb +1810 -0
  321. data/shoes/ruby/lib/ostruct.rb +145 -0
  322. data/shoes/ruby/lib/pathname.rb +1099 -0
  323. data/shoes/ruby/lib/pp.rb +532 -0
  324. data/shoes/ruby/lib/prettyprint.rb +896 -0
  325. data/shoes/ruby/lib/prime.rb +471 -0
  326. data/shoes/ruby/lib/profile.rb +10 -0
  327. data/shoes/ruby/lib/profiler.rb +59 -0
  328. data/shoes/ruby/lib/pstore.rb +543 -0
  329. data/shoes/ruby/lib/racc/parser.rb +441 -0
  330. data/shoes/ruby/lib/rake/classic_namespace.rb +8 -0
  331. data/shoes/ruby/lib/rake/clean.rb +33 -0
  332. data/shoes/ruby/lib/rake/gempackagetask.rb +97 -0
  333. data/shoes/ruby/lib/rake/loaders/makefile.rb +35 -0
  334. data/shoes/ruby/lib/rake/packagetask.rb +185 -0
  335. data/shoes/ruby/lib/rake/rake_test_loader.rb +5 -0
  336. data/shoes/ruby/lib/rake/rdoctask.rb +147 -0
  337. data/shoes/ruby/lib/rake/runtest.rb +23 -0
  338. data/shoes/ruby/lib/rake/tasklib.rb +23 -0
  339. data/shoes/ruby/lib/rake/testtask.rb +161 -0
  340. data/shoes/ruby/lib/rake/win32.rb +34 -0
  341. data/shoes/ruby/lib/rake.rb +2465 -0
  342. data/shoes/ruby/lib/rational.rb +19 -0
  343. data/shoes/ruby/lib/rbconfig/datadir.rb +24 -0
  344. data/shoes/ruby/lib/rdoc/code_objects.rb +1061 -0
  345. data/shoes/ruby/lib/rdoc/diagram.rb +340 -0
  346. data/shoes/ruby/lib/rdoc/dot.rb +249 -0
  347. data/shoes/ruby/lib/rdoc/generator/chm/chm.rb +100 -0
  348. data/shoes/ruby/lib/rdoc/generator/chm.rb +113 -0
  349. data/shoes/ruby/lib/rdoc/generator/html/common.rb +24 -0
  350. data/shoes/ruby/lib/rdoc/generator/html/frameless.rb +92 -0
  351. data/shoes/ruby/lib/rdoc/generator/html/hefss.rb +150 -0
  352. data/shoes/ruby/lib/rdoc/generator/html/html.rb +769 -0
  353. data/shoes/ruby/lib/rdoc/generator/html/kilmer.rb +151 -0
  354. data/shoes/ruby/lib/rdoc/generator/html/kilmerfactory.rb +427 -0
  355. data/shoes/ruby/lib/rdoc/generator/html/one_page_html.rb +122 -0
  356. data/shoes/ruby/lib/rdoc/generator/html.rb +445 -0
  357. data/shoes/ruby/lib/rdoc/generator/ri.rb +226 -0
  358. data/shoes/ruby/lib/rdoc/generator/texinfo/class.texinfo.erb +44 -0
  359. data/shoes/ruby/lib/rdoc/generator/texinfo/file.texinfo.erb +6 -0
  360. data/shoes/ruby/lib/rdoc/generator/texinfo/method.texinfo.erb +6 -0
  361. data/shoes/ruby/lib/rdoc/generator/texinfo/texinfo.erb +28 -0
  362. data/shoes/ruby/lib/rdoc/generator/texinfo.rb +81 -0
  363. data/shoes/ruby/lib/rdoc/generator/xml/rdf.rb +113 -0
  364. data/shoes/ruby/lib/rdoc/generator/xml/xml.rb +123 -0
  365. data/shoes/ruby/lib/rdoc/generator/xml.rb +117 -0
  366. data/shoes/ruby/lib/rdoc/generator.rb +1082 -0
  367. data/shoes/ruby/lib/rdoc/known_classes.rb +68 -0
  368. data/shoes/ruby/lib/rdoc/markup/attribute_manager.rb +265 -0
  369. data/shoes/ruby/lib/rdoc/markup/formatter.rb +14 -0
  370. data/shoes/ruby/lib/rdoc/markup/fragments.rb +337 -0
  371. data/shoes/ruby/lib/rdoc/markup/inline.rb +101 -0
  372. data/shoes/ruby/lib/rdoc/markup/lines.rb +152 -0
  373. data/shoes/ruby/lib/rdoc/markup/preprocess.rb +75 -0
  374. data/shoes/ruby/lib/rdoc/markup/to_flow.rb +185 -0
  375. data/shoes/ruby/lib/rdoc/markup/to_html.rb +403 -0
  376. data/shoes/ruby/lib/rdoc/markup/to_html_crossref.rb +148 -0
  377. data/shoes/ruby/lib/rdoc/markup/to_latex.rb +328 -0
  378. data/shoes/ruby/lib/rdoc/markup/to_test.rb +50 -0
  379. data/shoes/ruby/lib/rdoc/markup/to_texinfo.rb +69 -0
  380. data/shoes/ruby/lib/rdoc/markup.rb +378 -0
  381. data/shoes/ruby/lib/rdoc/options.rb +638 -0
  382. data/shoes/ruby/lib/rdoc/parser/c.rb +661 -0
  383. data/shoes/ruby/lib/rdoc/parser/f95.rb +1835 -0
  384. data/shoes/ruby/lib/rdoc/parser/perl.rb +165 -0
  385. data/shoes/ruby/lib/rdoc/parser/ruby.rb +2829 -0
  386. data/shoes/ruby/lib/rdoc/parser/simple.rb +38 -0
  387. data/shoes/ruby/lib/rdoc/parser.rb +142 -0
  388. data/shoes/ruby/lib/rdoc/rdoc.rb +293 -0
  389. data/shoes/ruby/lib/rdoc/ri/cache.rb +187 -0
  390. data/shoes/ruby/lib/rdoc/ri/descriptions.rb +156 -0
  391. data/shoes/ruby/lib/rdoc/ri/display.rb +392 -0
  392. data/shoes/ruby/lib/rdoc/ri/driver.rb +669 -0
  393. data/shoes/ruby/lib/rdoc/ri/formatter.rb +616 -0
  394. data/shoes/ruby/lib/rdoc/ri/paths.rb +99 -0
  395. data/shoes/ruby/lib/rdoc/ri/reader.rb +106 -0
  396. data/shoes/ruby/lib/rdoc/ri/util.rb +79 -0
  397. data/shoes/ruby/lib/rdoc/ri/writer.rb +68 -0
  398. data/shoes/ruby/lib/rdoc/ri.rb +8 -0
  399. data/shoes/ruby/lib/rdoc/stats.rb +115 -0
  400. data/shoes/ruby/lib/rdoc/template.rb +64 -0
  401. data/shoes/ruby/lib/rdoc/tokenstream.rb +33 -0
  402. data/shoes/ruby/lib/rdoc.rb +395 -0
  403. data/shoes/ruby/lib/resolv-replace.rb +63 -0
  404. data/shoes/ruby/lib/resolv.rb +2262 -0
  405. data/shoes/ruby/lib/rexml/attlistdecl.rb +62 -0
  406. data/shoes/ruby/lib/rexml/attribute.rb +188 -0
  407. data/shoes/ruby/lib/rexml/cdata.rb +67 -0
  408. data/shoes/ruby/lib/rexml/child.rb +96 -0
  409. data/shoes/ruby/lib/rexml/comment.rb +80 -0
  410. data/shoes/ruby/lib/rexml/doctype.rb +270 -0
  411. data/shoes/ruby/lib/rexml/document.rb +231 -0
  412. data/shoes/ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
  413. data/shoes/ruby/lib/rexml/dtd/dtd.rb +51 -0
  414. data/shoes/ruby/lib/rexml/dtd/elementdecl.rb +17 -0
  415. data/shoes/ruby/lib/rexml/dtd/entitydecl.rb +56 -0
  416. data/shoes/ruby/lib/rexml/dtd/notationdecl.rb +39 -0
  417. data/shoes/ruby/lib/rexml/element.rb +1246 -0
  418. data/shoes/ruby/lib/rexml/encoding.rb +71 -0
  419. data/shoes/ruby/lib/rexml/encodings/CP-1252.rb +103 -0
  420. data/shoes/ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
  421. data/shoes/ruby/lib/rexml/encodings/ICONV.rb +22 -0
  422. data/shoes/ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
  423. data/shoes/ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
  424. data/shoes/ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
  425. data/shoes/ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
  426. data/shoes/ruby/lib/rexml/encodings/UNILE.rb +34 -0
  427. data/shoes/ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
  428. data/shoes/ruby/lib/rexml/encodings/UTF-16.rb +35 -0
  429. data/shoes/ruby/lib/rexml/encodings/UTF-8.rb +18 -0
  430. data/shoes/ruby/lib/rexml/entity.rb +166 -0
  431. data/shoes/ruby/lib/rexml/formatters/default.rb +109 -0
  432. data/shoes/ruby/lib/rexml/formatters/pretty.rb +139 -0
  433. data/shoes/ruby/lib/rexml/formatters/transitive.rb +58 -0
  434. data/shoes/ruby/lib/rexml/functions.rb +388 -0
  435. data/shoes/ruby/lib/rexml/instruction.rb +70 -0
  436. data/shoes/ruby/lib/rexml/light/node.rb +196 -0
  437. data/shoes/ruby/lib/rexml/namespace.rb +47 -0
  438. data/shoes/ruby/lib/rexml/node.rb +75 -0
  439. data/shoes/ruby/lib/rexml/output.rb +24 -0
  440. data/shoes/ruby/lib/rexml/parent.rb +166 -0
  441. data/shoes/ruby/lib/rexml/parseexception.rb +51 -0
  442. data/shoes/ruby/lib/rexml/parsers/baseparser.rb +530 -0
  443. data/shoes/ruby/lib/rexml/parsers/lightparser.rb +58 -0
  444. data/shoes/ruby/lib/rexml/parsers/pullparser.rb +196 -0
  445. data/shoes/ruby/lib/rexml/parsers/sax2parser.rb +247 -0
  446. data/shoes/ruby/lib/rexml/parsers/streamparser.rb +46 -0
  447. data/shoes/ruby/lib/rexml/parsers/treeparser.rb +100 -0
  448. data/shoes/ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
  449. data/shoes/ruby/lib/rexml/parsers/xpathparser.rb +698 -0
  450. data/shoes/ruby/lib/rexml/quickpath.rb +263 -0
  451. data/shoes/ruby/lib/rexml/rexml.rb +31 -0
  452. data/shoes/ruby/lib/rexml/sax2listener.rb +97 -0
  453. data/shoes/ruby/lib/rexml/source.rb +258 -0
  454. data/shoes/ruby/lib/rexml/streamlistener.rb +92 -0
  455. data/shoes/ruby/lib/rexml/syncenumerator.rb +32 -0
  456. data/shoes/ruby/lib/rexml/text.rb +404 -0
  457. data/shoes/ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
  458. data/shoes/ruby/lib/rexml/validation/relaxng.rb +559 -0
  459. data/shoes/ruby/lib/rexml/validation/validation.rb +155 -0
  460. data/shoes/ruby/lib/rexml/validation/validationexception.rb +9 -0
  461. data/shoes/ruby/lib/rexml/xmldecl.rb +119 -0
  462. data/shoes/ruby/lib/rexml/xmltokens.rb +18 -0
  463. data/shoes/ruby/lib/rexml/xpath.rb +77 -0
  464. data/shoes/ruby/lib/rexml/xpath_parser.rb +792 -0
  465. data/shoes/ruby/lib/rinda/rinda.rb +283 -0
  466. data/shoes/ruby/lib/rinda/ring.rb +271 -0
  467. data/shoes/ruby/lib/rinda/tuplespace.rb +642 -0
  468. data/shoes/ruby/lib/ripper/core.rb +70 -0
  469. data/shoes/ruby/lib/ripper/filter.rb +70 -0
  470. data/shoes/ruby/lib/ripper/lexer.rb +179 -0
  471. data/shoes/ruby/lib/ripper/sexp.rb +99 -0
  472. data/shoes/ruby/lib/ripper.rb +4 -0
  473. data/shoes/ruby/lib/rss/0.9.rb +427 -0
  474. data/shoes/ruby/lib/rss/1.0.rb +452 -0
  475. data/shoes/ruby/lib/rss/2.0.rb +111 -0
  476. data/shoes/ruby/lib/rss/atom.rb +748 -0
  477. data/shoes/ruby/lib/rss/content/1.0.rb +10 -0
  478. data/shoes/ruby/lib/rss/content/2.0.rb +12 -0
  479. data/shoes/ruby/lib/rss/content.rb +31 -0
  480. data/shoes/ruby/lib/rss/converter.rb +170 -0
  481. data/shoes/ruby/lib/rss/dublincore/1.0.rb +13 -0
  482. data/shoes/ruby/lib/rss/dublincore/2.0.rb +13 -0
  483. data/shoes/ruby/lib/rss/dublincore/atom.rb +17 -0
  484. data/shoes/ruby/lib/rss/dublincore.rb +161 -0
  485. data/shoes/ruby/lib/rss/image.rb +193 -0
  486. data/shoes/ruby/lib/rss/itunes.rb +410 -0
  487. data/shoes/ruby/lib/rss/maker/0.9.rb +467 -0
  488. data/shoes/ruby/lib/rss/maker/1.0.rb +434 -0
  489. data/shoes/ruby/lib/rss/maker/2.0.rb +223 -0
  490. data/shoes/ruby/lib/rss/maker/atom.rb +172 -0
  491. data/shoes/ruby/lib/rss/maker/base.rb +880 -0
  492. data/shoes/ruby/lib/rss/maker/content.rb +21 -0
  493. data/shoes/ruby/lib/rss/maker/dublincore.rb +124 -0
  494. data/shoes/ruby/lib/rss/maker/entry.rb +163 -0
  495. data/shoes/ruby/lib/rss/maker/feed.rb +430 -0
  496. data/shoes/ruby/lib/rss/maker/image.rb +111 -0
  497. data/shoes/ruby/lib/rss/maker/itunes.rb +242 -0
  498. data/shoes/ruby/lib/rss/maker/slash.rb +33 -0
  499. data/shoes/ruby/lib/rss/maker/syndication.rb +18 -0
  500. data/shoes/ruby/lib/rss/maker/taxonomy.rb +118 -0
  501. data/shoes/ruby/lib/rss/maker/trackback.rb +61 -0
  502. data/shoes/ruby/lib/rss/maker.rb +44 -0
  503. data/shoes/ruby/lib/rss/parser.rb +568 -0
  504. data/shoes/ruby/lib/rss/rexmlparser.rb +54 -0
  505. data/shoes/ruby/lib/rss/rss.rb +1313 -0
  506. data/shoes/ruby/lib/rss/slash.rb +49 -0
  507. data/shoes/ruby/lib/rss/syndication.rb +67 -0
  508. data/shoes/ruby/lib/rss/taxonomy.rb +145 -0
  509. data/shoes/ruby/lib/rss/trackback.rb +288 -0
  510. data/shoes/ruby/lib/rss/utils.rb +111 -0
  511. data/shoes/ruby/lib/rss/xml-stylesheet.rb +105 -0
  512. data/shoes/ruby/lib/rss/xml.rb +71 -0
  513. data/shoes/ruby/lib/rss/xmlparser.rb +93 -0
  514. data/shoes/ruby/lib/rss/xmlscanner.rb +121 -0
  515. data/shoes/ruby/lib/rss.rb +19 -0
  516. data/shoes/ruby/lib/rubygems/builder.rb +88 -0
  517. data/shoes/ruby/lib/rubygems/command.rb +406 -0
  518. data/shoes/ruby/lib/rubygems/command_manager.rb +146 -0
  519. data/shoes/ruby/lib/rubygems/commands/build_command.rb +53 -0
  520. data/shoes/ruby/lib/rubygems/commands/cert_command.rb +86 -0
  521. data/shoes/ruby/lib/rubygems/commands/check_command.rb +75 -0
  522. data/shoes/ruby/lib/rubygems/commands/cleanup_command.rb +91 -0
  523. data/shoes/ruby/lib/rubygems/commands/contents_command.rb +74 -0
  524. data/shoes/ruby/lib/rubygems/commands/dependency_command.rb +188 -0
  525. data/shoes/ruby/lib/rubygems/commands/environment_command.rb +128 -0
  526. data/shoes/ruby/lib/rubygems/commands/fetch_command.rb +62 -0
  527. data/shoes/ruby/lib/rubygems/commands/generate_index_command.rb +57 -0
  528. data/shoes/ruby/lib/rubygems/commands/help_command.rb +172 -0
  529. data/shoes/ruby/lib/rubygems/commands/install_command.rb +148 -0
  530. data/shoes/ruby/lib/rubygems/commands/list_command.rb +35 -0
  531. data/shoes/ruby/lib/rubygems/commands/lock_command.rb +110 -0
  532. data/shoes/ruby/lib/rubygems/commands/mirror_command.rb +111 -0
  533. data/shoes/ruby/lib/rubygems/commands/outdated_command.rb +33 -0
  534. data/shoes/ruby/lib/rubygems/commands/pristine_command.rb +93 -0
  535. data/shoes/ruby/lib/rubygems/commands/query_command.rb +233 -0
  536. data/shoes/ruby/lib/rubygems/commands/rdoc_command.rb +82 -0
  537. data/shoes/ruby/lib/rubygems/commands/search_command.rb +37 -0
  538. data/shoes/ruby/lib/rubygems/commands/server_command.rb +48 -0
  539. data/shoes/ruby/lib/rubygems/commands/sources_command.rb +152 -0
  540. data/shoes/ruby/lib/rubygems/commands/specification_command.rb +77 -0
  541. data/shoes/ruby/lib/rubygems/commands/stale_command.rb +27 -0
  542. data/shoes/ruby/lib/rubygems/commands/uninstall_command.rb +73 -0
  543. data/shoes/ruby/lib/rubygems/commands/unpack_command.rb +95 -0
  544. data/shoes/ruby/lib/rubygems/commands/update_command.rb +181 -0
  545. data/shoes/ruby/lib/rubygems/commands/which_command.rb +87 -0
  546. data/shoes/ruby/lib/rubygems/config_file.rb +266 -0
  547. data/shoes/ruby/lib/rubygems/custom_require.rb +46 -0
  548. data/shoes/ruby/lib/rubygems/defaults.rb +89 -0
  549. data/shoes/ruby/lib/rubygems/dependency.rb +119 -0
  550. data/shoes/ruby/lib/rubygems/dependency_installer.rb +258 -0
  551. data/shoes/ruby/lib/rubygems/dependency_list.rb +165 -0
  552. data/shoes/ruby/lib/rubygems/digest/digest_adapter.rb +40 -0
  553. data/shoes/ruby/lib/rubygems/digest/md5.rb +23 -0
  554. data/shoes/ruby/lib/rubygems/digest/sha1.rb +17 -0
  555. data/shoes/ruby/lib/rubygems/digest/sha2.rb +17 -0
  556. data/shoes/ruby/lib/rubygems/doc_manager.rb +214 -0
  557. data/shoes/ruby/lib/rubygems/exceptions.rb +84 -0
  558. data/shoes/ruby/lib/rubygems/ext/builder.rb +56 -0
  559. data/shoes/ruby/lib/rubygems/ext/configure_builder.rb +24 -0
  560. data/shoes/ruby/lib/rubygems/ext/ext_conf_builder.rb +23 -0
  561. data/shoes/ruby/lib/rubygems/ext/rake_builder.rb +27 -0
  562. data/shoes/ruby/lib/rubygems/ext.rb +18 -0
  563. data/shoes/ruby/lib/rubygems/format.rb +87 -0
  564. data/shoes/ruby/lib/rubygems/gem_openssl.rb +83 -0
  565. data/shoes/ruby/lib/rubygems/gem_path_searcher.rb +100 -0
  566. data/shoes/ruby/lib/rubygems/gem_runner.rb +58 -0
  567. data/shoes/ruby/lib/rubygems/indexer/abstract_index_builder.rb +88 -0
  568. data/shoes/ruby/lib/rubygems/indexer/latest_index_builder.rb +35 -0
  569. data/shoes/ruby/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
  570. data/shoes/ruby/lib/rubygems/indexer/master_index_builder.rb +54 -0
  571. data/shoes/ruby/lib/rubygems/indexer/quick_index_builder.rb +50 -0
  572. data/shoes/ruby/lib/rubygems/indexer.rb +370 -0
  573. data/shoes/ruby/lib/rubygems/install_update_options.rb +113 -0
  574. data/shoes/ruby/lib/rubygems/installer.rb +578 -0
  575. data/shoes/ruby/lib/rubygems/local_remote_options.rb +134 -0
  576. data/shoes/ruby/lib/rubygems/old_format.rb +148 -0
  577. data/shoes/ruby/lib/rubygems/package/f_sync_dir.rb +24 -0
  578. data/shoes/ruby/lib/rubygems/package/tar_header.rb +245 -0
  579. data/shoes/ruby/lib/rubygems/package/tar_input.rb +219 -0
  580. data/shoes/ruby/lib/rubygems/package/tar_output.rb +143 -0
  581. data/shoes/ruby/lib/rubygems/package/tar_reader/entry.rb +99 -0
  582. data/shoes/ruby/lib/rubygems/package/tar_reader.rb +86 -0
  583. data/shoes/ruby/lib/rubygems/package/tar_writer.rb +180 -0
  584. data/shoes/ruby/lib/rubygems/package.rb +95 -0
  585. data/shoes/ruby/lib/rubygems/platform.rb +178 -0
  586. data/shoes/ruby/lib/rubygems/remote_fetcher.rb +344 -0
  587. data/shoes/ruby/lib/rubygems/require_paths_builder.rb +15 -0
  588. data/shoes/ruby/lib/rubygems/requirement.rb +163 -0
  589. data/shoes/ruby/lib/rubygems/rubygems_version.rb +6 -0
  590. data/shoes/ruby/lib/rubygems/security.rb +786 -0
  591. data/shoes/ruby/lib/rubygems/server.rb +629 -0
  592. data/shoes/ruby/lib/rubygems/source_index.rb +559 -0
  593. data/shoes/ruby/lib/rubygems/source_info_cache.rb +393 -0
  594. data/shoes/ruby/lib/rubygems/source_info_cache_entry.rb +56 -0
  595. data/shoes/ruby/lib/rubygems/spec_fetcher.rb +249 -0
  596. data/shoes/ruby/lib/rubygems/specification.rb +1262 -0
  597. data/shoes/ruby/lib/rubygems/test_utilities.rb +131 -0
  598. data/shoes/ruby/lib/rubygems/timer.rb +25 -0
  599. data/shoes/ruby/lib/rubygems/uninstaller.rb +242 -0
  600. data/shoes/ruby/lib/rubygems/user_interaction.rb +360 -0
  601. data/shoes/ruby/lib/rubygems/validator.rb +208 -0
  602. data/shoes/ruby/lib/rubygems/version.rb +167 -0
  603. data/shoes/ruby/lib/rubygems/version_option.rb +48 -0
  604. data/shoes/ruby/lib/rubygems.rb +888 -0
  605. data/shoes/ruby/lib/scanf.rb +703 -0
  606. data/shoes/ruby/lib/securerandom.rb +182 -0
  607. data/shoes/ruby/lib/set.rb +1274 -0
  608. data/shoes/ruby/lib/shell/builtin-command.rb +160 -0
  609. data/shoes/ruby/lib/shell/command-processor.rb +593 -0
  610. data/shoes/ruby/lib/shell/error.rb +25 -0
  611. data/shoes/ruby/lib/shell/filter.rb +109 -0
  612. data/shoes/ruby/lib/shell/process-controller.rb +319 -0
  613. data/shoes/ruby/lib/shell/system-command.rb +159 -0
  614. data/shoes/ruby/lib/shell/version.rb +15 -0
  615. data/shoes/ruby/lib/shell.rb +300 -0
  616. data/shoes/ruby/lib/shellwords.rb +156 -0
  617. data/shoes/ruby/lib/singleton.rb +313 -0
  618. data/shoes/ruby/lib/sync.rb +307 -0
  619. data/shoes/ruby/lib/tempfile.rb +218 -0
  620. data/shoes/ruby/lib/test/unit/assertions.rb +122 -0
  621. data/shoes/ruby/lib/test/unit/testcase.rb +12 -0
  622. data/shoes/ruby/lib/test/unit.rb +66 -0
  623. data/shoes/ruby/lib/thread.rb +367 -0
  624. data/shoes/ruby/lib/thwait.rb +168 -0
  625. data/shoes/ruby/lib/time.rb +869 -0
  626. data/shoes/ruby/lib/timeout.rb +108 -0
  627. data/shoes/ruby/lib/tmpdir.rb +138 -0
  628. data/shoes/ruby/lib/tracer.rb +166 -0
  629. data/shoes/ruby/lib/tsort.rb +290 -0
  630. data/shoes/ruby/lib/ubygems.rb +10 -0
  631. data/shoes/ruby/lib/un.rb +304 -0
  632. data/shoes/ruby/lib/uri/common.rb +727 -0
  633. data/shoes/ruby/lib/uri/ftp.rb +198 -0
  634. data/shoes/ruby/lib/uri/generic.rb +1128 -0
  635. data/shoes/ruby/lib/uri/http.rb +100 -0
  636. data/shoes/ruby/lib/uri/https.rb +20 -0
  637. data/shoes/ruby/lib/uri/ldap.rb +190 -0
  638. data/shoes/ruby/lib/uri/ldaps.rb +12 -0
  639. data/shoes/ruby/lib/uri/mailto.rb +266 -0
  640. data/shoes/ruby/lib/uri.rb +29 -0
  641. data/shoes/ruby/lib/weakref.rb +80 -0
  642. data/shoes/ruby/lib/webrick/accesslog.rb +75 -0
  643. data/shoes/ruby/lib/webrick/cgi.rb +260 -0
  644. data/shoes/ruby/lib/webrick/compat.rb +15 -0
  645. data/shoes/ruby/lib/webrick/config.rb +100 -0
  646. data/shoes/ruby/lib/webrick/cookie.rb +110 -0
  647. data/shoes/ruby/lib/webrick/htmlutils.rb +25 -0
  648. data/shoes/ruby/lib/webrick/httpauth/authenticator.rb +79 -0
  649. data/shoes/ruby/lib/webrick/httpauth/basicauth.rb +65 -0
  650. data/shoes/ruby/lib/webrick/httpauth/digestauth.rb +344 -0
  651. data/shoes/ruby/lib/webrick/httpauth/htdigest.rb +91 -0
  652. data/shoes/ruby/lib/webrick/httpauth/htgroup.rb +61 -0
  653. data/shoes/ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
  654. data/shoes/ruby/lib/webrick/httpauth/userdb.rb +29 -0
  655. data/shoes/ruby/lib/webrick/httpauth.rb +45 -0
  656. data/shoes/ruby/lib/webrick/httpproxy.rb +288 -0
  657. data/shoes/ruby/lib/webrick/httprequest.rb +402 -0
  658. data/shoes/ruby/lib/webrick/httpresponse.rb +326 -0
  659. data/shoes/ruby/lib/webrick/https.rb +63 -0
  660. data/shoes/ruby/lib/webrick/httpserver.rb +217 -0
  661. data/shoes/ruby/lib/webrick/httpservlet/abstract.rb +70 -0
  662. data/shoes/ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  663. data/shoes/ruby/lib/webrick/httpservlet/cgihandler.rb +110 -0
  664. data/shoes/ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
  665. data/shoes/ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
  666. data/shoes/ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
  667. data/shoes/ruby/lib/webrick/httpservlet.rb +22 -0
  668. data/shoes/ruby/lib/webrick/httpstatus.rb +132 -0
  669. data/shoes/ruby/lib/webrick/httputils.rb +392 -0
  670. data/shoes/ruby/lib/webrick/httpversion.rb +49 -0
  671. data/shoes/ruby/lib/webrick/log.rb +88 -0
  672. data/shoes/ruby/lib/webrick/server.rb +210 -0
  673. data/shoes/ruby/lib/webrick/ssl.rb +126 -0
  674. data/shoes/ruby/lib/webrick/utils.rb +175 -0
  675. data/shoes/ruby/lib/webrick/version.rb +13 -0
  676. data/shoes/ruby/lib/webrick.rb +29 -0
  677. data/shoes/ruby/lib/win32/registry.rb +832 -0
  678. data/shoes/ruby/lib/win32/resolv.rb +370 -0
  679. data/shoes/ruby/lib/win32/sspi.rb +330 -0
  680. data/shoes/ruby/lib/win32ole/property.rb +16 -0
  681. data/shoes/ruby/lib/xmlrpc/base64.rb +81 -0
  682. data/shoes/ruby/lib/xmlrpc/client.rb +625 -0
  683. data/shoes/ruby/lib/xmlrpc/config.rb +40 -0
  684. data/shoes/ruby/lib/xmlrpc/create.rb +290 -0
  685. data/shoes/ruby/lib/xmlrpc/datetime.rb +142 -0
  686. data/shoes/ruby/lib/xmlrpc/httpserver.rb +178 -0
  687. data/shoes/ruby/lib/xmlrpc/marshal.rb +76 -0
  688. data/shoes/ruby/lib/xmlrpc/parser.rb +813 -0
  689. data/shoes/ruby/lib/xmlrpc/server.rb +778 -0
  690. data/shoes/ruby/lib/xmlrpc/utils.rb +165 -0
  691. data/shoes/ruby/lib/yaml/baseemitter.rb +242 -0
  692. data/shoes/ruby/lib/yaml/basenode.rb +216 -0
  693. data/shoes/ruby/lib/yaml/constants.rb +45 -0
  694. data/shoes/ruby/lib/yaml/dbm.rb +111 -0
  695. data/shoes/ruby/lib/yaml/encoding.rb +33 -0
  696. data/shoes/ruby/lib/yaml/error.rb +34 -0
  697. data/shoes/ruby/lib/yaml/loader.rb +14 -0
  698. data/shoes/ruby/lib/yaml/rubytypes.rb +446 -0
  699. data/shoes/ruby/lib/yaml/store.rb +43 -0
  700. data/shoes/ruby/lib/yaml/stream.rb +40 -0
  701. data/shoes/ruby/lib/yaml/stringio.rb +83 -0
  702. data/shoes/ruby/lib/yaml/syck.rb +19 -0
  703. data/shoes/ruby/lib/yaml/tag.rb +91 -0
  704. data/shoes/ruby/lib/yaml/types.rb +192 -0
  705. data/shoes/ruby/lib/yaml/yamlnode.rb +54 -0
  706. data/shoes/ruby/lib/yaml/ypath.rb +52 -0
  707. data/shoes/ruby/lib/yaml.rb +440 -0
  708. data/shoes/samples/class-book.rb +43 -0
  709. data/shoes/samples/class-book.yaml +387 -0
  710. data/shoes/samples/expert-definr.rb +23 -0
  711. data/shoes/samples/expert-funnies.rb +51 -0
  712. data/shoes/samples/expert-irb.rb +112 -0
  713. data/shoes/samples/expert-minesweeper.rb +267 -0
  714. data/shoes/samples/expert-othello.rb +319 -0
  715. data/shoes/samples/expert-pong.rb +62 -0
  716. data/shoes/samples/expert-tankspank.rb +385 -0
  717. data/shoes/samples/good-arc.rb +37 -0
  718. data/shoes/samples/good-clock.rb +51 -0
  719. data/shoes/samples/good-follow.rb +26 -0
  720. data/shoes/samples/good-reminder.rb +174 -0
  721. data/shoes/samples/good-vjot.rb +56 -0
  722. data/shoes/samples/simple-accordion.rb +75 -0
  723. data/shoes/samples/simple-anim-shapes.rb +17 -0
  724. data/shoes/samples/simple-anim-text.rb +13 -0
  725. data/shoes/samples/simple-arc.rb +23 -0
  726. data/shoes/samples/simple-bounce.rb +24 -0
  727. data/shoes/samples/simple-calc.rb +70 -0
  728. data/shoes/samples/simple-control-sizes.rb +24 -0
  729. data/shoes/samples/simple-curve.rb +26 -0
  730. data/shoes/samples/simple-dialogs.rb +29 -0
  731. data/shoes/samples/simple-downloader.rb +27 -0
  732. data/shoes/samples/simple-draw.rb +13 -0
  733. data/shoes/samples/simple-editor.rb +28 -0
  734. data/shoes/samples/simple-form.rb +28 -0
  735. data/shoes/samples/simple-form.shy +0 -0
  736. data/shoes/samples/simple-mask.rb +21 -0
  737. data/shoes/samples/simple-menu.rb +31 -0
  738. data/shoes/samples/simple-menu1.rb +35 -0
  739. data/shoes/samples/simple-rubygems.rb +29 -0
  740. data/shoes/samples/simple-slide.rb +45 -0
  741. data/shoes/samples/simple-sphere.rb +28 -0
  742. data/shoes/samples/simple-timer.rb +13 -0
  743. data/shoes/samples/simple-video.rb +13 -0
  744. data/shoes/shoes +21 -0
  745. data/shoes/shoes.exe +0 -0
  746. data/shoes/shoes.exe.manifest +17 -0
  747. data/shoes/sqlite3.dll +0 -0
  748. data/shoes/static/Shoes.icns +0 -0
  749. data/shoes/static/Thumbs.db +0 -0
  750. data/shoes/static/app-icon.png +0 -0
  751. data/shoes/static/avatar.png +0 -0
  752. data/shoes/static/code_highlighter.js +188 -0
  753. data/shoes/static/code_highlighter_ruby.js +26 -0
  754. data/shoes/static/icon-debug.png +0 -0
  755. data/shoes/static/icon-error.png +0 -0
  756. data/shoes/static/icon-info.png +0 -0
  757. data/shoes/static/icon-warn.png +0 -0
  758. data/shoes/static/listbox_button1.png +0 -0
  759. data/shoes/static/listbox_button2.png +0 -0
  760. data/shoes/static/man-app.png +0 -0
  761. data/shoes/static/man-builds.png +0 -0
  762. data/shoes/static/man-editor-notepad.png +0 -0
  763. data/shoes/static/man-editor-osx.png +0 -0
  764. data/shoes/static/man-ele-background.png +0 -0
  765. data/shoes/static/man-ele-border.png +0 -0
  766. data/shoes/static/man-ele-button.png +0 -0
  767. data/shoes/static/man-ele-check.png +0 -0
  768. data/shoes/static/man-ele-editbox.png +0 -0
  769. data/shoes/static/man-ele-editline.png +0 -0
  770. data/shoes/static/man-ele-image.png +0 -0
  771. data/shoes/static/man-ele-listbox.png +0 -0
  772. data/shoes/static/man-ele-progress.png +0 -0
  773. data/shoes/static/man-ele-radio.png +0 -0
  774. data/shoes/static/man-ele-shape.png +0 -0
  775. data/shoes/static/man-ele-textblock.png +0 -0
  776. data/shoes/static/man-ele-video.png +0 -0
  777. data/shoes/static/man-intro-dmg.png +0 -0
  778. data/shoes/static/man-intro-exe.png +0 -0
  779. data/shoes/static/man-look-tiger.png +0 -0
  780. data/shoes/static/man-look-ubuntu.png +0 -0
  781. data/shoes/static/man-look-vista.png +0 -0
  782. data/shoes/static/man-run-osx.png +0 -0
  783. data/shoes/static/man-run-vista.png +0 -0
  784. data/shoes/static/man-run-xp.png +0 -0
  785. data/shoes/static/man-shot1.png +0 -0
  786. data/shoes/static/manual-en.txt +2783 -0
  787. data/shoes/static/manual-ja.txt +2780 -0
  788. data/shoes/static/manual.css +167 -0
  789. data/shoes/static/menu-corner1.png +0 -0
  790. data/shoes/static/menu-corner2.png +0 -0
  791. data/shoes/static/menu-gray.png +0 -0
  792. data/shoes/static/menu-left.png +0 -0
  793. data/shoes/static/menu-right.png +0 -0
  794. data/shoes/static/menu-top.png +0 -0
  795. data/shoes/static/shoes-dmg.jpg +0 -0
  796. data/shoes/static/shoes-icon-blue.png +0 -0
  797. data/shoes/static/shoes-icon.png +0 -0
  798. data/shoes/static/shoes-manual-apps.gif +0 -0
  799. data/shoes/static/stripe.png +0 -0
  800. data/shoes/static/stubs/blank.exe +0 -0
  801. data/shoes/static/stubs/blank.hfz +0 -0
  802. data/shoes/static/stubs/blank.run +375 -0
  803. data/shoes/static/stubs/cocoa-install +0 -0
  804. data/shoes/static/stubs/sh-install +48 -0
  805. data/shoes/static/tutor-back.png +0 -0
  806. data/shoes/zlib.dll +0 -0
  807. data/shoes/zlib1.dll +0 -0
  808. metadata +887 -0
@@ -0,0 +1,1958 @@
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 = RbConfig::MAKEFILE_CONFIG
9
+ ORIG_LIBPATH = ENV['LIB']
10
+
11
+ CXX_EXT = %w[cc cxx cpp]
12
+ if /mswin|bccwin|mingw|os2/ !~ CONFIG['build_os']
13
+ CXX_EXT.concat(%w[C])
14
+ end
15
+ SRC_EXT = %w[c m] << CXX_EXT
16
+ $static = nil
17
+ $config_h = '$(arch_hdrdir)/ruby/config.h'
18
+ $default_static = $static
19
+
20
+ unless defined? $configure_args
21
+ $configure_args = {}
22
+ args = CONFIG["configure_args"]
23
+ if ENV["CONFIGURE_ARGS"]
24
+ args << " " << ENV["CONFIGURE_ARGS"]
25
+ end
26
+ for arg in Shellwords::shellwords(args)
27
+ arg, val = arg.split('=', 2)
28
+ next unless arg
29
+ arg.tr!('_', '-')
30
+ if arg.sub!(/^(?!--)/, '--')
31
+ val or next
32
+ arg.downcase!
33
+ end
34
+ next if /^--(?:top|topsrc|src|cur)dir$/ =~ arg
35
+ $configure_args[arg] = val || true
36
+ end
37
+ for arg in ARGV
38
+ arg, val = arg.split('=', 2)
39
+ next unless arg
40
+ arg.tr!('_', '-')
41
+ if arg.sub!(/^(?!--)/, '--')
42
+ val or next
43
+ arg.downcase!
44
+ end
45
+ $configure_args[arg] = val || true
46
+ end
47
+ end
48
+
49
+ $libdir = CONFIG["libdir"]
50
+ $rubylibdir = CONFIG["rubylibdir"]
51
+ $archdir = CONFIG["archdir"]
52
+ $sitedir = CONFIG["sitedir"]
53
+ $sitelibdir = CONFIG["sitelibdir"]
54
+ $sitearchdir = CONFIG["sitearchdir"]
55
+ $vendordir = CONFIG["vendordir"]
56
+ $vendorlibdir = CONFIG["vendorlibdir"]
57
+ $vendorarchdir = CONFIG["vendorarchdir"]
58
+
59
+ $mswin = /mswin/ =~ RUBY_PLATFORM
60
+ $bccwin = /bccwin/ =~ RUBY_PLATFORM
61
+ $mingw = /mingw/ =~ RUBY_PLATFORM
62
+ $cygwin = /cygwin/ =~ RUBY_PLATFORM
63
+ $netbsd = /netbsd/ =~ RUBY_PLATFORM
64
+ $os2 = /os2/ =~ RUBY_PLATFORM
65
+ $beos = /beos/ =~ RUBY_PLATFORM
66
+ $haiku = /haiku/ =~ RUBY_PLATFORM
67
+ $solaris = /solaris/ =~ RUBY_PLATFORM
68
+ $dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/)
69
+
70
+ # :stopdoc:
71
+
72
+ def config_string(key, config = CONFIG)
73
+ s = config[key] and !s.empty? and block_given? ? yield(s) : s
74
+ end
75
+
76
+ def dir_re(dir)
77
+ Regexp.new('\$(?:\('+dir+'\)|\{'+dir+'\})(?:\$(?:\(target_prefix\)|\{target_prefix\}))?')
78
+ end
79
+
80
+ def relative_from(path, base)
81
+ dir = File.join(path, "")
82
+ if File.expand_path(dir) == File.expand_path(dir, base)
83
+ path
84
+ else
85
+ File.join(base, path)
86
+ end
87
+ end
88
+
89
+ INSTALL_DIRS = [
90
+ [dir_re('commondir'), "$(RUBYCOMMONDIR)"],
91
+ [dir_re('sitedir'), "$(RUBYCOMMONDIR)"],
92
+ [dir_re('vendordir'), "$(RUBYCOMMONDIR)"],
93
+ [dir_re('rubylibdir'), "$(RUBYLIBDIR)"],
94
+ [dir_re('archdir'), "$(RUBYARCHDIR)"],
95
+ [dir_re('sitelibdir'), "$(RUBYLIBDIR)"],
96
+ [dir_re('vendorlibdir'), "$(RUBYLIBDIR)"],
97
+ [dir_re('sitearchdir'), "$(RUBYARCHDIR)"],
98
+ [dir_re('vendorarchdir'), "$(RUBYARCHDIR)"],
99
+ [dir_re('rubyhdrdir'), "$(RUBYHDRDIR)"],
100
+ [dir_re('sitehdrdir'), "$(SITEHDRDIR)"],
101
+ [dir_re('vendorhdrdir'), "$(VENDORHDRDIR)"],
102
+ [dir_re('bindir'), "$(BINDIR)"],
103
+ ]
104
+
105
+ def install_dirs(target_prefix = nil)
106
+ if $extout
107
+ dirs = [
108
+ ['BINDIR', '$(extout)/bin'],
109
+ ['RUBYCOMMONDIR', '$(extout)/common'],
110
+ ['RUBYLIBDIR', '$(RUBYCOMMONDIR)$(target_prefix)'],
111
+ ['RUBYARCHDIR', '$(extout)/$(arch)$(target_prefix)'],
112
+ ['HDRDIR', '$(extout)/include/ruby$(target_prefix)'],
113
+ ['ARCHHDRDIR', '$(extout)/include/$(arch)/ruby$(target_prefix)'],
114
+ ['extout', "#$extout"],
115
+ ['extout_prefix', "#$extout_prefix"],
116
+ ]
117
+ elsif $extmk
118
+ dirs = [
119
+ ['BINDIR', '$(bindir)'],
120
+ ['RUBYCOMMONDIR', '$(rubylibdir)'],
121
+ ['RUBYLIBDIR', '$(rubylibdir)$(target_prefix)'],
122
+ ['RUBYARCHDIR', '$(archdir)$(target_prefix)'],
123
+ ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
124
+ ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
125
+ ]
126
+ elsif $configure_args.has_key?('--vendor')
127
+ dirs = [
128
+ ['BINDIR', '$(bindir)'],
129
+ ['RUBYCOMMONDIR', '$(vendordir)$(target_prefix)'],
130
+ ['RUBYLIBDIR', '$(vendorlibdir)$(target_prefix)'],
131
+ ['RUBYARCHDIR', '$(vendorarchdir)$(target_prefix)'],
132
+ ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
133
+ ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
134
+ ]
135
+ else
136
+ dirs = [
137
+ ['BINDIR', '$(bindir)'],
138
+ ['RUBYCOMMONDIR', '$(sitedir)$(target_prefix)'],
139
+ ['RUBYLIBDIR', '$(sitelibdir)$(target_prefix)'],
140
+ ['RUBYARCHDIR', '$(sitearchdir)$(target_prefix)'],
141
+ ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
142
+ ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
143
+ ]
144
+ end
145
+ dirs << ['target_prefix', (target_prefix ? "/#{target_prefix}" : "")]
146
+ dirs
147
+ end
148
+
149
+ def map_dir(dir, map = nil)
150
+ map ||= INSTALL_DIRS
151
+ map.inject(dir) {|d, (orig, new)| d.gsub(orig, new)}
152
+ end
153
+
154
+ topdir = File.dirname(libdir = File.dirname(__FILE__))
155
+ extdir = File.expand_path("ext", topdir)
156
+ path = File.expand_path($0)
157
+ $extmk = path[0, topdir.size+1] == topdir+"/" && %r"\A(ext|enc|tool)\z" =~ File.dirname(path[topdir.size+1..-1])
158
+ if not $extmk and File.exist?(($hdrdir = RbConfig::CONFIG["rubyhdrdir"]) + "/ruby/ruby.h")
159
+ $topdir = $hdrdir
160
+ $top_srcdir = $hdrdir
161
+ $arch_hdrdir = $hdrdir + "/$(arch)"
162
+ elsif File.exist?(($hdrdir = ($top_srcdir ||= topdir) + "/include") + "/ruby.h")
163
+ $topdir ||= RbConfig::CONFIG["topdir"]
164
+ $arch_hdrdir = "$(extout)/include/$(arch)"
165
+ else
166
+ abort "mkmf.rb can't find header files for ruby at #{$hdrdir}/ruby.h"
167
+ end
168
+
169
+ OUTFLAG = CONFIG['OUTFLAG']
170
+ COUTFLAG = CONFIG['COUTFLAG']
171
+ CPPOUTFILE = CONFIG['CPPOUTFILE']
172
+
173
+ CONFTEST_C = "conftest.c".freeze
174
+
175
+ class String
176
+ # Wraps a string in escaped quotes if it contains whitespace.
177
+ def quote
178
+ /\s/ =~ self ? "\"#{self}\"" : "#{self}"
179
+ end
180
+
181
+ # Generates a string used as cpp macro name.
182
+ def tr_cpp
183
+ strip.upcase.tr_s("^A-Z0-9_", "_")
184
+ end
185
+ end
186
+ class Array
187
+ # Wraps all strings in escaped quotes if they contain whitespace.
188
+ def quote
189
+ map {|s| s.quote}
190
+ end
191
+ end
192
+
193
+ def rm_f(*files)
194
+ opt = ([files.pop] if Hash === files.last)
195
+ FileUtils.rm_f(Dir[*files.flatten(1)], *opt)
196
+ end
197
+
198
+ def rm_rf(*files)
199
+ opt = ([files.pop] if Hash === files.last)
200
+ FileUtils.rm_rf(Dir[*files.flatten(1)], *opt)
201
+ end
202
+
203
+ # Returns time stamp of the +target+ file if it exists and is newer
204
+ # than or equal to all of +times+.
205
+ def modified?(target, times)
206
+ (t = File.mtime(target)) rescue return nil
207
+ Array === times or times = [times]
208
+ t if times.all? {|n| n <= t}
209
+ end
210
+
211
+ def merge_libs(*libs)
212
+ libs.inject([]) do |x, y|
213
+ xy = x & y
214
+ xn = yn = 0
215
+ y = y.inject([]) {|ary, e| ary.last == e ? ary : ary << e}
216
+ y.each_with_index do |v, yi|
217
+ if xy.include?(v)
218
+ xi = [x.index(v), xn].max()
219
+ x[xi, 1] = y[yn..yi]
220
+ xn, yn = xi + (yi - yn + 1), yi + 1
221
+ end
222
+ end
223
+ x.concat(y[yn..-1] || [])
224
+ end
225
+ end
226
+
227
+ # This is a custom logging module. It generates an mkmf.log file when you
228
+ # run your extconf.rb script. This can be useful for debugging unexpected
229
+ # failures.
230
+ #
231
+ # This module and its associated methods are meant for internal use only.
232
+ #
233
+ module Logging
234
+ @log = nil
235
+ @logfile = 'mkmf.log'
236
+ @orgerr = $stderr.dup
237
+ @orgout = $stdout.dup
238
+ @postpone = 0
239
+ @quiet = $extmk
240
+
241
+ def self::log_open
242
+ @log ||= File::open(@logfile, 'wb')
243
+ @log.sync = true
244
+ end
245
+
246
+ def self::open
247
+ log_open
248
+ $stderr.reopen(@log)
249
+ $stdout.reopen(@log)
250
+ yield
251
+ ensure
252
+ $stderr.reopen(@orgerr)
253
+ $stdout.reopen(@orgout)
254
+ end
255
+
256
+ def self::message(*s)
257
+ log_open
258
+ @log.printf(*s)
259
+ end
260
+
261
+ def self::logfile file
262
+ @logfile = file
263
+ if @log and not @log.closed?
264
+ @log.flush
265
+ @log.close
266
+ @log = nil
267
+ end
268
+ end
269
+
270
+ def self::postpone
271
+ tmplog = "mkmftmp#{@postpone += 1}.log"
272
+ open do
273
+ log, *save = @log, @logfile, @orgout, @orgerr
274
+ @log, @logfile, @orgout, @orgerr = nil, tmplog, log, log
275
+ begin
276
+ log.print(open {yield})
277
+ @log.close
278
+ File::open(tmplog) {|t| FileUtils.copy_stream(t, log)}
279
+ ensure
280
+ @log, @logfile, @orgout, @orgerr = log, *save
281
+ @postpone -= 1
282
+ rm_f tmplog
283
+ end
284
+ end
285
+ end
286
+
287
+ class << self
288
+ attr_accessor :quiet
289
+ end
290
+ end
291
+
292
+ def xsystem command
293
+ varpat = /\$\((\w+)\)|\$\{(\w+)\}/
294
+ if varpat =~ command
295
+ vars = Hash.new {|h, k| h[k] = ''; ENV[k]}
296
+ command = command.dup
297
+ nil while command.gsub!(varpat) {vars[$1||$2]}
298
+ end
299
+ Logging::open do
300
+ puts command.quote
301
+ system(command)
302
+ end
303
+ end
304
+
305
+ def xpopen command, *mode, &block
306
+ Logging::open do
307
+ case mode[0]
308
+ when nil, /^r/
309
+ puts "#{command} |"
310
+ else
311
+ puts "| #{command}"
312
+ end
313
+ IO.popen(command, *mode, &block)
314
+ end
315
+ end
316
+
317
+ def log_src(src)
318
+ src = src.split(/^/)
319
+ fmt = "%#{src.size.to_s.size}d: %s"
320
+ Logging::message <<"EOM"
321
+ checked program was:
322
+ /* begin */
323
+ EOM
324
+ src.each_with_index {|line, no| Logging::message fmt, no+1, line}
325
+ Logging::message <<"EOM"
326
+ /* end */
327
+
328
+ EOM
329
+ end
330
+
331
+ def create_tmpsrc(src)
332
+ src = "#{COMMON_HEADERS}\n#{src}"
333
+ src = yield(src) if block_given?
334
+ src.gsub!(/[ \t]+$/, '')
335
+ src.gsub!(/\A\n+|^\n+$/, '')
336
+ src.sub!(/[^\n]\z/, "\\&\n")
337
+ count = 0
338
+ begin
339
+ open(CONFTEST_C, "wb") do |cfile|
340
+ cfile.print src
341
+ end
342
+ rescue Errno::EACCES
343
+ if (count += 1) < 5
344
+ sleep 0.2
345
+ retry
346
+ end
347
+ end
348
+ src
349
+ end
350
+
351
+ def have_devel?
352
+ unless defined? $have_devel
353
+ $have_devel = true
354
+ $have_devel = try_link(MAIN_DOES_NOTHING)
355
+ end
356
+ $have_devel
357
+ end
358
+
359
+ def try_do(src, command, &b)
360
+ unless have_devel?
361
+ raise <<MSG
362
+ The complier failed to generate an executable file.
363
+ You have to install development tools first.
364
+ MSG
365
+ end
366
+ src = create_tmpsrc(src, &b)
367
+ xsystem(command)
368
+ ensure
369
+ log_src(src)
370
+ rm_rf 'conftest.dSYM'
371
+ end
372
+
373
+ def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
374
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote,
375
+ 'src' => CONFTEST_C,
376
+ 'arch_hdrdir' => "#$arch_hdrdir",
377
+ 'top_srcdir' => $top_srcdir.quote,
378
+ 'INCFLAGS' => "#$INCFLAGS",
379
+ 'CPPFLAGS' => "#$CPPFLAGS",
380
+ 'CFLAGS' => "#$CFLAGS",
381
+ 'ARCH_FLAG' => "#$ARCH_FLAG",
382
+ 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
383
+ 'LIBPATH' => libpathflag(libpath),
384
+ 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
385
+ 'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")
386
+ RbConfig::expand(TRY_LINK.dup, conf)
387
+ end
388
+
389
+ def cc_command(opt="")
390
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
391
+ 'arch_hdrdir' => "#$arch_hdrdir",
392
+ 'top_srcdir' => $top_srcdir.quote)
393
+ RbConfig::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
394
+ conf)
395
+ end
396
+
397
+ def cpp_command(outfile, opt="")
398
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote,
399
+ 'arch_hdrdir' => "#$arch_hdrdir",
400
+ 'top_srcdir' => $top_srcdir.quote)
401
+ RbConfig::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
402
+ conf)
403
+ end
404
+
405
+ def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
406
+ libpath.map{|x|
407
+ case x
408
+ when "$(topdir)", /\A\./
409
+ LIBPATHFLAG
410
+ else
411
+ LIBPATHFLAG+RPATHFLAG
412
+ end % x.quote
413
+ }.join
414
+ end
415
+
416
+ def try_link0(src, opt="", &b)
417
+ try_do(src, link_command("", opt), &b)
418
+ end
419
+
420
+ def try_link(src, opt="", &b)
421
+ try_link0(src, opt, &b)
422
+ ensure
423
+ rm_f "conftest*", "c0x32*"
424
+ end
425
+
426
+ def try_compile(src, opt="", &b)
427
+ try_do(src, cc_command(opt), &b)
428
+ ensure
429
+ rm_f "conftest*"
430
+ end
431
+
432
+ def try_cpp(src, opt="", &b)
433
+ try_do(src, cpp_command(CPPOUTFILE, opt), &b)
434
+ ensure
435
+ rm_f "conftest*"
436
+ end
437
+
438
+ def cpp_include(header)
439
+ if header
440
+ header = [header] unless header.kind_of? Array
441
+ header.map {|h| "#include <#{h}>\n"}.join
442
+ else
443
+ ""
444
+ end
445
+ end
446
+
447
+ def with_cppflags(flags)
448
+ cppflags = $CPPFLAGS
449
+ $CPPFLAGS = flags
450
+ ret = yield
451
+ ensure
452
+ $CPPFLAGS = cppflags unless ret
453
+ end
454
+
455
+ def with_cflags(flags)
456
+ cflags = $CFLAGS
457
+ $CFLAGS = flags
458
+ ret = yield
459
+ ensure
460
+ $CFLAGS = cflags unless ret
461
+ end
462
+
463
+ def with_ldflags(flags)
464
+ ldflags = $LDFLAGS
465
+ $LDFLAGS = flags
466
+ ret = yield
467
+ ensure
468
+ $LDFLAGS = ldflags unless ret
469
+ end
470
+
471
+ def try_static_assert(expr, headers = nil, opt = "", &b)
472
+ headers = cpp_include(headers)
473
+ try_compile(<<SRC, opt, &b)
474
+ #{headers}
475
+ /*top*/
476
+ int conftest_const[(#{expr}) ? 1 : -1];
477
+ SRC
478
+ end
479
+
480
+ def try_constant(const, headers = nil, opt = "", &b)
481
+ includes = cpp_include(headers)
482
+ if CROSS_COMPILING
483
+ if try_static_assert("#{const} > 0", headers, opt)
484
+ # positive constant
485
+ elsif try_static_assert("#{const} < 0", headers, opt)
486
+ neg = true
487
+ const = "-(#{const})"
488
+ elsif try_static_assert("#{const} == 0", headers, opt)
489
+ return 0
490
+ else
491
+ # not a constant
492
+ return nil
493
+ end
494
+ upper = 1
495
+ lower = 0
496
+ until try_static_assert("#{const} <= #{upper}", headers, opt)
497
+ lower = upper
498
+ upper <<= 1
499
+ end
500
+ return nil unless lower
501
+ while upper > lower + 1
502
+ mid = (upper + lower) / 2
503
+ if try_static_assert("#{const} > #{mid}", headers, opt)
504
+ lower = mid
505
+ else
506
+ upper = mid
507
+ end
508
+ end
509
+ upper = -upper if neg
510
+ return upper
511
+ else
512
+ src = %{#{includes}
513
+ #include <stdio.h>
514
+ /*top*/
515
+ int conftest_const = (int)(#{const});
516
+ int main() {printf("%d\\n", conftest_const); return 0;}
517
+ }
518
+ if try_link0(src, opt, &b)
519
+ xpopen("./conftest") do |f|
520
+ return Integer(f.gets)
521
+ end
522
+ end
523
+ end
524
+ nil
525
+ end
526
+
527
+ def try_func(func, libs, headers = nil, &b)
528
+ headers = cpp_include(headers)
529
+ try_link(<<"SRC", libs, &b) or
530
+ #{headers}
531
+ /*top*/
532
+ #{MAIN_DOES_NOTHING}
533
+ int t() { void ((*volatile p)()); p = (void ((*)()))#{func}; return 0; }
534
+ SRC
535
+ try_link(<<"SRC", libs, &b)
536
+ #{headers}
537
+ /*top*/
538
+ #{MAIN_DOES_NOTHING}
539
+ int t() { #{func}(); return 0; }
540
+ SRC
541
+ end
542
+
543
+ def try_var(var, headers = nil, &b)
544
+ headers = cpp_include(headers)
545
+ try_compile(<<"SRC", &b)
546
+ #{headers}
547
+ /*top*/
548
+ #{MAIN_DOES_NOTHING}
549
+ int t() { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
550
+ SRC
551
+ end
552
+
553
+ def egrep_cpp(pat, src, opt = "", &b)
554
+ src = create_tmpsrc(src, &b)
555
+ xpopen(cpp_command('', opt)) do |f|
556
+ if Regexp === pat
557
+ puts(" ruby -ne 'print if #{pat.inspect}'")
558
+ f.grep(pat) {|l|
559
+ puts "#{f.lineno}: #{l}"
560
+ return true
561
+ }
562
+ false
563
+ else
564
+ puts(" egrep '#{pat}'")
565
+ begin
566
+ stdin = $stdin.dup
567
+ $stdin.reopen(f)
568
+ system("egrep", pat)
569
+ ensure
570
+ $stdin.reopen(stdin)
571
+ end
572
+ end
573
+ end
574
+ ensure
575
+ rm_f "conftest*"
576
+ log_src(src)
577
+ end
578
+
579
+ # This is used internally by the have_macro? method.
580
+ def macro_defined?(macro, src, opt = "", &b)
581
+ src = src.sub(/[^\n]\z/, "\\&\n")
582
+ try_compile(src + <<"SRC", opt, &b)
583
+ /*top*/
584
+ #ifndef #{macro}
585
+ # error
586
+ >>>>>> #{macro} undefined <<<<<<
587
+ #endif
588
+ SRC
589
+ end
590
+
591
+ def try_run(src, opt = "", &b)
592
+ if try_link0(src, opt, &b)
593
+ xsystem("./conftest")
594
+ else
595
+ nil
596
+ end
597
+ ensure
598
+ rm_f "conftest*"
599
+ end
600
+
601
+ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
602
+ ifiles or return
603
+ ifiles.empty? and return
604
+ srcprefix ||= '$(srcdir)'
605
+ RbConfig::expand(srcdir = srcprefix.dup)
606
+ dirs = []
607
+ path = Hash.new {|h, i| h[i] = dirs.push([i])[-1]}
608
+ ifiles.each do |files, dir, prefix|
609
+ dir = map_dir(dir, map)
610
+ prefix &&= %r|\A#{Regexp.quote(prefix)}/?|
611
+ if /\A\.\// =~ files
612
+ # install files which are in current working directory.
613
+ files = files[2..-1]
614
+ len = nil
615
+ else
616
+ # install files which are under the $(srcdir).
617
+ files = File.join(srcdir, files)
618
+ len = srcdir.size
619
+ end
620
+ f = nil
621
+ Dir.glob(files) do |fx|
622
+ f = fx
623
+ f[0..len] = "" if len
624
+ case File.basename(f)
625
+ when *$NONINSTALLFILES
626
+ next
627
+ end
628
+ d = File.dirname(f)
629
+ d.sub!(prefix, "") if prefix
630
+ d = (d.empty? || d == ".") ? dir : File.join(dir, d)
631
+ f = File.join(srcprefix, f) if len
632
+ path[d] << f
633
+ end
634
+ unless len or f
635
+ d = File.dirname(files)
636
+ d.sub!(prefix, "") if prefix
637
+ d = (d.empty? || d == ".") ? dir : File.join(dir, d)
638
+ path[d] << files
639
+ end
640
+ end
641
+ dirs
642
+ end
643
+
644
+ def install_rb(mfile, dest, srcdir = nil)
645
+ install_files(mfile, [["lib/**/*.rb", dest, "lib"]], nil, srcdir)
646
+ end
647
+
648
+ def append_library(libs, lib) # :no-doc:
649
+ format(LIBARG, lib) + " " + libs
650
+ end
651
+
652
+ def message(*s)
653
+ unless Logging.quiet and not $VERBOSE
654
+ printf(*s)
655
+ $stdout.flush
656
+ end
657
+ end
658
+
659
+ # This emits a string to stdout that allows users to see the results of the
660
+ # various have* and find* methods as they are tested.
661
+ #
662
+ # Internal use only.
663
+ #
664
+ def checking_for(m, fmt = nil)
665
+ f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim #'
666
+ m = "checking #{/\Acheck/ =~ f ? '' : 'for '}#{m}... "
667
+ message "%s", m
668
+ a = r = nil
669
+ Logging::postpone do
670
+ r = yield
671
+ a = (fmt ? fmt % r : r ? "yes" : "no") << "\n"
672
+ "#{f}#{m}-------------------- #{a}\n"
673
+ end
674
+ message(a)
675
+ Logging::message "--------------------\n\n"
676
+ r
677
+ end
678
+
679
+ def checking_message(target, place = nil, opt = nil)
680
+ [["in", place], ["with", opt]].inject("#{target}") do |msg, (pre, noun)|
681
+ if noun
682
+ [[:to_str], [:join, ","], [:to_s]].each do |meth, *args|
683
+ if noun.respond_to?(meth)
684
+ break noun = noun.send(meth, *args)
685
+ end
686
+ end
687
+ msg << " #{pre} #{noun}" unless noun.empty?
688
+ end
689
+ msg
690
+ end
691
+ end
692
+
693
+ # :startdoc:
694
+
695
+ # Returns whether or not +macro+ is defined either in the common header
696
+ # files or within any +headers+ you provide.
697
+ #
698
+ # Any options you pass to +opt+ are passed along to the compiler.
699
+ #
700
+ def have_macro(macro, headers = nil, opt = "", &b)
701
+ checking_for checking_message(macro, headers, opt) do
702
+ macro_defined?(macro, cpp_include(headers), opt, &b)
703
+ end
704
+ end
705
+
706
+ # Returns whether or not the given entry point +func+ can be found within
707
+ # +lib+. If +func+ is nil, the 'main()' entry point is used by default.
708
+ # If found, it adds the library to list of libraries to be used when linking
709
+ # your extension.
710
+ #
711
+ # If +headers+ are provided, it will include those header files as the
712
+ # header files it looks in when searching for +func+.
713
+ #
714
+ # The real name of the library to be linked can be altered by
715
+ # '--with-FOOlib' configuration option.
716
+ #
717
+ def have_library(lib, func = nil, headers = nil, &b)
718
+ func = "main" if !func or func.empty?
719
+ lib = with_config(lib+'lib', lib)
720
+ checking_for checking_message("#{func}()", LIBARG%lib) do
721
+ if COMMON_LIBS.include?(lib)
722
+ true
723
+ else
724
+ libs = append_library($libs, lib)
725
+ if try_func(func, libs, headers, &b)
726
+ $libs = libs
727
+ true
728
+ else
729
+ false
730
+ end
731
+ end
732
+ end
733
+ end
734
+
735
+ # Returns whether or not the entry point +func+ can be found within the library
736
+ # +lib+ in one of the +paths+ specified, where +paths+ is an array of strings.
737
+ # If +func+ is nil , then the main() function is used as the entry point.
738
+ #
739
+ # If +lib+ is found, then the path it was found on is added to the list of
740
+ # library paths searched and linked against.
741
+ #
742
+ def find_library(lib, func, *paths, &b)
743
+ func = "main" if !func or func.empty?
744
+ lib = with_config(lib+'lib', lib)
745
+ paths = paths.collect {|path| path.split(File::PATH_SEPARATOR)}.flatten
746
+ checking_for "#{func}() in #{LIBARG%lib}" do
747
+ libpath = $LIBPATH
748
+ libs = append_library($libs, lib)
749
+ begin
750
+ until r = try_func(func, libs, &b) or paths.empty?
751
+ $LIBPATH = libpath | [paths.shift]
752
+ end
753
+ if r
754
+ $libs = libs
755
+ libpath = nil
756
+ end
757
+ ensure
758
+ $LIBPATH = libpath if libpath
759
+ end
760
+ r
761
+ end
762
+ end
763
+
764
+ # Returns whether or not the function +func+ can be found in the common
765
+ # header files, or within any +headers+ that you provide. If found, a
766
+ # macro is passed as a preprocessor constant to the compiler using the
767
+ # function name, in uppercase, prepended with 'HAVE_'.
768
+ #
769
+ # For example, if have_func('foo') returned true, then the HAVE_FOO
770
+ # preprocessor macro would be passed to the compiler.
771
+ #
772
+ def have_func(func, headers = nil, &b)
773
+ checking_for checking_message("#{func}()", headers) do
774
+ if try_func(func, $libs, headers, &b)
775
+ $defs.push(format("-DHAVE_%s", func.tr_cpp))
776
+ true
777
+ else
778
+ false
779
+ end
780
+ end
781
+ end
782
+
783
+ # Returns whether or not the variable +var+ can be found in the common
784
+ # header files, or within any +headers+ that you provide. If found, a
785
+ # macro is passed as a preprocessor constant to the compiler using the
786
+ # variable name, in uppercase, prepended with 'HAVE_'.
787
+ #
788
+ # For example, if have_var('foo') returned true, then the HAVE_FOO
789
+ # preprocessor macro would be passed to the compiler.
790
+ #
791
+ def have_var(var, headers = nil, &b)
792
+ checking_for checking_message(var, headers) do
793
+ if try_var(var, headers, &b)
794
+ $defs.push(format("-DHAVE_%s", var.tr_cpp))
795
+ true
796
+ else
797
+ false
798
+ end
799
+ end
800
+ end
801
+
802
+ # Returns whether or not the given +header+ file can be found on your system.
803
+ # If found, a macro is passed as a preprocessor constant to the compiler using
804
+ # the header file name, in uppercase, prepended with 'HAVE_'.
805
+ #
806
+ # For example, if have_header('foo.h') returned true, then the HAVE_FOO_H
807
+ # preprocessor macro would be passed to the compiler.
808
+ #
809
+ def have_header(header, &b)
810
+ checking_for header do
811
+ if try_cpp(cpp_include(header), &b)
812
+ $defs.push(format("-DHAVE_%s", header.tr("a-z./\055", "A-Z___")))
813
+ true
814
+ else
815
+ false
816
+ end
817
+ end
818
+ end
819
+
820
+ # Instructs mkmf to search for the given +header+ in any of the +paths+
821
+ # provided, and returns whether or not it was found in those paths.
822
+ #
823
+ # If the header is found then the path it was found on is added to the list
824
+ # of included directories that are sent to the compiler (via the -I switch).
825
+ #
826
+ def find_header(header, *paths)
827
+ message = checking_message(header, paths)
828
+ header = cpp_include(header)
829
+ checking_for message do
830
+ if try_cpp(header)
831
+ true
832
+ else
833
+ found = false
834
+ paths.each do |dir|
835
+ opt = "-I#{dir}".quote
836
+ if try_cpp(header, opt)
837
+ $INCFLAGS << " " << opt
838
+ found = true
839
+ break
840
+ end
841
+ end
842
+ found
843
+ end
844
+ end
845
+ end
846
+
847
+ # Returns whether or not the struct of type +type+ contains +member+. If
848
+ # it does not, or the struct type can't be found, then false is returned. You
849
+ # may optionally specify additional +headers+ in which to look for the struct
850
+ # (in addition to the common header files).
851
+ #
852
+ # If found, a macro is passed as a preprocessor constant to the compiler using
853
+ # the type name and the member name, in uppercase, prepended with 'HAVE_'.
854
+ #
855
+ # For example, if have_struct_member('struct foo', 'bar') returned true, then the
856
+ # HAVE_STRUCT_FOO_BAR preprocessor macro would be passed to the compiler.
857
+ #
858
+ # HAVE_ST_BAR is also defined for backward compatibility.
859
+ #
860
+ def have_struct_member(type, member, headers = nil, &b)
861
+ checking_for checking_message("#{type}.#{member}", headers) do
862
+ if try_compile(<<"SRC", &b)
863
+ #{cpp_include(headers)}
864
+ /*top*/
865
+ #{MAIN_DOES_NOTHING}
866
+ int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
867
+ SRC
868
+ $defs.push(format("-DHAVE_%s_%s", type.tr_cpp, member.tr_cpp))
869
+ $defs.push(format("-DHAVE_ST_%s", member.tr_cpp)) # backward compatibility
870
+ true
871
+ else
872
+ false
873
+ end
874
+ end
875
+ end
876
+
877
+ def try_type(type, headers = nil, opt = "", &b)
878
+ if try_compile(<<"SRC", opt, &b)
879
+ #{cpp_include(headers)}
880
+ /*top*/
881
+ typedef #{type} conftest_type;
882
+ int conftestval[sizeof(conftest_type)?1:-1];
883
+ SRC
884
+ $defs.push(format("-DHAVE_TYPE_%s", type.tr_cpp))
885
+ true
886
+ else
887
+ false
888
+ end
889
+ end
890
+
891
+ # Returns whether or not the static type +type+ is defined. You may
892
+ # optionally pass additional +headers+ to check against in addition to the
893
+ # common header files.
894
+ #
895
+ # You may also pass additional flags to +opt+ which are then passed along to
896
+ # the compiler.
897
+ #
898
+ # If found, a macro is passed as a preprocessor constant to the compiler using
899
+ # the type name, in uppercase, prepended with 'HAVE_TYPE_'.
900
+ #
901
+ # For example, if have_type('foo') returned true, then the HAVE_TYPE_FOO
902
+ # preprocessor macro would be passed to the compiler.
903
+ #
904
+ def have_type(type, headers = nil, opt = "", &b)
905
+ checking_for checking_message(type, headers, opt) do
906
+ try_type(type, headers, opt, &b)
907
+ end
908
+ end
909
+
910
+ # Returns where the static type +type+ is defined.
911
+ #
912
+ # You may also pass additional flags to +opt+ which are then passed along to
913
+ # the compiler.
914
+ #
915
+ # See also +have_type+.
916
+ #
917
+ def find_type(type, opt, *headers, &b)
918
+ opt ||= ""
919
+ fmt = "not found"
920
+ def fmt.%(x)
921
+ x ? x.respond_to?(:join) ? x.join(",") : x : self
922
+ end
923
+ checking_for checking_message(type, nil, opt), fmt do
924
+ headers.find do |h|
925
+ try_type(type, h, opt, &b)
926
+ end
927
+ end
928
+ end
929
+
930
+ def try_const(const, headers = nil, opt = "", &b)
931
+ const, type = *const
932
+ if try_compile(<<"SRC", opt, &b)
933
+ #{cpp_include(headers)}
934
+ /*top*/
935
+ typedef #{type || 'int'} conftest_type;
936
+ conftest_type conftestval = #{type ? '' : '(int)'}#{const};
937
+ SRC
938
+ $defs.push(format("-DHAVE_CONST_%s", const.tr_cpp))
939
+ true
940
+ else
941
+ false
942
+ end
943
+ end
944
+
945
+ # Returns whether or not the constant +const+ is defined. You may
946
+ # optionally pass the +type+ of +const+ as <code>[const, type]</code>,
947
+ # like as:
948
+ #
949
+ # have_const(%w[PTHREAD_MUTEX_INITIALIZER pthread_mutex_t], "pthread.h")
950
+ #
951
+ # You may also pass additional +headers+ to check against in addition
952
+ # to the common header files, and additional flags to +opt+ which are
953
+ # then passed along to the compiler.
954
+ #
955
+ # If found, a macro is passed as a preprocessor constant to the compiler using
956
+ # the type name, in uppercase, prepended with 'HAVE_CONST_'.
957
+ #
958
+ # For example, if have_const('foo') returned true, then the HAVE_CONST_FOO
959
+ # preprocessor macro would be passed to the compiler.
960
+ #
961
+ def have_const(const, headers = nil, opt = "", &b)
962
+ checking_for checking_message([*const].compact.join(' '), headers, opt) do
963
+ try_const(const, headers, opt, &b)
964
+ end
965
+ end
966
+
967
+ # Returns the size of the given +type+. You may optionally specify additional
968
+ # +headers+ to search in for the +type+.
969
+ #
970
+ # If found, a macro is passed as a preprocessor constant to the compiler using
971
+ # the type name, in uppercase, prepended with 'SIZEOF_', followed by the type
972
+ # name, followed by '=X' where 'X' is the actual size.
973
+ #
974
+ # For example, if check_sizeof('mystruct') returned 12, then the
975
+ # SIZEOF_MYSTRUCT=12 preprocessor macro would be passed to the compiler.
976
+ #
977
+ def check_sizeof(type, headers = nil, &b)
978
+ expr = "sizeof(#{type})"
979
+ fmt = "%d"
980
+ def fmt.%(x)
981
+ x ? super : "failed"
982
+ end
983
+ checking_for checking_message("size of #{type}", headers), fmt do
984
+ if size = try_constant(expr, headers, &b)
985
+ $defs.push(format("-DSIZEOF_%s=%d", type.tr_cpp, size))
986
+ size
987
+ end
988
+ end
989
+ end
990
+
991
+ # :stopdoc:
992
+
993
+ # Used internally by the what_type? method to determine if +type+ is a scalar
994
+ # pointer.
995
+ def scalar_ptr_type?(type, member = nil, headers = nil, &b)
996
+ try_compile(<<"SRC", &b) # pointer
997
+ #{cpp_include(headers)}
998
+ /*top*/
999
+ volatile #{type} conftestval;
1000
+ #{MAIN_DOES_NOTHING}
1001
+ int t() {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));}
1002
+ SRC
1003
+ end
1004
+
1005
+ # Used internally by the what_type? method to determine if +type+ is a scalar
1006
+ # pointer.
1007
+ def scalar_type?(type, member = nil, headers = nil, &b)
1008
+ try_compile(<<"SRC", &b) # pointer
1009
+ #{cpp_include(headers)}
1010
+ /*top*/
1011
+ volatile #{type} conftestval;
1012
+ #{MAIN_DOES_NOTHING}
1013
+ int t() {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
1014
+ SRC
1015
+ end
1016
+
1017
+ def what_type?(type, member = nil, headers = nil, &b)
1018
+ m = "#{type}"
1019
+ name = type
1020
+ if member
1021
+ m << "." << member
1022
+ name = "(((#{type} *)0)->#{member})"
1023
+ end
1024
+ fmt = "seems %s"
1025
+ def fmt.%(x)
1026
+ x ? super : "unknown"
1027
+ end
1028
+ checking_for checking_message(m, headers), fmt do
1029
+ if scalar_ptr_type?(type, member, headers, &b)
1030
+ if try_static_assert("sizeof(*#{name}) == 1", headers)
1031
+ "string"
1032
+ end
1033
+ elsif scalar_type?(type, member, headers, &b)
1034
+ if try_static_assert("sizeof(#{name}) > sizeof(long)", headers)
1035
+ "long long"
1036
+ elsif try_static_assert("sizeof(#{name}) > sizeof(int)", headers)
1037
+ "long"
1038
+ elsif try_static_assert("sizeof(#{name}) > sizeof(short)", headers)
1039
+ "int"
1040
+ elsif try_static_assert("sizeof(#{name}) > 1", headers)
1041
+ "short"
1042
+ else
1043
+ "char"
1044
+ end
1045
+ end
1046
+ end
1047
+ end
1048
+
1049
+ # This method is used internally by the find_executable method.
1050
+ #
1051
+ # Internal use only.
1052
+ #
1053
+ def find_executable0(bin, path = nil)
1054
+ ext = config_string('EXEEXT')
1055
+ if File.expand_path(bin) == bin
1056
+ return bin if File.executable?(bin)
1057
+ ext and File.executable?(file = bin + ext) and return file
1058
+ return nil
1059
+ end
1060
+ if path ||= ENV['PATH']
1061
+ path = path.split(File::PATH_SEPARATOR)
1062
+ else
1063
+ path = %w[/usr/local/bin /usr/ucb /usr/bin /bin]
1064
+ end
1065
+ file = nil
1066
+ path.each do |dir|
1067
+ return file if File.executable?(file = File.join(dir, bin))
1068
+ return file if ext and File.executable?(file << ext)
1069
+ end
1070
+ nil
1071
+ end
1072
+
1073
+ # :startdoc:
1074
+
1075
+ # Searches for the executable +bin+ on +path+. The default path is your
1076
+ # PATH environment variable. If that isn't defined, it will resort to
1077
+ # searching /usr/local/bin, /usr/ucb, /usr/bin and /bin.
1078
+ #
1079
+ # If found, it will return the full path, including the executable name,
1080
+ # of where it was found.
1081
+ #
1082
+ # Note that this method does not actually affect the generated Makefile.
1083
+ #
1084
+ def find_executable(bin, path = nil)
1085
+ checking_for checking_message(bin, path) do
1086
+ find_executable0(bin, path)
1087
+ end
1088
+ end
1089
+
1090
+ # :stopdoc:
1091
+
1092
+ def arg_config(config, default=nil, &block)
1093
+ $arg_config << [config, default]
1094
+ defaults = []
1095
+ if default
1096
+ defaults << default
1097
+ elsif !block
1098
+ defaults << nil
1099
+ end
1100
+ $configure_args.fetch(config.tr('_', '-'), *defaults, &block)
1101
+ end
1102
+
1103
+ # :startdoc:
1104
+
1105
+ # Tests for the presence of a --with-<tt>config</tt> or --without-<tt>config</tt>
1106
+ # option. Returns true if the with option is given, false if the without
1107
+ # option is given, and the default value otherwise.
1108
+ #
1109
+ # This can be useful for adding custom definitions, such as debug information.
1110
+ #
1111
+ # Example:
1112
+ #
1113
+ # if with_config("debug")
1114
+ # $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
1115
+ # end
1116
+ #
1117
+ def with_config(config, default=nil)
1118
+ config = config.sub(/^--with[-_]/, '')
1119
+ val = arg_config("--with-"+config) do
1120
+ if arg_config("--without-"+config)
1121
+ false
1122
+ elsif block_given?
1123
+ yield(config, default)
1124
+ else
1125
+ break default
1126
+ end
1127
+ end
1128
+ case val
1129
+ when "yes"
1130
+ true
1131
+ when "no"
1132
+ false
1133
+ else
1134
+ val
1135
+ end
1136
+ end
1137
+
1138
+ # Tests for the presence of an --enable-<tt>config</tt> or
1139
+ # --disable-<tt>config</tt> option. Returns true if the enable option is given,
1140
+ # false if the disable option is given, and the default value otherwise.
1141
+ #
1142
+ # This can be useful for adding custom definitions, such as debug information.
1143
+ #
1144
+ # Example:
1145
+ #
1146
+ # if enable_config("debug")
1147
+ # $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
1148
+ # end
1149
+ #
1150
+ def enable_config(config, default=nil)
1151
+ if arg_config("--enable-"+config)
1152
+ true
1153
+ elsif arg_config("--disable-"+config)
1154
+ false
1155
+ elsif block_given?
1156
+ yield(config, default)
1157
+ else
1158
+ return default
1159
+ end
1160
+ end
1161
+
1162
+ # Generates a header file consisting of the various macro definitions generated
1163
+ # by other methods such as have_func and have_header. These are then wrapped in
1164
+ # a custom #ifndef based on the +header+ file name, which defaults to
1165
+ # 'extconf.h'.
1166
+ #
1167
+ # For example:
1168
+ #
1169
+ # # extconf.rb
1170
+ # require 'mkmf'
1171
+ # have_func('realpath')
1172
+ # have_header('sys/utime.h')
1173
+ # create_header
1174
+ # create_makefile('foo')
1175
+ #
1176
+ # The above script would generate the following extconf.h file:
1177
+ #
1178
+ # #ifndef EXTCONF_H
1179
+ # #define EXTCONF_H
1180
+ # #define HAVE_REALPATH 1
1181
+ # #define HAVE_SYS_UTIME_H 1
1182
+ # #endif
1183
+ #
1184
+ # Given that the create_header method generates a file based on definitions
1185
+ # set earlier in your extconf.rb file, you will probably want to make this
1186
+ # one of the last methods you call in your script.
1187
+ #
1188
+ def create_header(header = "extconf.h")
1189
+ message "creating %s\n", header
1190
+ sym = header.tr("a-z./\055", "A-Z___")
1191
+ hdr = ["#ifndef #{sym}\n#define #{sym}\n"]
1192
+ for line in $defs
1193
+ case line
1194
+ when /^-D([^=]+)(?:=(.*))?/
1195
+ hdr << "#define #$1 #{$2 ? Shellwords.shellwords($2)[0] : 1}\n"
1196
+ when /^-U(.*)/
1197
+ hdr << "#undef #$1\n"
1198
+ end
1199
+ end
1200
+ hdr << "#endif\n"
1201
+ hdr = hdr.join
1202
+ unless (IO.read(header) == hdr rescue false)
1203
+ open(header, "w") do |hfile|
1204
+ hfile.write(hdr)
1205
+ end
1206
+ end
1207
+ $extconf_h = header
1208
+ end
1209
+
1210
+ # Sets a +target+ name that the user can then use to configure various 'with'
1211
+ # options with on the command line by using that name. For example, if the
1212
+ # target is set to "foo", then the user could use the --with-foo-dir command
1213
+ # line option.
1214
+ #
1215
+ # You may pass along additional 'include' or 'lib' defaults via the +idefault+
1216
+ # and +ldefault+ parameters, respectively.
1217
+ #
1218
+ # Note that dir_config only adds to the list of places to search for libraries
1219
+ # and include files. It does not link the libraries into your application.
1220
+ #
1221
+ def dir_config(target, idefault=nil, ldefault=nil)
1222
+ if dir = with_config(target + "-dir", (idefault unless ldefault))
1223
+ defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR)
1224
+ idefault = ldefault = nil
1225
+ end
1226
+
1227
+ idir = with_config(target + "-include", idefault)
1228
+ $arg_config.last[1] ||= "${#{target}-dir}/include"
1229
+ ldir = with_config(target + "-lib", ldefault)
1230
+ $arg_config.last[1] ||= "${#{target}-dir}/lib"
1231
+
1232
+ idirs = idir ? Array === idir ? idir : idir.split(File::PATH_SEPARATOR) : []
1233
+ if defaults
1234
+ idirs.concat(defaults.collect {|d| d + "/include"})
1235
+ idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR)
1236
+ end
1237
+ unless idirs.empty?
1238
+ idirs.collect! {|d| "-I" + d}
1239
+ idirs -= Shellwords.shellwords($CPPFLAGS)
1240
+ unless idirs.empty?
1241
+ $CPPFLAGS = (idirs.quote << $CPPFLAGS).join(" ")
1242
+ end
1243
+ end
1244
+
1245
+ ldirs = ldir ? Array === ldir ? ldir : ldir.split(File::PATH_SEPARATOR) : []
1246
+ if defaults
1247
+ ldirs.concat(defaults.collect {|d| d + "/lib"})
1248
+ ldir = ([ldir] + ldirs).compact.join(File::PATH_SEPARATOR)
1249
+ end
1250
+ $LIBPATH = ldirs | $LIBPATH
1251
+
1252
+ [idir, ldir]
1253
+ end
1254
+
1255
+ # :stopdoc:
1256
+
1257
+ # Handles meta information about installed libraries. Uses your platform's
1258
+ # pkg-config program if it has one.
1259
+ def pkg_config(pkg)
1260
+ if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig)
1261
+ # iff package specific config command is given
1262
+ get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
1263
+ elsif ($PKGCONFIG ||=
1264
+ (pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) &&
1265
+ find_executable0(pkgconfig) && pkgconfig) and
1266
+ system("#{$PKGCONFIG} --exists #{pkg}")
1267
+ # default to pkg-config command
1268
+ get = proc {|opt| `#{$PKGCONFIG} --#{opt} #{pkg}`.chomp}
1269
+ elsif find_executable0(pkgconfig = "#{pkg}-config")
1270
+ # default to package specific config command, as a last resort.
1271
+ get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp}
1272
+ end
1273
+ if get
1274
+ cflags = get['cflags']
1275
+ ldflags = get['libs']
1276
+ libs = get['libs-only-l']
1277
+ ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
1278
+ $CFLAGS += " " << cflags
1279
+ $LDFLAGS += " " << ldflags
1280
+ $libs += " " << libs
1281
+ Logging::message "package configuration for %s\n", pkg
1282
+ Logging::message "cflags: %s\nldflags: %s\nlibs: %s\n\n",
1283
+ cflags, ldflags, libs
1284
+ [cflags, ldflags, libs]
1285
+ else
1286
+ Logging::message "package configuration for %s is not found\n", pkg
1287
+ nil
1288
+ end
1289
+ end
1290
+
1291
+ def with_destdir(dir)
1292
+ dir = dir.sub($dest_prefix_pattern, '')
1293
+ /\A\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
1294
+ end
1295
+
1296
+ # Converts forward slashes to backslashes. Aimed at MS Windows.
1297
+ #
1298
+ # Internal use only.
1299
+ #
1300
+ def winsep(s)
1301
+ s.tr('/', '\\')
1302
+ end
1303
+
1304
+ # Converts native path to format acceptable in Makefile
1305
+ #
1306
+ # Internal use only.
1307
+ #
1308
+ if !CROSS_COMPILING
1309
+ case CONFIG['build_os']
1310
+ when 'mingw32'
1311
+ def mkintpath(path)
1312
+ # mingw uses make from msys and it needs special care
1313
+ # converts from C:\some\path to /C/some/path
1314
+ path = path.dup
1315
+ path.tr!('\\', '/')
1316
+ path.sub!(/\A([A-Za-z]):(?=\/)/, '/\1')
1317
+ path
1318
+ end
1319
+ end
1320
+ end
1321
+ unless defined?(mkintpath)
1322
+ def mkintpath(path)
1323
+ path
1324
+ end
1325
+ end
1326
+
1327
+ def configuration(srcdir)
1328
+ mk = []
1329
+ vpath = $VPATH.dup
1330
+ if !CROSS_COMPILING
1331
+ case CONFIG['build_os']
1332
+ when 'cygwin'
1333
+ if CONFIG['target_os'] != 'cygwin'
1334
+ vpath = vpath.map {|p| p.sub(/.*/, '$(shell cygpath -u \&)')}
1335
+ end
1336
+ end
1337
+ end
1338
+ CONFIG["hdrdir"] ||= $hdrdir
1339
+ mk << %{
1340
+ SHELL = /bin/sh
1341
+
1342
+ #### Start of system configuration section. ####
1343
+ #{"top_srcdir = " + $top_srcdir.sub(%r"\A#{Regexp.quote($topdir)}/", "$(topdir)/") if $extmk}
1344
+ srcdir = #{srcdir.gsub(/\$\((srcdir)\)|\$\{(srcdir)\}/) {mkintpath(CONFIG[$1||$2])}.quote}
1345
+ topdir = #{mkintpath($extmk ? CONFIG["topdir"] : $topdir).quote}
1346
+ hdrdir = #{mkintpath(CONFIG["hdrdir"]).quote}
1347
+ arch_hdrdir = #{$arch_hdrdir}
1348
+ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
1349
+ }
1350
+ if $extmk
1351
+ mk << "RUBYLIB = -\nRUBYOPT = -r$(top_srcdir)/ext/purelib.rb\n"
1352
+ end
1353
+ if destdir = CONFIG["prefix"][$dest_prefix_pattern, 1]
1354
+ mk << "\nDESTDIR = #{destdir}\n"
1355
+ end
1356
+ CONFIG.each do |key, var|
1357
+ next unless /prefix$/ =~ key
1358
+ mk << "#{key} = #{with_destdir(var)}\n"
1359
+ end
1360
+ CONFIG.each do |key, var|
1361
+ next if /^abs_/ =~ key
1362
+ next if /^(?:src|top|hdr)dir$/ =~ key
1363
+ next unless /dir$/ =~ key
1364
+ mk << "#{key} = #{with_destdir(var)}\n"
1365
+ end
1366
+ if !$extmk and !$configure_args.has_key?('--ruby') and
1367
+ sep = config_string('BUILD_FILE_SEPARATOR')
1368
+ sep = ":/=#{sep}"
1369
+ else
1370
+ sep = ""
1371
+ end
1372
+ possible_command = (proc {|s| s if /top_srcdir/ !~ s} unless $extmk)
1373
+ extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : $defs.join(" ") << " "
1374
+ mk << %{
1375
+ CC = #{CONFIG['CC']}
1376
+ CXX = #{CONFIG['CXX']}
1377
+ LIBRUBY = #{CONFIG['LIBRUBY']}
1378
+ LIBRUBY_A = #{CONFIG['LIBRUBY_A']}
1379
+ LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED
1380
+ LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC
1381
+ OUTFLAG = #{OUTFLAG}
1382
+ COUTFLAG = #{COUTFLAG}
1383
+
1384
+ RUBY_EXTCONF_H = #{$extconf_h}
1385
+ cflags = #{CONFIG['cflags']}
1386
+ optflags = #{CONFIG['optflags']}
1387
+ debugflags = #{CONFIG['debugflags']}
1388
+ warnflags = #{CONFIG['warnflags']}
1389
+ CFLAGS = #{$static ? '' : CONFIG['CCDLFLAGS']} #$CFLAGS #$ARCH_FLAG
1390
+ INCFLAGS = -I. #$INCFLAGS
1391
+ DEFS = #{CONFIG['DEFS']}
1392
+ CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
1393
+ CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
1394
+ ldflags = #{$LDFLAGS}
1395
+ dldflags = #{$DLDFLAGS}
1396
+ archflag = #{$ARCH_FLAG}
1397
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
1398
+ LDSHARED = #{CONFIG['LDSHARED']}
1399
+ LDSHAREDXX = #{config_string('LDSHAREDXX') || '$(LDSHARED)'}
1400
+ AR = #{CONFIG['AR']}
1401
+ EXEEXT = #{CONFIG['EXEEXT']}
1402
+
1403
+ RUBY_INSTALL_NAME = #{CONFIG['RUBY_INSTALL_NAME']}
1404
+ RUBY_SO_NAME = #{CONFIG['RUBY_SO_NAME']}
1405
+ arch = #{CONFIG['arch']}
1406
+ sitearch = #{CONFIG['sitearch']}
1407
+ ruby_version = #{RbConfig::CONFIG['ruby_version']}
1408
+ ruby = #{$ruby}
1409
+ RUBY = $(ruby#{sep})
1410
+ RM = #{config_string('RM', &possible_command) || '$(RUBY) -run -e rm -- -f'}
1411
+ RM_RF = #{'$(RUBY) -run -e rm -- -rf'}
1412
+ RMDIRS = #{config_string('RMDIRS', &possible_command) || '$(RUBY) -run -e rmdir -- -p'}
1413
+ MAKEDIRS = #{config_string('MAKEDIRS', &possible_command) || '@$(RUBY) -run -e mkdir -- -p'}
1414
+ INSTALL = #{config_string('INSTALL', &possible_command) || '@$(RUBY) -run -e install -- -vp'}
1415
+ INSTALL_PROG = #{config_string('INSTALL_PROG') || '$(INSTALL) -m 0755'}
1416
+ INSTALL_DATA = #{config_string('INSTALL_DATA') || '$(INSTALL) -m 0644'}
1417
+ COPY = #{config_string('CP', &possible_command) || '@$(RUBY) -run -e cp -- -v'}
1418
+
1419
+ #### End of system configuration section. ####
1420
+
1421
+ preload = #{defined?($preload) && $preload ? $preload.join(' ') : ''}
1422
+ }
1423
+ if $nmake == ?b
1424
+ mk.each do |x|
1425
+ x.gsub!(/^(MAKEDIRS|INSTALL_(?:PROG|DATA))+\s*=.*\n/) do
1426
+ "!ifndef " + $1 + "\n" +
1427
+ $& +
1428
+ "!endif\n"
1429
+ end
1430
+ end
1431
+ end
1432
+ mk
1433
+ end
1434
+ # :startdoc:
1435
+
1436
+ def dummy_makefile(srcdir)
1437
+ configuration(srcdir) << <<RULES << CLEANINGS
1438
+ CLEANFILES = #{$cleanfiles.join(' ')}
1439
+ DISTCLEANFILES = #{$distcleanfiles.join(' ')}
1440
+
1441
+ all install static install-so install-rb: Makefile
1442
+
1443
+ RULES
1444
+ end
1445
+
1446
+ def depend_rules(depend)
1447
+ suffixes = []
1448
+ depout = []
1449
+ cont = implicit = nil
1450
+ impconv = proc do
1451
+ COMPILE_RULES.each {|rule| depout << (rule % implicit[0]) << implicit[1]}
1452
+ implicit = nil
1453
+ end
1454
+ ruleconv = proc do |line|
1455
+ if implicit
1456
+ if /\A\t/ =~ line
1457
+ implicit[1] << line
1458
+ next
1459
+ else
1460
+ impconv[]
1461
+ end
1462
+ end
1463
+ if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
1464
+ suffixes << m[1] << m[2]
1465
+ implicit = [[m[1], m[2]], [m.post_match]]
1466
+ next
1467
+ elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
1468
+ line.gsub!(%r"(\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)") {$1 + RULE_SUBST % $2}
1469
+ end
1470
+ depout << line
1471
+ end
1472
+ depend.each_line do |line|
1473
+ line.gsub!(/\.o\b/, ".#{$OBJEXT}")
1474
+ line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h)
1475
+ line.gsub!(%r"\$\(hdrdir\)/(?!ruby(?![^:;/\s]))(?=[-\w]+\.h)", '\&ruby/')
1476
+ if $nmake && /\A\s*\$\(RM|COPY\)/ =~ line
1477
+ line.gsub!(%r"[-\w\./]{2,}"){$&.tr("/", "\\")}
1478
+ line.gsub!(/(\$\((?!RM|COPY)[^:)]+)(?=\))/, '\1:/=\\')
1479
+ end
1480
+ if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
1481
+ (cont ||= []) << line
1482
+ next
1483
+ elsif cont
1484
+ line = (cont << line).join
1485
+ cont = nil
1486
+ end
1487
+ ruleconv.call(line)
1488
+ end
1489
+ if cont
1490
+ ruleconv.call(cont.join)
1491
+ elsif implicit
1492
+ impconv.call
1493
+ end
1494
+ unless suffixes.empty?
1495
+ depout.unshift(".SUFFIXES: ." + suffixes.uniq.join(" .") + "\n\n")
1496
+ end
1497
+ depout.unshift("$(OBJS): $(RUBY_EXTCONF_H)\n\n") if $extconf_h
1498
+ depout.flatten!
1499
+ depout
1500
+ end
1501
+
1502
+ # Generates the Makefile for your extension, passing along any options and
1503
+ # preprocessor constants that you may have generated through other methods.
1504
+ #
1505
+ # The +target+ name should correspond the name of the global function name
1506
+ # defined within your C extension, minus the 'Init_'. For example, if your
1507
+ # C extension is defined as 'Init_foo', then your target would simply be 'foo'.
1508
+ #
1509
+ # If any '/' characters are present in the target name, only the last name
1510
+ # is interpreted as the target name, and the rest are considered toplevel
1511
+ # directory names, and the generated Makefile will be altered accordingly to
1512
+ # follow that directory structure.
1513
+ #
1514
+ # For example, if you pass 'test/foo' as a target name, your extension will
1515
+ # be installed under the 'test' directory. This means that in order to
1516
+ # load the file within a Ruby program later, that directory structure will
1517
+ # have to be followed, e.g. "require 'test/foo'".
1518
+ #
1519
+ # The +srcprefix+ should be used when your source files are not in the same
1520
+ # directory as your build script. This will not only eliminate the need for
1521
+ # you to manually copy the source files into the same directory as your build
1522
+ # script, but it also sets the proper +target_prefix+ in the generated
1523
+ # Makefile.
1524
+ #
1525
+ # Setting the +target_prefix+ will, in turn, install the generated binary in
1526
+ # a directory under your Config::CONFIG['sitearchdir'] that mimics your local
1527
+ # filesystem when you run 'make install'.
1528
+ #
1529
+ # For example, given the following file tree:
1530
+ #
1531
+ # ext/
1532
+ # extconf.rb
1533
+ # test/
1534
+ # foo.c
1535
+ #
1536
+ # And given the following code:
1537
+ #
1538
+ # create_makefile('test/foo', 'test')
1539
+ #
1540
+ # That will set the +target_prefix+ in the generated Makefile to 'test'. That,
1541
+ # in turn, will create the following file tree when installed via the
1542
+ # 'make install' command:
1543
+ #
1544
+ # /path/to/ruby/sitearchdir/test/foo.so
1545
+ #
1546
+ # It is recommended that you use this approach to generate your makefiles,
1547
+ # instead of copying files around manually, because some third party
1548
+ # libraries may depend on the +target_prefix+ being set properly.
1549
+ #
1550
+ # The +srcprefix+ argument can be used to override the default source
1551
+ # directory, i.e. the current directory . It is included as part of the VPATH
1552
+ # and added to the list of INCFLAGS.
1553
+ #
1554
+ def create_makefile(target, srcprefix = nil)
1555
+ $target = target
1556
+ libpath = $DEFLIBPATH|$LIBPATH
1557
+ message "creating Makefile\n"
1558
+ rm_f "conftest*"
1559
+ if CONFIG["DLEXT"] == $OBJEXT
1560
+ for lib in libs = $libs.split
1561
+ lib.sub!(/-l(.*)/, %%"lib\\1.#{$LIBEXT}"%)
1562
+ end
1563
+ $defs.push(format("-DEXTLIB='%s'", libs.join(",")))
1564
+ end
1565
+
1566
+ if target.include?('/')
1567
+ target_prefix, target = File.split(target)
1568
+ target_prefix[0,0] = '/'
1569
+ else
1570
+ target_prefix = ""
1571
+ end
1572
+
1573
+ srcprefix ||= '$(srcdir)'
1574
+ RbConfig::expand(srcdir = srcprefix.dup)
1575
+
1576
+ if not $objs
1577
+ $objs = []
1578
+ srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
1579
+ for f in srcs
1580
+ obj = File.basename(f, ".*") << ".o"
1581
+ $objs.push(obj) unless $objs.index(obj)
1582
+ end
1583
+ elsif !(srcs = $srcs)
1584
+ srcs = $objs.collect {|o| o.sub(/\.o\z/, '.c')}
1585
+ end
1586
+ $srcs = srcs
1587
+ for i in $objs
1588
+ i.sub!(/\.o\z/, ".#{$OBJEXT}")
1589
+ end
1590
+ $objs = $objs.join(" ")
1591
+
1592
+ target = nil if $objs == ""
1593
+
1594
+ if target and EXPORT_PREFIX
1595
+ if File.exist?(File.join(srcdir, target + '.def'))
1596
+ deffile = "$(srcdir)/$(TARGET).def"
1597
+ unless EXPORT_PREFIX.empty?
1598
+ makedef = %{-pe "$_.sub!(/^(?=\\w)/,'#{EXPORT_PREFIX}') unless 1../^EXPORTS$/i"}
1599
+ end
1600
+ else
1601
+ makedef = %{-e "puts 'EXPORTS', '#{EXPORT_PREFIX}Init_$(TARGET)'"}
1602
+ end
1603
+ if makedef
1604
+ $distcleanfiles << '$(DEFFILE)'
1605
+ origdef = deffile
1606
+ deffile = "$(TARGET)-$(arch).def"
1607
+ end
1608
+ end
1609
+ origdef ||= ''
1610
+
1611
+ if $extout and $INSTALLFILES
1612
+ $cleanfiles.concat($INSTALLFILES.collect {|files, dir|File.join(dir, files.sub(/\A\.\//, ''))})
1613
+ $distcleandirs.concat($INSTALLFILES.collect {|files, dir| dir})
1614
+ end
1615
+
1616
+ if $extmk and not $extconf_h
1617
+ create_header
1618
+ end
1619
+
1620
+ libpath = libpathflag(libpath)
1621
+
1622
+ dllib = target ? "$(TARGET).#{CONFIG['DLEXT']}" : ""
1623
+ staticlib = target ? "$(TARGET).#$LIBEXT" : ""
1624
+ mfile = open("Makefile", "wb")
1625
+ mfile.print(*configuration(srcprefix))
1626
+ mfile.print "
1627
+ libpath = #{($DEFLIBPATH|$LIBPATH).join(" ")}
1628
+ LIBPATH = #{libpath}
1629
+ DEFFILE = #{deffile}
1630
+
1631
+ CLEANFILES = #{$cleanfiles.join(' ')}
1632
+ DISTCLEANFILES = #{$distcleanfiles.join(' ')}
1633
+ DISTCLEANDIRS = #{$distcleandirs.join(' ')}
1634
+
1635
+ extout = #{$extout}
1636
+ extout_prefix = #{$extout_prefix}
1637
+ target_prefix = #{target_prefix}
1638
+ LOCAL_LIBS = #{$LOCAL_LIBS}
1639
+ LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
1640
+ SRCS = #{srcs.collect(&File.method(:basename)).join(' ')}
1641
+ OBJS = #{$objs}
1642
+ TARGET = #{target}
1643
+ DLLIB = #{dllib}
1644
+ EXTSTATIC = #{$static || ""}
1645
+ STATIC_LIB = #{staticlib unless $static.nil?}
1646
+ #{!$extout && defined?($installed_list) ? "INSTALLED_LIST = #{$installed_list}\n" : ""}
1647
+ " #"
1648
+ # TODO: fixme
1649
+ install_dirs.each {|d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
1650
+ n = ($extout ? '$(RUBYARCHDIR)/' : '') + '$(TARGET)'
1651
+ mfile.print "
1652
+ TARGET_SO = #{($extout ? '$(RUBYARCHDIR)/' : '')}$(DLLIB)
1653
+ CLEANLIBS = #{n}.#{CONFIG['DLEXT']} #{config_string('cleanlibs') {|t| t.gsub(/\$\*/) {n}}}
1654
+ CLEANOBJS = *.#{$OBJEXT} #{config_string('cleanobjs') {|t| t.gsub(/\$\*/, '$(TARGET)')}} *.bak
1655
+
1656
+ all: #{$extout ? "install" : target ? "$(DLLIB)" : "Makefile"}
1657
+ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
1658
+ "
1659
+ mfile.print CLEANINGS
1660
+ fsep = config_string('BUILD_FILE_SEPARATOR') {|s| s unless s == "/"}
1661
+ if fsep
1662
+ sep = ":/=#{fsep}"
1663
+ fseprepl = proc {|s|
1664
+ s = s.gsub("/", fsep)
1665
+ s = s.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
1666
+ s = s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
1667
+ }
1668
+ else
1669
+ fseprepl = proc {|s| s}
1670
+ sep = ""
1671
+ end
1672
+ dirs = []
1673
+ mfile.print "install: install-so install-rb\n\n"
1674
+ sodir = (dir = "$(RUBYARCHDIR)").dup
1675
+ mfile.print("install-so: ")
1676
+ if target
1677
+ f = "$(DLLIB)"
1678
+ dest = "#{dir}/#{f}"
1679
+ mfile.puts dir, "install-so: #{dest}"
1680
+ if $extout
1681
+ mfile.print "clean-so::\n"
1682
+ mfile.print "\t@-$(RM) #{fseprepl[dest]}\n"
1683
+ mfile.print "\t@-$(RMDIRS) #{fseprepl[dir]}\n"
1684
+ else
1685
+ mfile.print "#{dest}: #{f}\n"
1686
+ mfile.print "\t$(INSTALL_PROG) #{fseprepl[f]} #{fseprepl[dir]}\n"
1687
+ if defined?($installed_list)
1688
+ mfile.print "\t@echo #{dir}/#{File.basename(f)}>>$(INSTALLED_LIST)\n"
1689
+ end
1690
+ end
1691
+ else
1692
+ mfile.puts "Makefile"
1693
+ end
1694
+ mfile.print("install-rb: pre-install-rb install-rb-default\n")
1695
+ mfile.print("install-rb-default: pre-install-rb-default\n")
1696
+ mfile.print("pre-install-rb: Makefile\n")
1697
+ mfile.print("pre-install-rb-default: Makefile\n")
1698
+ for sfx, i in [["-default", [["lib/**/*.rb", "$(RUBYLIBDIR)", "lib"]]], ["", $INSTALLFILES]]
1699
+ files = install_files(mfile, i, nil, srcprefix) or next
1700
+ for dir, *files in files
1701
+ unless dirs.include?(dir)
1702
+ dirs << dir
1703
+ mfile.print "pre-install-rb#{sfx}: #{dir}\n"
1704
+ end
1705
+ for f in files
1706
+ dest = "#{dir}/#{File.basename(f)}"
1707
+ mfile.print("install-rb#{sfx}: #{dest}\n")
1708
+ mfile.print("#{dest}: #{f}\n")
1709
+ mfile.print("\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ")
1710
+ mfile.print("#{fseprepl[f]} $(@D#{sep})\n")
1711
+ if defined?($installed_list) and !$extout
1712
+ mfile.print("\t@echo #{dest}>>$(INSTALLED_LIST)\n")
1713
+ end
1714
+ if $extout
1715
+ mfile.print("clean-rb#{sfx}::\n")
1716
+ mfile.print("\t@-$(RM) #{fseprepl[dest]}\n")
1717
+ end
1718
+ end
1719
+ end
1720
+ if $extout
1721
+ dirs.uniq!
1722
+ dirs.reverse!
1723
+ unless dirs.empty?
1724
+ mfile.print("clean-rb#{sfx}::\n")
1725
+ for dir in dirs
1726
+ mfile.print("\t@-$(RMDIRS) #{fseprepl[dir]}\n")
1727
+ end
1728
+ end
1729
+ end
1730
+ end
1731
+ dirs.unshift(sodir) if target and !dirs.include?(sodir)
1732
+ dirs.each {|d| mfile.print "#{d}:\n\t$(MAKEDIRS) $@\n"}
1733
+
1734
+ mfile.print <<-SITEINSTALL
1735
+
1736
+ site-install: site-install-so site-install-rb
1737
+ site-install-so: install-so
1738
+ site-install-rb: install-rb
1739
+
1740
+ SITEINSTALL
1741
+
1742
+ return unless target
1743
+
1744
+ mfile.puts SRC_EXT.collect {|ext| ".path.#{ext} = $(VPATH)"} if $nmake == ?b
1745
+ mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n"
1746
+ mfile.print "\n"
1747
+
1748
+ CXX_EXT.each do |ext|
1749
+ COMPILE_RULES.each do |rule|
1750
+ mfile.printf(rule, ext, $OBJEXT)
1751
+ mfile.printf("\n\t%s\n\n", COMPILE_CXX)
1752
+ end
1753
+ end
1754
+ %w[c].each do |ext|
1755
+ COMPILE_RULES.each do |rule|
1756
+ mfile.printf(rule, ext, $OBJEXT)
1757
+ mfile.printf("\n\t%s\n\n", COMPILE_C)
1758
+ end
1759
+ end
1760
+
1761
+ mfile.print "$(RUBYARCHDIR)/" if $extout
1762
+ mfile.print "$(DLLIB): "
1763
+ mfile.print "$(DEFFILE) " if makedef
1764
+ mfile.print "$(OBJS) Makefile\n"
1765
+ mfile.print "\t@-$(RM) $(@#{sep})\n"
1766
+ mfile.print "\t@-$(MAKEDIRS) $(@D)\n" if $extout
1767
+ link_so = LINK_SO.gsub(/^/, "\t")
1768
+ if srcs.any?(&%r"\.(?:#{CXX_EXT.join('|')})\z".method(:===))
1769
+ link_so = link_so.sub(/\bLDSHARED\b/, '\&XX')
1770
+ end
1771
+ mfile.print link_so, "\n\n"
1772
+ unless $static.nil?
1773
+ mfile.print "$(STATIC_LIB): $(OBJS)\n\t@-$(RM) $(@#{sep})\n\t"
1774
+ mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)"
1775
+ config_string('RANLIB') do |ranlib|
1776
+ mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true"
1777
+ end
1778
+ end
1779
+ mfile.print "\n\n"
1780
+ if makedef
1781
+ mfile.print "$(DEFFILE): #{origdef}\n"
1782
+ mfile.print "\t$(RUBY) #{makedef} #{origdef} > $@\n\n"
1783
+ end
1784
+
1785
+ depend = File.join(srcdir, "depend")
1786
+ if File.exist?(depend)
1787
+ mfile.print("###\n", *depend_rules(File.read(depend)))
1788
+ else
1789
+ headers = %w[$(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h]
1790
+ if RULE_SUBST
1791
+ headers.each {|h| h.sub!(/.*/, &RULE_SUBST.method(:%))}
1792
+ end
1793
+ headers << $config_h
1794
+ headers << '$(RUBY_EXTCONF_H)' if $extconf_h
1795
+ mfile.print "$(OBJS): ", headers.join(' '), "\n"
1796
+ end
1797
+
1798
+ $makefile_created = true
1799
+ ensure
1800
+ mfile.close if mfile
1801
+ end
1802
+
1803
+ # :stopdoc:
1804
+
1805
+ def init_mkmf(config = CONFIG)
1806
+ $makefile_created = false
1807
+ $arg_config = []
1808
+ $enable_shared = config['ENABLE_SHARED'] == 'yes'
1809
+ $defs = []
1810
+ $extconf_h = nil
1811
+ $CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup
1812
+ $ARCH_FLAG = with_config("arch_flag", arg_config("ARCH_FLAG", config["ARCH_FLAG"])).dup
1813
+ $CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup
1814
+ $LDFLAGS = with_config("ldflags", arg_config("LDFLAGS", config["LDFLAGS"])).dup
1815
+ $INCFLAGS = "-I$(arch_hdrdir)"
1816
+ $INCFLAGS << " -I$(hdrdir)/ruby/backward" unless $extmk
1817
+ $INCFLAGS << " -I$(hdrdir) -I$(srcdir)"
1818
+ $DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
1819
+ $LIBEXT = config['LIBEXT'].dup
1820
+ $OBJEXT = config["OBJEXT"].dup
1821
+ $LIBS = "#{config['LIBS']} #{config['DLDLIBS']}"
1822
+ $LIBRUBYARG = ""
1823
+ $LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
1824
+ $LIBRUBYARG_SHARED = config['LIBRUBYARG_SHARED']
1825
+ $DEFLIBPATH = $extmk ? ["$(topdir)"] : CROSS_COMPILING ? [] : ["$(libdir)"]
1826
+ $DEFLIBPATH.unshift(".")
1827
+ $LIBPATH = []
1828
+ $INSTALLFILES = []
1829
+ $NONINSTALLFILES = [/~\z/, /\A#.*#\z/, /\A\.#/, /\.bak\z/i, /\.orig\z/, /\.rej\z/, /\.l[ao]\z/, /\.o\z/]
1830
+ $VPATH = %w[$(srcdir) $(arch_hdrdir)/ruby $(hdrdir)/ruby]
1831
+
1832
+ $objs = nil
1833
+ $srcs = nil
1834
+ $libs = ""
1835
+ if $enable_shared or RbConfig.expand(config["LIBRUBY"].dup) != RbConfig.expand(config["LIBRUBY_A"].dup)
1836
+ $LIBRUBYARG = config['LIBRUBYARG']
1837
+ end
1838
+
1839
+ $LOCAL_LIBS = ""
1840
+
1841
+ $cleanfiles = config_string('CLEANFILES') {|s| Shellwords.shellwords(s)} || []
1842
+ $cleanfiles << "mkmf.log"
1843
+ $distcleanfiles = config_string('DISTCLEANFILES') {|s| Shellwords.shellwords(s)} || []
1844
+ $distcleandirs = config_string('DISTCLEANDIRS') {|s| Shellwords.shellwords(s)} || []
1845
+
1846
+ $extout ||= nil
1847
+ $extout_prefix ||= nil
1848
+
1849
+ $arg_config.clear
1850
+ dir_config("opt")
1851
+ end
1852
+
1853
+ FailedMessage = <<MESSAGE
1854
+ Could not create Makefile due to some reason, probably lack of
1855
+ necessary libraries and/or headers. Check the mkmf.log file for more
1856
+ details. You may need configuration options.
1857
+
1858
+ Provided configuration options:
1859
+ MESSAGE
1860
+
1861
+ # Returns whether or not the Makefile was successfully generated. If not,
1862
+ # the script will abort with an error message.
1863
+ #
1864
+ # Internal use only.
1865
+ #
1866
+ def mkmf_failed(path)
1867
+ unless $makefile_created or File.exist?("Makefile")
1868
+ opts = $arg_config.collect {|t, n| "\t#{t}#{n ? "=#{n}" : ""}\n"}
1869
+ abort "*** #{path} failed ***\n" + FailedMessage + opts.join
1870
+ end
1871
+ end
1872
+
1873
+ # :startdoc:
1874
+
1875
+ init_mkmf
1876
+
1877
+ $make = with_config("make-prog", ENV["MAKE"] || "make")
1878
+ make, = Shellwords.shellwords($make)
1879
+ $nmake = nil
1880
+ case
1881
+ when $mswin
1882
+ $nmake = ?m if /nmake/i =~ make
1883
+ when $bccwin
1884
+ $nmake = ?b if /Borland/i =~ `#{make} -h`
1885
+ end
1886
+
1887
+ RbConfig::CONFIG["srcdir"] = CONFIG["srcdir"] =
1888
+ $srcdir = arg_config("--srcdir", File.dirname($0))
1889
+ $configure_args["--topsrcdir"] ||= $srcdir
1890
+ if $curdir = arg_config("--curdir")
1891
+ RbConfig.expand(curdir = $curdir.dup)
1892
+ else
1893
+ curdir = $curdir = "."
1894
+ end
1895
+ unless File.expand_path(RbConfig::CONFIG["topdir"]) == File.expand_path(curdir)
1896
+ CONFIG["topdir"] = $curdir
1897
+ RbConfig::CONFIG["topdir"] = curdir
1898
+ end
1899
+ $configure_args["--topdir"] ||= $curdir
1900
+ $ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"]))
1901
+
1902
+ split = Shellwords.method(:shellwords).to_proc
1903
+
1904
+ EXPORT_PREFIX = config_string('EXPORT_PREFIX') {|s| s.strip}
1905
+
1906
+ hdr = ['#include "ruby.h"' "\n"]
1907
+ config_string('COMMON_MACROS') do |s|
1908
+ Shellwords.shellwords(s).each do |w|
1909
+ hdr << "#define " + w.split(/=/, 2).join(" ")
1910
+ end
1911
+ end
1912
+ config_string('COMMON_HEADERS') do |s|
1913
+ Shellwords.shellwords(s).each {|w| hdr << "#include <#{w}>"}
1914
+ end
1915
+ COMMON_HEADERS = hdr.join("\n")
1916
+ COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
1917
+
1918
+ COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]
1919
+ RULE_SUBST = config_string('RULE_SUBST')
1920
+ COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<'
1921
+ COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<'
1922
+ TRY_LINK = config_string('TRY_LINK') ||
1923
+ "$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
1924
+ "$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
1925
+ LINK_SO = config_string('LINK_SO') ||
1926
+ if CONFIG["DLEXT"] == $OBJEXT
1927
+ "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
1928
+ else
1929
+ "$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \
1930
+ "$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)"
1931
+ end
1932
+ LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'
1933
+ RPATHFLAG = config_string('RPATHFLAG') || ''
1934
+ LIBARG = config_string('LIBARG') || '-l%s'
1935
+ MAIN_DOES_NOTHING = config_string('MAIN_DOES_NOTHING') || 'int main() {return 0;}'
1936
+
1937
+ sep = config_string('BUILD_FILE_SEPARATOR') {|s| ":/=#{s}" if sep != "/"} || ""
1938
+ CLEANINGS = "
1939
+ clean-rb-default::
1940
+ clean-rb::
1941
+ clean-so::
1942
+ clean: clean-so clean-rb-default clean-rb
1943
+ \t\t@-$(RM) $(CLEANLIBS#{sep}) $(CLEANOBJS#{sep}) $(CLEANFILES#{sep})
1944
+
1945
+ distclean-rb-default::
1946
+ distclean-rb::
1947
+ distclean-so::
1948
+ distclean: clean distclean-so distclean-rb-default distclean-rb
1949
+ \t\t@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
1950
+ \t\t@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
1951
+ \t\t@-$(RMDIRS) $(DISTCLEANDIRS#{sep})
1952
+
1953
+ realclean: distclean
1954
+ "
1955
+
1956
+ if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0)
1957
+ END {mkmf_failed($0)}
1958
+ end