Hi,

> I'm new to Ruby, how do you incorporate the changes you mentioned in
> r29063. i.e how to you apply a patch to the Ruby distribution.

You have to rebuild ruby.  The build process differs between ruby
distributions.

I'm using Debian GNU/Linux, so I did fetch the source package of ruby
from Debian's package repository, patch it, tweaked debian/rules to
disable shared obj, start building and stop after ./configure, make
-j4 ruby1.9.1, cp, that's all.  I disabled shared lib because
switching between unmod'ed and mod'ed is made easier (by just
symlinking one file).  I interrupted the standard build process
because it runs unfamiliar preprocessing each time and time-consuming
regression test, and I wanted to avoid them.

I also did some tests on Windows Vista today, and worked successfully.

Assumes you are using the oneclick MinGW RubyInstaller and DevKit:

  - obtain a copy of the official ruby-1.9.2-p0 from:

      http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2

  - extract ruby-1.9.2-p0 source tree and apply patch:

      $ cd [somewhere_0]
      $ tar jxf [somewhere_1]/ruby-1.9.2-p0.tar.bz2
      $ cd ruby-1.9.2-p0
      $ patch -p1 < [somewhere_2]/r29063.patch

  - clone RubyInstaller source code:

      $ cd [somewhere_3]
      $ git clone http://github.com/oneclick/rubyinstaller.git

  - build ruby (takes a long time):

      $ cd rubyinstaller
      $ rake ruby19 LOCAL="[somewhere_0]/ruby-1.9.2-p0"

You'll find a complete ruby tree in sandbox/ruby19_mingw.  Copy the
files onto existing ruby installation directory.

r29063.patch:
diff --git a/vm.c b/vm.c
index e62c9a4..a381d3c 100644
--- a/vm.c
+++ b/vm.c
@@ -1844,6 +1844,11 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, 
VALUE iseqval,
     rb_iseq_t *miseq;
     GetISeqPtr(iseqval, miseq);

+    if (miseq->klass) {
+       iseqval = rb_iseq_clone(iseqval, 0);
+       GetISeqPtr(iseqval, miseq);
+    }
+
     if (NIL_P(klass)) {
        rb_raise(rb_eTypeError, "no class/module to add method");
     }

-----
Tomoaki Hayasaka <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

diff --git a/vm.c b/vm.c
index e62c9a4..a381d3c 100644
--- a/vm.c
+++ b/vm.c
@@ -1844,6 +1844,11 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
     rb_iseq_t *miseq;
     GetISeqPtr(iseqval, miseq);

+    if (miseq->klass) {
+       iseqval = rb_iseq_clone(iseqval, 0);
+       GetISeqPtr(iseqval, miseq);
+    }
+
     if (NIL_P(klass)) {
        rb_raise(rb_eTypeError, "no class/module to add method");
     }

Reply via email to