Hi,
Recently Gardens Point Ruby.NET Compiler was released. It’s available
here:
http://plas.fit.qut.edu.au/Ruby.NET/
This post is a walkthrough on how to compile it on Mono.
First, you need to get Mono from SVN trunk. The latest release is
1.1.15 but it won’t do. (Missing property in System.IO.StreamReader.)
Get SVN revision later than 60046.
Next, you need to patch Mono C# compiler. GP Ruby.NET Compiler is
beaten by Mono bug #77963, which causes deriving class from generic
type whose generic argument is its nested class to fail. Unfortunately
this is the case for Ruby.Dictionary class which derives from
System.Collections.Generic.Dictionary<Ruby.Dictionary.Key, object>.
This is obviously Mono’s fault, but it would be great if Ruby.NET team
can move Key class out of Dictionary class to avoid this.
So get the workaround patch by Atsushi Emoto from Mono bugzilla. Patch
is a bit old, but you should have no problem finding where it is
patching (it’s one-liner):
http://bugzilla.ximian.com/show_bug.cgi?id=77963
And build Mono. It will take some time.
As Ruby.NET uses MSBuild as its build system which is not yet supported
in Mono, I prepared a simple Makefile. It would be nice if Ruby.NET
team can include this in the next release.
CSC=gmcs
all: …/Bin/QUT.ShiftReduceParser.dll …/Bin/QUT.PERWAPI.dll
…/Bin/QUT.RubyRuntime.dll …/Bin/RubyCompiler.exe
…/Bin/QUT.ShiftReduceParser.dll:
$(CSC) -t:library -out:…/Bin/QUT.ShiftReduceParser.dll
-recurse:GPPG/ShiftReduceParser/*.cs
…/Bin/QUT.PERWAPI.dll:
$(CSC) -t:library -out:…/Bin/QUT.PERWAPI.dll
-recurse:PERWAPI/*.cs
…/Bin/QUT.RubyRuntime.dll:
$(CSC) -t:library -r:…/Bin/QUT.ShiftReduceParser.dll
-r:…/Bin/QUT.PERWAPI.dll -out:…/Bin/QUT.RubyRuntime.dll
-recurse:RubyRuntime/*.cs
…/Bin/RubyCompiler.exe:
$(CSC) -t:exe -r:…/Bin/QUT.PERWAPI.dll
-r:…/Bin/QUT.RubyRuntime.dll -out:…/Bin/RubyCompiler.exe
-recurse:RubyCompiler/*.cs
After that, Ruby.NET’s runtime library makes use of some API not yet
implemented in Mono. Namely, they correspond to following Ruby methods:
File.readable? File.readable_real? File.writable? File.writable_real?
File.executable? File.executable_real? File.owned? File.expand_path,
Dir.glob, IO.reopen.
You can find this out by performing compile-delete cycle, which feels
like a big waste of time, so I did it for you. Get it here:
http://sparcs.kaist.ac.kr/~tinuviel/download/patch-ruby.net
Now,
- Unpack Ruby.NET.beta0.5.src.zip (Be sure to get source
distribution!) - Apply patch-ruby.net
- cd to ruby.net at Directnic
- Type make (Be sure that gmcs points to patched gmcs, edit Makefile
if necessary) - ?
- Profit!
Thanks to #mono people on GIMPNet for help.