Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

committing experimental branch content

  • Loading branch information...
commit 9c1d230712fb7eb484043bacd579c87199f0dc73 1 parent 285ddb2
Laurent Sansonetti authored
Showing with 34,584 additions and 0 deletions.
  1. +56 −0 COPYING
  2. +340 −0 GPL
  3. +301 −0 LEGAL
  4. +504 −0 LGPL
  5. +43 −0 README
  6. +727 −0 Rakefile
  7. +64 −0 TODO
  8. +3,642 −0 array.c
  9. +329 −0 auto_zone.h
  10. +21 −0 b.rb
  11. +64 −0 bench_roxor.rb
  12. +15 −0 benchmark/bm_app_answer.rb
  13. +26 −0 benchmark/bm_app_erb.rb
  14. +11 −0 benchmark/bm_app_factorial.rb
  15. +10 −0 benchmark/bm_app_fib.rb
  16. +23 −0 benchmark/bm_app_mandelbrot.rb
  17. +51 −0 benchmark/bm_app_mergesort.rb
  18. +259 −0 benchmark/bm_app_pentomino.rb
  19. +23 −0 benchmark/bm_app_pi.rb
  20. +8 −0 benchmark/bm_app_raise.rb
  21. +5 −0 benchmark/bm_app_strconcat.rb
  22. +13 −0 benchmark/bm_app_tak.rb
  23. +10 −0 benchmark/bm_app_tarai.rb
  24. +8 −0 benchmark/bm_app_uri.rb
  25. +13 −0 benchmark/bm_io_file_create.rb
  26. +15 −0 benchmark/bm_io_file_read.rb
  27. +14 −0 benchmark/bm_io_file_write.rb
  28. +14 −0 benchmark/bm_loop_generator.rb
  29. +1 −0  benchmark/bm_loop_times.rb
  30. +4 −0 benchmark/bm_loop_whileloop.rb
  31. +4 −0 benchmark/bm_loop_whileloop2.rb
  32. +17 −0 benchmark/bm_so_ackermann.rb
  33. +23 −0 benchmark/bm_so_array.rb
  34. +57 −0 benchmark/bm_so_binary_trees.rb
  35. +18 −0 benchmark/bm_so_concatenate.rb
  36. +19 −0 benchmark/bm_so_count_words.rb
  37. +61 −0 benchmark/bm_so_exception.rb
  38. +45 −0 benchmark/bm_so_fannkuch.rb
  39. +83 −0 benchmark/bm_so_fasta.rb
  40. +48 −0 benchmark/bm_so_k_nucleotide.rb
  41. +47 −0 benchmark/bm_so_lists.rb
  42. +57 −0 benchmark/bm_so_mandelbrot.rb
  43. +48 −0 benchmark/bm_so_matrix.rb
  44. +564 −0 benchmark/bm_so_meteor_contest.rb
  45. +148 −0 benchmark/bm_so_nbody.rb
  46. +24 −0 benchmark/bm_so_nested_loop.rb
  47. +35 −0 benchmark/bm_so_nsieve.rb
  48. +42 −0 benchmark/bm_so_nsieve_bits.rb
  49. +56 −0 benchmark/bm_so_object.rb
  50. +31 −0 benchmark/bm_so_partial_sums.rb
  51. +92 −0 benchmark/bm_so_pidigits.rb
  52. +28 −0 benchmark/bm_so_random.rb
  53. +30 −0 benchmark/bm_so_reverse_complement.rb
  54. +24 −0 benchmark/bm_so_sieve.rb
  55. +50 −0 benchmark/bm_so_spectralnorm.rb
  56. +10 −0 benchmark/bm_vm1_block.rb
  57. +8 −0 benchmark/bm_vm1_const.rb
  58. +11 −0 benchmark/bm_vm1_ensure.rb
  59. +8 −0 benchmark/bm_vm1_ivar.rb
  60. +6 −0 benchmark/bm_vm1_ivar_set.rb
  61. +9 −0 benchmark/bm_vm1_length.rb
  62. +8 −0 benchmark/bm_vm1_neq.rb
  63. +7 −0 benchmark/bm_vm1_not.rb
  64. +7 −0 benchmark/bm_vm1_rescue.rb
  65. +9 −0 benchmark/bm_vm1_simplereturn.rb
  66. +8 −0 benchmark/bm_vm1_swap.rb
  67. +5 −0 benchmark/bm_vm2_array.rb
  68. +14 −0 benchmark/bm_vm2_case.rb
  69. +6 −0 benchmark/bm_vm2_eval.rb
  70. +9 −0 benchmark/bm_vm2_method.rb
  71. +9 −0 benchmark/bm_vm2_mutex.rb
  72. +20 −0 benchmark/bm_vm2_poly_method.rb
  73. +20 −0 benchmark/bm_vm2_poly_method_ov.rb
  74. +14 −0 benchmark/bm_vm2_proc.rb
  75. +6 −0 benchmark/bm_vm2_regexp.rb
  76. +12 −0 benchmark/bm_vm2_send.rb
  77. +20 −0 benchmark/bm_vm2_super.rb
  78. +8 −0 benchmark/bm_vm2_unif1.rb
  79. +20 −0 benchmark/bm_vm2_zsuper.rb
  80. +7 −0 benchmark/bm_vm3_gc.rb
  81. +6 −0 benchmark/bm_vm3_thread_create_join.rb
  82. +18 −0 benchmark/bm_vm3_thread_mutex.rb
  83. +9 −0 benchmark/bmx_temp.rb
  84. +253 −0 benchmark/driver.rb
  85. +19 −0 benchmark/make_fasta_output.rb
  86. +11 −0 benchmark/other-lang/ack.pl
  87. +16 −0 benchmark/other-lang/ack.py
  88. +12 −0 benchmark/other-lang/ack.rb
  89. +7 −0 benchmark/other-lang/ack.scm
  90. +66 −0 benchmark/other-lang/eval.rb
  91. +13 −0 benchmark/other-lang/fact.pl
  92. +18 −0 benchmark/other-lang/fact.py
  93. +13 −0 benchmark/other-lang/fact.rb
  94. +8 −0 benchmark/other-lang/fact.scm
  95. +11 −0 benchmark/other-lang/fib.pl
  96. +7 −0 benchmark/other-lang/fib.py
  97. +9 −0 benchmark/other-lang/fib.rb
  98. +7 −0 benchmark/other-lang/fib.scm
  99. +3 −0  benchmark/other-lang/loop.pl
  100. +2 −0  benchmark/other-lang/loop.py
  101. +4 −0 benchmark/other-lang/loop.rb
  102. +1 −0  benchmark/other-lang/loop.scm
  103. +1 −0  benchmark/other-lang/loop2.rb
  104. +11 −0 benchmark/other-lang/tak.pl
  105. +8 −0 benchmark/other-lang/tak.py
  106. +13 −0 benchmark/other-lang/tak.rb
  107. +10 −0 benchmark/other-lang/tak.scm
  108. +15 −0 benchmark/prepare_so_count_words.rb
  109. +2 −0  benchmark/prepare_so_k_nucleotide.rb
  110. +2 −0  benchmark/prepare_so_reverse_complement.rb
  111. +81 −0 benchmark/report.rb
  112. +127 −0 benchmark/run.rb
  113. +29 −0 benchmark/runc.rb
  114. +25 −0 benchmark/wc.input.base
  115. +2,856 −0 bignum.c
  116. +141 −0 bin/erb
  117. +28 −0 bin/gem
  118. +31 −0 bin/hotcocoa
  119. +20 −0 bin/irb
  120. +31 −0 bin/rake
  121. +194 −0 bin/rb_nibtool
  122. +22 −0 bin/rdoc
  123. +6 −0 bin/ri
  124. +5 −0 bin/testrb
  125. +25 −0 bootstraptest/pending.rb
  126. +334 −0 bootstraptest/runner.rb
  127. +36 −0 bootstraptest/test_attr.rb
  128. +52 −0 bootstraptest/test_autoload.rb
  129. +549 −0 bootstraptest/test_block.rb
  130. +217 −0 bootstraptest/test_class.rb
  131. +284 −0 bootstraptest/test_eval.rb
  132. +404 −0 bootstraptest/test_exception.rb
  133. +1 −0  bootstraptest/test_flip.rb
  134. +491 −0 bootstraptest/test_flow.rb
  135. +10 −0 bootstraptest/test_fork.rb
  136. +75 −0 bootstraptest/test_io.rb
  137. +261 −0 bootstraptest/test_jump.rb
  138. +107 −0 bootstraptest/test_knownbug.rb
  139. +194 −0 bootstraptest/test_literal.rb
  140. +15 −0 bootstraptest/test_load.rb
  141. +5 −0 bootstraptest/test_marshal.rb
  142. +183 −0 bootstraptest/test_massign.rb
  143. +1,094 −0 bootstraptest/test_method.rb
  144. +44 −0 bootstraptest/test_objectspace.rb
  145. +261 −0 bootstraptest/test_proc.rb
  146. +5 −0 bootstraptest/test_struct.rb
  147. +819 −0 bootstraptest/test_syntax.rb
  148. +270 −0 bootstraptest/test_thread.rb
  149. +1,346 −0 bs.c
  150. +262 −0 bs.h
  151. +202 −0 bs_lex.h
  152. +1,273 −0 class.c
  153. +219 −0 compar.c
  154. +1,547 −0 complex.c
  155. +786 −0 cont.c
  156. +4 −0 data/hotcocoa_template/Rakefile
  157. +8 −0 data/hotcocoa_template/config/build.yml
  158. +44 −0 data/hotcocoa_template/lib/application.rb
  159. +32 −0 data/hotcocoa_template/lib/menu.rb
  160. BIN  data/hotcocoa_template/resources/HotCocoa.icns
  161. +1,956 −0 dir.c
  162. +59 −0 distruby.rb
  163. +1,777 −0 dln.c
  164. +41 −0 dln.h
  165. +2 −0  dmydln.c
  166. +2 −0  dmyencoding.c
  167. +4 −0 dmyext.c
  168. 0  dmytranscode.c
  169. +8 −0 dtrace.d
  170. +85 −0 dtrace.h
  171. +49 −0 enc/Makefile.in
  172. +93 −0 enc/ascii.c
  173. +216 −0 enc/big5.c
  174. +219 −0 enc/cp949.c
  175. +61 −0 enc/depend
  176. +388 −0 enc/euc_jp.c
  177. +192 −0 enc/euc_kr.c
  178. +234 −0 enc/euc_tw.c
  179. +584 −0 enc/gb18030.c
  180. +13 −0 enc/gb2312.c
  181. +222 −0 enc/gbk.c
  182. +6 −0 enc/iso_2022_jp.h
  183. +285 −0 enc/iso_8859_1.c
  184. +244 −0 enc/iso_8859_10.c
  185. +111 −0 enc/iso_8859_11.c
  186. +243 −0 enc/iso_8859_13.c
  187. +246 −0 enc/iso_8859_14.c
  188. +240 −0 enc/iso_8859_15.c
  189. +242 −0 enc/iso_8859_16.c
  190. +250 −0 enc/iso_8859_2.c
  191. +240 −0 enc/iso_8859_3.c
  192. +242 −0 enc/iso_8859_4.c
  193. +230 −0 enc/iso_8859_5.c
  194. +107 −0 enc/iso_8859_6.c
  195. +237 −0 enc/iso_8859_7.c
  196. +107 −0 enc/iso_8859_8.c
  197. +243 −0 enc/iso_8859_9.c
  198. +219 −0 enc/koi8_r.c
  199. +221 −0 enc/koi8_u.c
  200. +76 −0 enc/make_encdb.rb
  201. +29 −0 enc/make_encmake.rb
  202. +6 −0 enc/prelude.rb
  203. +399 −0 enc/shift_jis.c
