How to install ParseTree and RubyInline on Windows and, gasp, get them to work
ParseTree converts Ruby code to a sex expression. RubyInline is magic.
First, gem install rubyinline and gem install parsetree.
Install Visual C++ Express and the newest Microsoft Platform SDK, which is Vista SDK currently. If you wait for 2008 edition, VC++ Express will automatically install Platform SDK for you. This takes a while to download, so kidnap and chloroform a friend with spare bandwidth.
Modify C:\Ruby\lib\ruby\1.8\i386-mswin32\rbconfig.rb, which will vary depending on
where you installed Ruby. If your platform is not i386-mswin32, navigate to the correct directory.
Change the CONFIG["CFLAGS"] line to CONFIG["CFLAGS"] = "-MD -Zi -O2b2x".
Open up a Windows 32-bit debugging console from Platform SDK’s many Start Menu subdirectories.
In addition, drag the file Microsoft Visual Studio 8\VC\vcvarsall.bat in your Program File to the console, which will
paste the full file path. Press Enter. Now you have the necessary bin, include, and lib variables.
Navigate to the highly redundant C:\Ruby\lib\ruby\gems\1.8\gems path. Go into RubyInline’s folder and
edit lib\inline.rb. Around line 379 and 392, manually patch the file per my poorly generated diff using
a text editor or SNOBOL, which will fix quotation marks, a method call, a compiler flag, and manifest molestation.
In Inline#generate, change the file, line = line per my poorly described bug.
Now, in your console, cd to ...\gems\RubyInline-version\demo and type ruby hello.rb. You should
see Hello World. If not, search Google. Common problems include missing bin/include variables,
in which case use set var=%var%;c:\new\directory for the path or include variables. If the C++
compiler screws up, Google and try modifying rbconfig.rb.
OK, you have RubyInline working now. ParseTree is much simpler now that the hard part is finished.
Simply wrap every builder.add_compile_flag call around line 258 of ...gems\ParseTree-version\lib\parse_tree.rb
with an if /win32/ !~ RUBY_PLATFORM ... end except the -Wall since that’s the only one that works
with VC++. Now run ruby ...\demo\printer.rb to make sure it works.
Congratulations. You have conquered the dragon that is compiling on Windows.