Sorry, we could not display the entire diff because too many files (2,101) changed.
View
56 COPYING
@@ -0,0 +1,56 @@
+MacRuby is copyrighted free software by Apple Inc.
+You can redistribute it and/or modify it under either the terms of the GPL
+version 2 (see the file GPL), or the conditions below:
+
+ 1. You may make and give away verbatim copies of the source form of the
+ software without restriction, provided that you duplicate all of the
+ original copyright notices and associated disclaimers.
+
+ 2. You may modify your copy of the software in any way, provided that
+ you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said
+ modifications to Usenet or an equivalent medium, or by allowing
+ the author to include your modifications in the software.
+
+ b) use the modified software only within your corporation or
+ organization.
+
+ c) give non-standard binaries non-standard names, with
+ instructions on where to get the original software distribution.
+
+ d) make other distribution arrangements with the author.
+
+ 3. You may distribute the software in object code or binary form,
+ provided that you do at least ONE of the following:
+
+ a) distribute the binaries and library files of the software,
+ together with instructions (in the manual page or equivalent)
+ on where to get the original distribution.
+
+ b) accompany the distribution with the machine-readable source of
+ the software.
+
+ c) give non-standard binaries non-standard names, with
+ instructions on where to get the original software distribution.
+
+ d) make other distribution arrangements with the author.
+
+ 4. You may modify and include the part of the software into any other
+ software (possibly commercial). But some files in the distribution
+ are not written by the author, so that they are not under these terms.
+
+ For the list of those files and their copying conditions, see the
+ file LEGAL.
+
+ 5. The scripts and library files supplied as input to or produced as
+ output from the software do not automatically fall under the
+ copyright of the software, but belong to whomever generated them,
+ and may be sold commercially, and may be aggregated with this
+ software.
+
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
View
340 GPL
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
View
301 LEGAL
@@ -0,0 +1,301 @@
+LEGAL NOTICE INFORMATION
+------------------------
+
+All the files in this distribution are covered under either the Ruby's
+license (see the file COPYING) or public-domain except some files
+mentioned below.
+
+oniguruma.h:
+regcomp.c:
+regenc.[ch]:
+regerror.c:
+regex.c:
+regexec.c:
+regint.h:
+regparse.[ch]:
+ascii.c:
+euc_jp.c:
+sjis.c:
+utf8.c:
+
+Oniguruma ---- (C) K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+
+http://www.geocities.jp/kosako3/oniguruma/
+http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/oniguruma/
+http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/oniguruma/
+
+ When this software is partly used or it is distributed with Ruby,
+ this of Ruby follows the license of Ruby.
+
+configure:
+
+ This file is free software.
+
+ Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+
+ This configure script is free software; the Free Software Foundation
+ gives unlimited permission to copy, distribute and modify it.
+
+config.guess:
+config.sub:
+parse.c:
+
+ As long as you distribute these files with the file configure, they
+ are covered under the Ruby's license.
+
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+ Free Software Foundation, Inc.
+
+ This file is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ As a special exception to the GNU General Public License, if you
+ distribute this file as part of a program that contains a
+ configuration script generated by Autoconf, you may include it under
+ the same distribution terms that you use for the rest of that program.
+
+util.c (partly):
+
+ Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose without fee is hereby granted, provided that this entire notice
+ is included in all copies of any software which is or includes a copy
+ or modification of this software and in all copies of the supporting
+ documentation for such software.
+
+ THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
+ REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+
+util.c (partly):
+
+ You can apply the Artistic License to these files. (or GPL,
+ alternatively)
+
+ Copyright (c) 1993, Intergraph Corporation
+
+ You may distribute under the terms of either the GNU General Public
+ License or the Artistic License, as specified in the perl README file.
+
+random.c
+
+ This file is under the new-style BSD license.
+
+ A C-program for MT19937, with initialization improved 2002/2/10.
+ Coded by Takuji Nishimura and Makoto Matsumoto.
+ This is a faster version by taking Shawn Cokus's optimization,
+ Matthe Bellew's simplification, Isaku Wada's real version.
+
+ Before using, initialize the state by using init_genrand(seed)
+ or init_by_array(init_key, key_length).
+
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ Any feedback is very welcome.
+ http://www.math.keio.ac.jp/matumoto/emt.html
+ email: matumoto@math.keio.ac.jp
+
+st.[ch]:
+ext/digest/sha1/sha1.[ch]:
+
+ These files are all under public domain.
+
+ext/digest/md5/md5.[ch]:
+
+ These files are under the following license. Ruby uses modified
+ versions of them.
+
+ Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ext/digest/rmd160/rmd160.[ch]:
+
+ These files have the following copyright information, and by the
+ author we are allowed to use it under the new-style BSD license.
+
+ AUTHOR: Antoon Bosselaers, ESAT-COSIC
+ (Arranged for libc by Todd C. Miller)
+ DATE: 1 March 1996
+
+ Copyright (c) Katholieke Universiteit Leuven
+ 1996, All Rights Reserved
+
+ext/digest/rmd160/rmd160hl.c:
+ext/digest/sha1/sha1hl.c:
+
+ These files are under the beer-ware license.
+
+ "THE BEER-WARE LICENSE" (Revision 42):
+ <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
+ can do whatever you want with this stuff. If we meet some day, and you think
+ this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+
+ext/digest/sha2/sha2.[ch]:
+ext/digest/sha2/sha2hl.c:
+
+ These files are under the new-style BSD license.
+
+ Copyright 2000 Aaron D. Gifford. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ext/nkf/nkf-utf8/config.h:
+ext/nkf/nkf-utf8/nkf.c:
+ext/nkf/nkf-utf8/utf8tbl.c:
+
+ These files are under the following license. So to speak, it is
+ copyrighted semi-public-domain software.
+
+ Copyright (C) 1987, Fujitsu LTD. (Itaru ICHIKAWA)
+ Everyone is permitted to do anything on this program
+ including copying, modifying, improving,
+ as long as you don't try to pretend that you wrote it.
+ i.e., the above copyright notice has to appear in all copies.
+ Binary distribution requires original version messages.
+ You don't have to ask before copying, redistribution or publishing.
+ THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
+
+ext/socket/addrinfo.h:
+ext/socket/getaddrinfo.c:
+ext/socket/getnameinfo.c:
+
+ These files are under the new-style BSD license.
+
+ Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+bs.[ch]:
+
+ These files are under the new-style BSD license.
+
+ Copyright (c) 2008, Apple Inc. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ its contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
View
504 LGPL
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
View
43 README
@@ -0,0 +1,43 @@
+== MacRuby
+
+MacRuby is a Ruby implementation based on Mac OS X technologies, such as the
+Objective-C runtime and garbage collector, the CoreFoundation framework and the
+LLVM compiler infrastructure.
+
+It is the goal of MacRuby to enable the creation of full-fledged Mac OS X
+applications which do not sacrifice performance in order to enjoy the benefits
+of using Ruby.
+
+MacRuby is copyrighted free software by Apple Inc and covered by the terms of
+the Ruby license. Please refer to the COPYING file for more information.
+
+The project website contains more documentation, such as tutorials and guides:
+
+ http://macruby.org
+
+=== Requirements
+
+* An Intel machine. PowerPC machines are not supported anymore, but may still
+ work. An Intel 64-bit machine (Intel Core Duo 2) is recommended.
+
+* Mac OS X 10.5.6 or later.
+
+* LLVM 2.5 or later, compiled for both i386 and x86_64.
+
+ At the time of this writing, LLVM 2.5 has not been released yet so you need
+ to install trunk. We recommend revision 64604.
+
+ $ svn co -r 64604 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk
+ $ cd llvm-trunk
+ $ ./configure
+ $ UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make
+ $ sudo env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 \
+ make install
+
+=== Installation
+
+ $ rake
+ $ sudo rake install
+
+Then you should be all set! Please report us any problem you will find (the
+http://macruby.org website has pointers). Thanks!
View
727 Rakefile
@@ -0,0 +1,727 @@
+# User customizable variables.
+# These variables can be set from the command line. Example:
+# $ rake framework_instdir=~/Library/Frameworks sym_instdir=~/bin
+
+def do_option(name, default)
+ val = ENV[name]
+ if val
+ if block_given?
+ yield val
+ else
+ val
+ end
+ else
+ default
+ end
+end
+
+RUBY_INSTALL_NAME = do_option('ruby_install_name', 'macruby')
+RUBY_SO_NAME = do_option('ruby_so_name', RUBY_INSTALL_NAME)
+ARCHS =
+ if s = ENV['RC_ARCHS']
+ $stderr.puts "getting archs from RC_ARCHS!"
+ s.strip.split(/\s+/)
+ else
+ do_option('archs', `arch`.include?('ppc') ? 'ppc' : %w{i386 x86_64}) { |x| x.split(',') }
+ end
+FRAMEWORK_NAME = do_option('framework_name', 'MacRuby')
+FRAMEWORK_INSTDIR = do_option('framework_instdir', '/Library/Frameworks')
+SYM_INSTDIR = do_option('sym_instdir', '/usr/local')
+NO_WARN_BUILD = !do_option('allow_build_warnings', false)
+ENABLE_STATIC_LIBRARY = do_option('enable_static_library', 'no') { 'yes' }
+ENABLE_DEBUG_LOGGING = do_option('enable_debug_logging', true) { |x| x == 'true' }
+
+# TODO: we should find a way to document these options in rake's --help
+
+# Everything below this comment should *not* be modified.
+
+if ENV['build_as_embeddable']
+ $stderr.puts "The 'build_as_embeddable' build configuration has been removed because it is no longer necessary. To package a full version of MacRuby inside your application, please use `macrake deploy` for HotCocoa apps and the `Embed MacRuby` target for Xcode apps."
+ exit 1
+end
+
+verbose(true)
+
+if `sw_vers -productVersion`.strip < '10.5.6'
+ $stderr.puts "Sorry, your environment is not supported. MacRuby requires Mac OS X 10.5.6 or higher."
+ exit 1
+end
+
+if `arch`.include?('ppc')
+ $stderr.puts "Warning: your appear to use a PowerPC machine. MacRuby's PPC support is very basic and may be dropped in a near future. Supported architectures are Intel 32-bit and 64-bit (i386 and x86_64)."
+end
+
+LLVM_CONFIG = `which llvm-config`.strip
+if LLVM_CONFIG.empty?
+ $stderr.puts "The `llvm-config' executable was not located in your PATH. Please make sure LLVM is correctly installed on your machine or that your PATH is correctly set."
+ exit 1
+end
+
+version_h = File.read('version.h')
+NEW_RUBY_VERSION = version_h.scan(/#\s*define\s+RUBY_VERSION\s+\"([^"]+)\"/)[0][0]
+MACRUBY_VERSION = version_h.scan(/#\s*define\s+MACRUBY_VERSION\s+(.*)/)[0][0]
+
+uname_release_number = (ENV['UNAME_RELEASE'] or `uname -r`.scan(/^(\d+)\.\d+\.(\d+)/)[0].join('.'))
+NEW_RUBY_PLATFORM = 'universal-darwin' + uname_release_number
+
+FRAMEWORK_PATH = File.join(FRAMEWORK_INSTDIR, FRAMEWORK_NAME + '.framework')
+FRAMEWORK_VERSION = File.join(FRAMEWORK_PATH, 'Versions', MACRUBY_VERSION)
+FRAMEWORK_USR = File.join(FRAMEWORK_VERSION, 'usr')
+FRAMEWORK_USR_LIB = File.join(FRAMEWORK_USR, 'lib')
+FRAMEWORK_USR_LIB_RUBY = File.join(FRAMEWORK_USR_LIB, 'ruby')
+
+RUBY_LIB = File.join(FRAMEWORK_USR_LIB_RUBY, NEW_RUBY_VERSION)
+RUBY_ARCHLIB = File.join(RUBY_LIB, NEW_RUBY_PLATFORM)
+RUBY_SITE_LIB = File.join(FRAMEWORK_USR_LIB_RUBY, 'site_ruby')
+RUBY_SITE_LIB2 = File.join(RUBY_SITE_LIB, NEW_RUBY_VERSION)
+RUBY_SITE_ARCHLIB = File.join(RUBY_SITE_LIB2, NEW_RUBY_PLATFORM)
+RUBY_VENDOR_LIB = File.join(FRAMEWORK_USR_LIB_RUBY, 'vendor_ruby')
+RUBY_VENDOR_LIB2 = File.join(RUBY_VENDOR_LIB, NEW_RUBY_VERSION)
+RUBY_VENDOR_ARCHLIB = File.join(RUBY_VENDOR_LIB2, NEW_RUBY_PLATFORM)
+
+INSTALL_NAME = File.join(FRAMEWORK_USR_LIB, 'lib' + RUBY_SO_NAME + '.dylib')
+ARCHFLAGS = ARCHS.map { |a| '-arch ' + a }.join(' ')
+LLVM_MODULES = "core jit nativecodegen"
+CFLAGS = "-I. -I./include -I/usr/include/libxml2 #{ARCHFLAGS} -fno-common -pipe -O3 -g -Wall -fexceptions"
+CFLAGS << " -Wno-parentheses -Wno-deprecated-declarations -Werror" if NO_WARN_BUILD
+OBJC_CFLAGS = CFLAGS + " -fobjc-gc-only"
+CXXFLAGS = `#{LLVM_CONFIG} --cxxflags #{LLVM_MODULES}`.strip
+CXXFLAGS << " -I. -I./include -g -Wall #{ARCHFLAGS}"
+CXXFLAGS << " -Wno-parentheses -Wno-deprecated-declarations -Werror" if NO_WARN_BUILD
+LDFLAGS = `#{LLVM_CONFIG} --ldflags --libs #{LLVM_MODULES}`.strip.gsub(/\n/, '')
+LDFLAGS << " -lpthread -ldl -lxml2 -lobjc -lffi -lauto -framework Foundation"
+DLDFLAGS = "-dynamiclib -undefined suppress -flat_namespace -install_name #{INSTALL_NAME} -current_version #{MACRUBY_VERSION} -compatibility_version #{MACRUBY_VERSION}"
+
+OBJS = %w{
+ array bignum class compar complex dir enum enumerator error eval load proc
+ file gc hash inits io marshal math numeric object pack parse process prec
+ random range rational re regcomp regenc regerror regexec regparse regsyntax
+ ruby set signal sprintf st string struct time transcode util variable version
+ thread id objc bs encoding main dln dmyext enc/ascii vm_eval prelude miniprelude
+ gc-stub roxor
+}
+
+class Builder
+ attr_reader :objs, :cflags, :cxxflags
+ attr_accessor :objc_cflags, :ldflags, :dldflags
+
+ def initialize(objs)
+ @objs = objs.dup
+ @cflags = CFLAGS
+ @cxxflags = CXXFLAGS
+ @objc_cflags = OBJC_CFLAGS
+ @ldflags = LDFLAGS
+ @dldflags = DLDFLAGS
+ @obj_sources = {}
+ @header_paths = {}
+ end
+
+ def build(objs=nil)
+ objs ||= @objs
+ objs.each do |obj|
+ if should_build?(obj)
+ s = obj_source(obj)
+ cc, flags =
+ case File.extname(s)
+ when '.c' then ['/usr/bin/gcc', @cflags]
+ when '.cpp' then ['/usr/bin/g++', @cxxflags]
+ when '.m' then ['/usr/bin/gcc', @objc_cflags]
+ end
+ sh("#{cc} #{flags} -c #{s} -o #{obj}.o")
+ end
+ end
+ end
+
+ def link_executable(name, objs=nil, ldflags=nil)
+ link(objs, ldflags, "-o #{name}", name)
+ end
+
+ def link_dylib(name, objs=nil, ldflags=nil)
+ link(objs, ldflags, "#{@dldflags} -o #{name}", name)
+ end
+
+ def link_archive(name, objs=nil)
+ objs ||= @objs
+ if should_link?(name, objs)
+ rm_f(name)
+ sh("/usr/bin/ar rcu #{name} #{objs.map { |x| x + '.o' }.join(' ') }")
+ sh("/usr/bin/ranlib #{name}")
+ end
+ end
+
+ def clean
+ @objs.map { |o| o + '.o' }.select { |o| File.exist?(o) }.each { |o| rm_f(o) }
+ end
+
+ private
+
+ def link(objs, ldflags, args, name)
+ objs ||= @objs
+ ldflags ||= @ldflags
+ if should_link?(name, objs)
+ sh("/usr/bin/g++ #{@cflags} #{objs.map { |x| x + '.o' }.join(' ') } #{ldflags} #{args}")
+ end
+ end
+
+ def should_build?(obj)
+ if File.exist?(obj + '.o')
+ src_time = File.mtime(obj_source(obj))
+ obj_time = File.mtime(obj + '.o')
+ src_time > obj_time \
+ or dependencies[obj].any? { |f| File.mtime(f) > obj_time }
+ else
+ true
+ end
+ end
+
+ def should_link?(bin, objs)
+ if File.exist?(bin)
+ mtime = File.mtime(bin)
+ objs.any? { |o| File.mtime(o + '.o') > mtime }
+ else
+ true
+ end
+ end
+
+ def err(*args)
+ $stderr.puts args
+ exit 1
+ end
+
+ def obj_source(obj)
+ s = @obj_sources[obj]
+ unless s
+ s = ['.c', '.cpp', '.m'].map { |e| obj + e }.find { |p| File.exist?(p) }
+ err "cannot locate source file for object `#{obj}'" if s.nil?
+ @obj_sources[obj] = s
+ end
+ s
+ end
+
+ HEADER_DIRS = %w{. include include/ruby}
+ def header_path(hdr)
+ p = @header_paths[hdr]
+ unless p
+ p = HEADER_DIRS.map { |d| File.join(d, hdr) }.find { |p| File.exist?(p) }
+ @header_paths[hdr] = p
+ end
+ p
+ end
+
+ def locate_headers(cont, src)
+ txt = File.read(src)
+ txt.scan(/#include\s+\"([^"]+)\"/).flatten.each do |header|
+ p = header_path(header)
+ if p and !cont.include?(p)
+ cont << p
+ locate_headers(cont, p)
+ end
+ end
+ end
+
+ def dependencies
+ unless @obj_dependencies
+ @obj_dependencies = {}
+ @objs.each do |obj|
+ ary = []
+ locate_headers(ary, obj_source(obj))
+ @obj_dependencies[obj] = ary.uniq
+ end
+ end
+ @obj_dependencies
+ end
+end
+
+$builder = Builder.new(OBJS)
+
+desc "Same as all"
+task :default => :all
+
+desc "Create config.h"
+task :config_h do
+ config_h = 'include/ruby/config.h'
+ new_config_h = File.read(config_h + '.in') << "\n"
+ flag = ['/System/Library/Frameworks', '/Library/Frameworks'].any? do |p|
+ File.exist?(File.join(p, 'BridgeSupport.framework'))
+ end
+ new_config_h << "#define HAVE_BRIDGESUPPORT_FRAMEWORK #{flag ? 1 : 0}\n"
+ flag = File.exist?('/usr/include/auto_zone.h')
+ new_config_h << "#define HAVE_AUTO_ZONE_H #{flag ? 1 : 0}\n"
+ new_config_h << "#define ENABLE_DEBUG_LOGGING 1\n" if ENABLE_DEBUG_LOGGING
+ new_config_h << "#define RUBY_PLATFORM \"#{NEW_RUBY_PLATFORM}\"\n"
+ new_config_h << "#define RUBY_LIB \"#{RUBY_LIB}\"\n"
+ new_config_h << "#define RUBY_ARCHLIB \"#{RUBY_ARCHLIB}\"\n"
+ new_config_h << "#define RUBY_SITE_LIB \"#{RUBY_SITE_LIB}\"\n"
+ new_config_h << "#define RUBY_SITE_LIB2 \"#{RUBY_SITE_LIB2}\"\n"
+ new_config_h << "#define RUBY_SITE_ARCHLIB \"#{RUBY_SITE_ARCHLIB}\"\n"
+ new_config_h << "#define RUBY_VENDOR_LIB \"#{RUBY_VENDOR_LIB}\"\n"
+ new_config_h << "#define RUBY_VENDOR_LIB2 \"#{RUBY_VENDOR_LIB2}\"\n"
+ new_config_h << "#define RUBY_VENDOR_ARCHLIB \"#{RUBY_VENDOR_ARCHLIB}\"\n"
+ if !File.exist?(config_h) or File.read(config_h) != new_config_h
+ File.open(config_h, 'w') { |io| io.print new_config_h }
+ ext_dir = ".ext/include/#{NEW_RUBY_PLATFORM}/ruby"
+ mkdir_p(ext_dir)
+ cp(config_h, ext_dir)
+ end
+end
+
+desc "Create dtrace.h"
+task :dtrace_h do
+ dtrace_h = 'dtrace.h'
+ if !File.exist?(dtrace_h) or File.mtime(dtrace_h) < File.mtime('dtrace.d')
+ sh "/usr/sbin/dtrace -h -s dtrace.d -o new_dtrace.h"
+ if !File.exist?(dtrace_h) or File.read(dtrace_h) != File.read('new_dtrace.h')
+ mv 'new_dtrace.h', dtrace_h
+ end
+ end
+end
+
+desc "Create revision.h"
+task :revision_h do
+ revision_h = 'revision.h'
+ current_revision = nil
+ if File.exist?('.svn')
+ info = `sh -c 'LANG=C svn info' 2>&1`
+ md_revision = /^Revision: (\d+)$/.match(info)
+ md_url = /^URL: (.+)$/.match(info)
+ current_revision = "svn revision #{md_revision[1]} from #{md_url[1]}" if md_revision and md_url
+ end
+ if not current_revision and File.exist?('.git/HEAD')
+ commit_sha1 = nil
+ head = File.read('.git/HEAD').strip
+ md_ref = /^ref: (.+)$/.match(head)
+ if md_ref
+ # if the HEAD file contains "ref: XXXX", it's the reference to a branch
+ # so we read the file indicating the last commit of the branch
+ head_file = ".git/#{md_ref[1]}"
+ commit_sha1 = File.read(head_file).strip if File.exist?(head_file)
+ else
+ # otherwise, it's a detached head so it should be the SHA1 of the last commit
+ commit_sha1 = head
+ end
+ current_revision = "git commit #{commit_sha1}" if commit_sha1 and not commit_sha1.empty?
+ end
+ current_revision = 'unknown revision' unless current_revision
+
+ new_revision_h = "#define MACRUBY_REVISION \"#{current_revision}\"\n"
+
+ must_recreate_header = true
+ if File.exist?(revision_h)
+ must_recreate_header = false if File.read(revision_h) == new_revision_h
+ end
+
+ if must_recreate_header
+ File.open(revision_h, 'w') do |f|
+ f.print new_revision_h
+ end
+ end
+end
+
+
+desc "Build known objects"
+task :objects => [:config_h, :dtrace_h, :revision_h] do
+ sh "/usr/bin/ruby tool/compile_prelude.rb prelude.rb miniprelude.c.new"
+ if !File.exist?('miniprelude.c') or File.read('miniprelude.c') != File.read('miniprelude.c.new')
+ mv('miniprelude.c.new', 'miniprelude.c')
+ else
+ rm('miniprelude.c.new')
+ end
+ if !File.exist?('prelude.c')
+ touch('prelude.c') # create empty file nevertheless
+ end
+ if !File.exist?('parse.c') or File.mtime('parse.y') > File.mtime('parse.c')
+ sh("/usr/bin/bison -o y.tab.c parse.y")
+ sh("/usr/bin/sed -f ./tool/ytab.sed -e \"/^#/s!y\.tab\.c!parse.c!\" y.tab.c > parse.c.new")
+ if !File.exist?('parse.c') or File.read('parse.c.new') != File.read('parse.c')
+ mv('parse.c.new', 'parse.c')
+ rm_f('parse.o')
+ else
+ rm('parse.c.new')
+ end
+ end
+ if !File.exist?('lex.c') or File.read('lex.c') != File.read('lex.c.blt')
+ cp('lex.c.blt', 'lex.c')
+ end
+ if !File.exist?('node_name.inc') or File.mtime('include/ruby/node.h') > File.mtime('node_name.inc')
+ sh("/usr/bin/ruby -n tool/node_name.rb include/ruby/node.h > node_name.inc")
+ end
+ $builder.build
+end
+
+desc "Create miniruby"
+task :miniruby => :objects do
+ $builder.link_executable('miniruby', OBJS - ['prelude'])
+end
+
+desc "Create config file"
+task :rbconfig => :miniruby do
+ rbconfig = <<EOS
+# This file was created when MacRuby was built. Any changes made to this file
+# will be lost the next time MacRuby is built.
+
+module RbConfig
+ RUBY_VERSION == "#{NEW_RUBY_VERSION}" or
+ raise "ruby lib version (#{NEW_RUBY_VERSION}) doesn't match executable version (\#{RUBY_VERSION})"
+
+ TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/#{NEW_RUBY_VERSION}/#{NEW_RUBY_PLATFORM}")
+ DESTDIR = '' unless defined? DESTDIR
+ CONFIG = {}
+ CONFIG["DESTDIR"] = DESTDIR
+ CONFIG["INSTALL"] = '/usr/bin/install -c'
+ CONFIG["prefix"] = (TOPDIR || DESTDIR + "#{FRAMEWORK_USR}")
+ CONFIG["EXEEXT"] = ""
+ CONFIG["ruby_install_name"] = "#{RUBY_INSTALL_NAME}"
+ CONFIG["RUBY_INSTALL_NAME"] = "#{RUBY_INSTALL_NAME}"
+ CONFIG["RUBY_SO_NAME"] = "#{RUBY_SO_NAME}"
+ CONFIG["SHELL"] = "/bin/sh"
+ CONFIG["PATH_SEPARATOR"] = ":"
+ CONFIG["PACKAGE_NAME"] = ""
+ CONFIG["PACKAGE_TARNAME"] = ""
+ CONFIG["PACKAGE_VERSION"] = ""
+ CONFIG["PACKAGE_STRING"] = ""
+ CONFIG["PACKAGE_BUGREPORT"] = ""
+ CONFIG["exec_prefix"] = "$(prefix)"
+ CONFIG["bindir"] = "$(exec_prefix)/bin"
+ CONFIG["sbindir"] = "$(exec_prefix)/sbin"
+ CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
+ CONFIG["datarootdir"] = "$(prefix)/share"
+ CONFIG["datadir"] = "$(datarootdir)"
+ CONFIG["sysconfdir"] = "$(prefix)/etc"
+ CONFIG["sharedstatedir"] = "$(prefix)/com"
+ CONFIG["localstatedir"] = "$(prefix)/var"
+ CONFIG["includedir"] = "$(prefix)/include"
+ CONFIG["oldincludedir"] = "/usr/include"
+ CONFIG["docdir"] = "$(datarootdir)/doc/$(PACKAGE)"
+ CONFIG["infodir"] = "$(datarootdir)/info"
+ CONFIG["htmldir"] = "$(docdir)"
+ CONFIG["dvidir"] = "$(docdir)"
+ CONFIG["pdfdir"] = "$(docdir)"
+ CONFIG["psdir"] = "$(docdir)"
+ CONFIG["libdir"] = "$(exec_prefix)/lib"
+ CONFIG["localedir"] = "$(datarootdir)/locale"
+ CONFIG["mandir"] = "$(datarootdir)/man"
+ CONFIG["DEFS"] = ""
+ CONFIG["ECHO_C"] = "\\\\\\\\c"
+ CONFIG["ECHO_N"] = ""
+ CONFIG["ECHO_T"] = ""
+ CONFIG["LIBS"] = ""
+ CONFIG["build_alias"] = ""
+ CONFIG["host_alias"] = ""
+ CONFIG["target_alias"] = ""
+ CONFIG["BASERUBY"] = "ruby"
+ CONFIG["MAJOR"], CONFIG["MINOR"], CONFIG["TEENY"] = [#{NEW_RUBY_VERSION.scan(/\d+/).map { |x| "\"" + x + "\"" }.join(', ')}]
+ CONFIG["build"] = "i686-apple-darwin9.0.0"
+ CONFIG["build_cpu"] = "i686"
+ CONFIG["build_vendor"] = "apple"
+ CONFIG["build_os"] = "darwin9.0.0"
+ CONFIG["host"] = "i686-apple-darwin9.0.0"
+ CONFIG["host_cpu"] = "i686"
+ CONFIG["host_vendor"] = "apple"
+ CONFIG["host_os"] = "darwin9.0.0"
+ CONFIG["target"] = "i686-apple-darwin9.0.0"
+ CONFIG["target_cpu"] = "i686"
+ CONFIG["target_vendor"] = "apple"
+ CONFIG["target_os"] = "darwin9.0"
+ CONFIG["CC"] = "gcc"
+ CONFIG["CFLAGS"] = "-fno-common -pipe $(cflags)"
+ CONFIG["LDFLAGS"] = ""
+ CONFIG["CPPFLAGS"] = "$(cppflags)"
+ CONFIG["OBJEXT"] = "o"
+ CONFIG["CXX"] = "g++"
+ CONFIG["CXXFLAGS"] = ""
+ CONFIG["CPP"] = "gcc -E"
+ CONFIG["GREP"] = "/usr/bin/grep"
+ CONFIG["EGREP"] = "/usr/bin/grep -E"
+ CONFIG["GNU_LD"] = "no"
+ CONFIG["CPPOUTFILE"] = "-o conftest.i"
+ CONFIG["OUTFLAG"] = "-o "
+ CONFIG["COUTFLAG"] = "-o "
+ CONFIG["RANLIB"] = "ranlib"
+ CONFIG["AR"] = "ar"
+ CONFIG["AS"] = "as"
+ CONFIG["ASFLAGS"] = ""
+ CONFIG["NM"] = ""
+ CONFIG["WINDRES"] = ""
+ CONFIG["DLLWRAP"] = ""
+ CONFIG["OBJDUMP"] = ""
+ CONFIG["LN_S"] = "ln -s"
+ CONFIG["SET_MAKE"] = ""
+ CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
+ CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
+ CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
+ CONFIG["RM"] = "rm -f"
+ CONFIG["CP"] = "cp"
+ CONFIG["MAKEDIRS"] = "mkdir -p"
+ CONFIG["ALLOCA"] = ""
+ CONFIG["DLDFLAGS"] = ""
+ CONFIG["ARCH_FLAG"] = "#{ARCHFLAGS}"
+ CONFIG["STATIC"] = ""
+ CONFIG["CCDLFLAGS"] = "-fno-common"
+ CONFIG["LDSHARED"] = "$(CC) -dynamic -bundle -undefined suppress -flat_namespace #{ARCHFLAGS}"
+ CONFIG["LDSHAREDXX"] = "$(CXX) -dynamic -bundle -undefined suppress -flat_namespace"
+ CONFIG["DLEXT"] = "bundle"
+ CONFIG["DLEXT2"] = ""
+ CONFIG["LIBEXT"] = "a"
+ CONFIG["LINK_SO"] = ""
+ CONFIG["LIBPATHFLAG"] = " -L%s"
+ CONFIG["RPATHFLAG"] = ""
+ CONFIG["LIBPATHENV"] = "DYLD_LIBRARY_PATH"
+ CONFIG["TRY_LINK"] = ""
+ CONFIG["STRIP"] = "strip -A -n"
+ CONFIG["EXTSTATIC"] = ""
+ CONFIG["setup"] = "Setup"
+ CONFIG["PREP"] = "miniruby$(EXEEXT)"
+ CONFIG["EXTOUT"] = ".ext"
+ CONFIG["ARCHFILE"] = ""
+ CONFIG["RDOCTARGET"] = "install-doc"
+ CONFIG["cppflags"] = ""
+ CONFIG["cflags"] = "$(optflags) $(debugflags) $(warnflags)"
+ CONFIG["optflags"] = "-O2"
+ CONFIG["debugflags"] = "-g"
+ CONFIG["warnflags"] = "-Wall -Wno-parentheses"
+ CONFIG["LIBRUBY_LDSHARED"] = "gcc -dynamiclib -undefined suppress -flat_namespace"
+ CONFIG["LIBRUBY_DLDFLAGS"] = "-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)"
+ CONFIG["rubyw_install_name"] = ""
+ CONFIG["RUBYW_INSTALL_NAME"] = ""
+ CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
+ CONFIG["LIBRUBY_SO"] = "lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib"
+ CONFIG["LIBRUBY_ALIASES"] = "lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib"
+ CONFIG["LIBRUBY"] = "$(LIBRUBY_SO)"
+ CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
+ CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static #{LDFLAGS}"
+ CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
+ CONFIG["SOLIBS"] = ""
+ CONFIG["DLDLIBS"] = ""
+ CONFIG["ENABLE_SHARED"] = "yes"
+ CONFIG["ENABLE_STATIC"] = "#{ENABLE_STATIC_LIBRARY}"
+ CONFIG["MAINLIBS"] = ""
+ CONFIG["COMMON_LIBS"] = ""
+ CONFIG["COMMON_MACROS"] = ""
+ CONFIG["COMMON_HEADERS"] = ""
+ CONFIG["EXPORT_PREFIX"] = ""
+ CONFIG["THREAD_MODEL"] = "pthread"
+ CONFIG["MAKEFILES"] = "Makefile"
+ CONFIG["arch"] = "#{NEW_RUBY_PLATFORM}"
+ CONFIG["sitearch"] = "#{NEW_RUBY_PLATFORM}"
+ CONFIG["sitedir"] = "$(libdir)/ruby/site_ruby"
+ CONFIG["vendordir"] = "$(prefix)/lib/ruby/vendor_ruby"
+ CONFIG["configure_args"] = ""
+ CONFIG["rubyhdrdir"] = "$(includedir)/ruby-$(MAJOR).$(MINOR).$(TEENY)"
+ CONFIG["sitehdrdir"] = "$(rubyhdrdir)/site_ruby"
+ CONFIG["vendorhdrdir"] = "$(rubyhdrdir)/vendor_ruby"
+ CONFIG["NROFF"] = "/usr/bin/nroff"
+ CONFIG["MANTYPE"] = "doc"
+ CONFIG["ruby_version"] = "$(MAJOR).$(MINOR).$(TEENY)"
+ CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
+ CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
+ CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
+ CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
+ CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
+ CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
+ CONFIG["topdir"] = File.dirname(__FILE__)
+ MAKEFILE_CONFIG = {}
+ CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
+ def RbConfig::expand(val, config = CONFIG)
+ val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do
+ var = $&
+ if !(v = $1 || $2)
+ '$'
+ elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
+ pat, sub = $1, $2
+ config[v] = false
+ RbConfig::expand(key, config)
+ config[v] = key
+ key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
+ key
+ else
+ var
+ end
+ end
+ val
+ end
+ CONFIG.each_value do |val|
+ RbConfig::expand(val)
+ end
+end
+Config = RbConfig # compatibility for ruby-1.8.4 and older.
+CROSS_COMPILING = nil
+RUBY_FRAMEWORK = true
+RUBY_FRAMEWORK_VERSION = RbConfig::CONFIG['ruby_version']
+EOS
+ if !File.exist?('rbconfig.rb') or File.read('rbconfig.rb') != rbconfig
+ File.open('rbconfig.rb', 'w') { |io| io.print rbconfig }
+ end
+end
+
+namespace :macruby do
+ desc "Build dynamic libraries for MacRuby"
+ task :dylib => [:rbconfig, :miniruby] do
+ sh("./miniruby -I. -I./lib -rrbconfig tool/compile_prelude.rb prelude.rb gem_prelude.rb prelude.c.new")
+ if !File.exist?('prelude.c') or File.read('prelude.c') != File.read('prelude.c.new')
+ mv('prelude.c.new', 'prelude.c')
+ $builder.build(['prelude'])
+ else
+ rm('prelude.c.new')
+ end
+ dylib = "lib#{RUBY_SO_NAME}.#{NEW_RUBY_VERSION}.dylib"
+ $builder.link_dylib(dylib, $builder.objs - ['main', 'gc-stub', 'miniprelude'])
+ major, minor, teeny = NEW_RUBY_VERSION.scan(/\d+/)
+ ["lib#{RUBY_SO_NAME}.#{major}.#{minor}.dylib", "lib#{RUBY_SO_NAME}.dylib"].each do |dylib_alias|
+ if !File.exist?(dylib_alias) or File.readlink(dylib_alias) != dylib
+ rm_f(dylib_alias)
+ ln_s(dylib, dylib_alias)
+ end
+ end
+ end
+
+ desc "Build static libraries for MacRuby"
+ task :static => :dylib do
+ $builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub', 'miniprelude'])
+ end
+
+ desc "Build MacRuby"
+ task :build => :dylib do
+ $builder.link_executable(RUBY_INSTALL_NAME, ['main', 'gc-stub'], "-L. -l#{RUBY_SO_NAME} -lobjc")
+ end
+end
+
+DESTDIR = (ENV['DESTDIR'] or "")
+EXTOUT = (ENV['EXTOUT'] or ".ext")
+INSTALLED_LIST = '.installed.list'
+SCRIPT_ARGS = "--make=\"/usr/bin/make\" --dest-dir=\"#{DESTDIR}\" --extout=\"#{EXTOUT}\" --mflags=\"\" --make-flags=\"\""
+EXTMK_ARGS = "#{SCRIPT_ARGS} --extension --extstatic"
+INSTRUBY_ARGS = "#{SCRIPT_ARGS} --data-mode=0644 --prog-mode=0755 --installed-list #{INSTALLED_LIST} --mantype=\"doc\" --sym-dest-dir=\"#{SYM_INSTDIR}\""
+
+desc "Build extensions"
+task :extensions => [:miniruby, "macruby:static"] do
+ sh "./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ext/extmk.rb #{EXTMK_ARGS}"
+end
+
+namespace :framework do
+ desc "Create the plist file for the framework"
+ task :info_plist do
+ plist = <<EOS
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>Ruby</string>
+ <key>CFBundleName</key>
+ <string>Ruby</string>
+ <key>CFBundleGetInfoString</key>
+ <string>MacRuby Runtime and Library</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.macruby</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>#{MACRUBY_VERSION}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>#{MACRUBY_VERSION}</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>MacRuby-#{MACRUBY_VERSION}</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
+EOS
+ File.open('framework/Info.plist', 'w') { |io| io.print plist }
+ end
+
+ desc "Install the framework"
+ task :install => :info_plist do
+ sh "./miniruby instruby.rb #{INSTRUBY_ARGS}"
+ end
+end
+
+namespace :clean do
+ desc "Clean local build files"
+ task :local do
+ $builder.clean
+ ['parse.c', 'lex.c', INSTALLED_LIST, 'Makefile', *Dir['*.inc']].each { |x| rm_f(x) }
+ end
+
+ desc "Clean extension build files"
+ task :ext do
+ if File.exist?('./miniruby')
+ sh "./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ext/extmk.rb #{EXTMK_ARGS} -- clean"
+ end
+ end
+end
+
+namespace :rubycocoa do
+ def get(url)
+ file = File.basename(url)
+ sh "curl #{url} -o /tmp/#{file}"
+ # for some reason mocha extracts with some junk...
+ puts `cd /tmp && tar -zxvf #{file}`
+ end
+
+ def install(path)
+ cp_r path, '/Library/Frameworks/MacRuby.framework/Versions/Current/usr/lib/ruby/site_ruby/'
+ end
+
+ desc 'For lack of working RubyGems this is a task that installs the dependencies for the RubyCocoa layer tests'
+ task :install_test_spec_and_mocha do
+ test_spec = '0.9.0'
+ mocha = '0.9.3'
+
+ get "http://files.rubyforge.vm.bytemark.co.uk/test-spec/test-spec-#{test_spec}.tar.gz"
+ install "/tmp/test-spec-#{test_spec}/lib/test"
+
+ get "http://files.rubyforge.mmmultiworks.com/mocha/mocha-#{mocha}.tgz"
+ mocha = "/tmp/mocha-#{mocha}"
+ FileList["#{mocha}/lib/*.rb", "#{mocha}/lib/mocha"].each { |f| install f }
+ end
+
+ desc 'Run the RubyCocoa layer tests'
+ task :test do
+ sh 'macruby test-macruby/rubycocoa_test.rb'
+ end
+end
+
+desc "Same as framework:install"
+task :install => 'framework:install'
+
+desc "Generate and install RDoc/RI"
+task :install_doc do
+ doc_op = '.ext/rdoc'
+ unless File.exist?(doc_op)
+ sh "./miniruby -I./lib bin/rdoc --all --ri --op \"#{doc_op}\""
+ end
+ sh "./miniruby instruby.rb #{INSTRUBY_ARGS} --install=rdoc --rdoc-output=\"#{doc_op}\""
+end
+
+desc "Same as macruby:build"
+task :macruby => 'macruby:build'
+
+desc "Run the sample tests"
+task :sample_test do
+ sh "./miniruby rubytest.rb"
+end
+
+desc "Run the unit tests"
+task :unit_tests do
+ sh "./miniruby test/macruby_runner.rb"
+end
+
+desc "Clean local and extension build files"
+task :clean => ['clean:local', 'clean:ext']
+
+desc "Build MacRuby and extensions"
+task :all => [:macruby, :extensions]
+
+desc "Run all tests"
+task :test => [:sample_test, :unit_tests]
+
+desc "Create an archive (GIT only)"
+task :git_archive do
+ sh "git archive --format=tar --prefix=MacRuby-HEAD/ HEAD | gzip >MacRuby-HEAD.tar.gz"
+end
View
64 TODO
@@ -0,0 +1,64 @@
+[X] implement super dispatch
+[X] implement blocks
+[X] implement dynamic strings
+[X] implement exceptions
+[X] implement 64-bit support
+[/] optimized arithmetic operations
+ [X] fixnums
+ [ ] floats
+ [ ] bignums (vectorization)
+[X] method dispatch cache
+[X] optimized recursive method dispatch
+[ ] block inlining
+[X] constant caching
+[X] fast ivar access
+[X] zero-cost exceptions
+[X] fast eval (inlining)
+[X] fast #send
+[ ] fast regexp =~
+[X] fast break
+[ ] Array and Hash subclasses to hold immediate Ruby objects without boxing
+[/] implement backtracing/symbolication
+[/] port all rb_define_method() calls to rb_objc_define_method()
+
+ - replace calls to rb_define_method() with a call to
+ rb_objc_define_method() and rewrite the function to
+ conform to the following signatures:
+
+ // if arity -2
+ VALUE foo(VALUE recv, SEL sel, VALUE args);
+
+ // if arity -1
+ VALUE foo(VALUE recv, SEL sel, int argc, VALUE *argv);
+
+ // if arity 0
+ VALUE foo(VALUE recv, SEL sel);
+
+ // if arity 1
+ VALUE foo(VALUE recv, SEL sel, VALUE arg1);
+
+ // if arity 2
+ VALUE foo(VALUE recv, SEL sel, VALUE arg1, VALUE arg2);
+
+ // etc.
+
+ In the case of rb_define_global_function(), replace it by
+ rb_objc_define_method(rb_mKernel, ...)
+
+ In the case of rb_define_singleton_method(), replace it by
+ rb_objc_define_method(*(VALUE *)klass, ...)
+
+ In the case of rb_define_alloc_func(), replace it by
+ rb_objc_define_method(*(VALUE *)klass, "alloc", ..., 0)
+
+[/] port all rb_funcall() calls to rb_vm_call()
+[X] remove the YARV code from the project
+[ ] refactor the VM sources
+[ ] clean objc.m
+[/] implement eval/binding (irb)
+[ ] implement the BridgeSupport plumbing
+[ ] implement threading
+[ ] rspec
+ [ ] integrate
+ [ ] pass the 1.9 specs
+[/] all core-features benchmarks should run faster than yarv
View
3,642 array.c
@@ -0,0 +1,3642 @@
+/*
+ * MacRuby implementation of Ruby 1.9's array.c.
+ *
+ * This file is covered by the Ruby license. See COPYING for more details.
+ *
+ * Copyright (C) 2007-2008, Apple Inc. All rights reserved.
+ * Copyright (C) 1993-2007 Yukihiro Matsumoto
+ * Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
+ * Copyright (C) 2000 Information-technology Promotion Agency, Japan
+ */
+
+#include "ruby/ruby.h"
+#include "ruby/util.h"
+#include "ruby/st.h"
+#include "id.h"
+#include "objc.h"
+#include "ruby/node.h"
+#include "roxor.h"
+
+VALUE rb_cArray;
+VALUE rb_cCFArray;
+VALUE rb_cNSArray;
+VALUE rb_cNSMutableArray;
+
+static ID id_cmp;
+
+#define ARY_DEFAULT_SIZE 16
+
+void
+rb_mem_clear(register VALUE *mem, register long size)
+{
+ while (size--) {
+ *mem++ = Qnil;
+ }
+}
+
+static inline void
+rb_ary_modify_check(VALUE ary)
+{
+ long mask;
+#ifdef __LP64__
+ mask = RCLASS_RC_FLAGS(ary);
+#else
+ mask = rb_objc_flag_get_mask((void *)ary);
+#endif
+ if (mask == 0) {
+ bool _CFArrayIsMutable(void *);
+ if (!_CFArrayIsMutable((void *)ary))
+ mask |= FL_FREEZE;
+ }
+ if ((mask & FL_FREEZE) == FL_FREEZE)
+ rb_raise(rb_eRuntimeError, "can't modify frozen/immutable array");
+ if ((mask & FL_TAINT) == FL_TAINT && rb_safe_level() >= 4)
+ rb_raise(rb_eSecurityError, "Insecure: can't modify array");
+}
+#define rb_ary_modify rb_ary_modify_check
+
+VALUE
+rb_ary_freeze(VALUE ary)
+{
+ return rb_obj_freeze(ary);
+}
+
+/*
+ * call-seq:
+ * array.frozen? -> true or false
+ *
+ * Return <code>true</code> if this array is frozen (or temporarily frozen
+ * while being sorted).
+ */
+