From: Luis Lavena Date: 2008-04-08T00:50:04+09:00 Subject: Re: gem build documentation for new gems? On 7 abr, 11:08, Phillip Gawlowski wrote: > > And to put my money where my mouth is, I'll write up a bare-bones > tutorial on how to build a gem, and send it off to the Rake folks (I'm > using Rake to generate my gems and packaging, so cut me *some* slack, > will you. :P) You should take a look at what Dr.Nic Williams did: http://drnicwilliams.com/2008/04/01/writing-c-extensions-in-rubygems/ > > | > | Why not compile natively on Windows? > > Setting up a MinGW/MSYS environment is a bit of a hassle, especially if > you want GCC 4, since the MinGW32 folks lag behind on that. > Well, try adapting my recipes and use the TDM GCC4 releases instead, just keep the MSYS files there: http://www.tdragon.net/recentgcc/ Oh, please use GCC4 with SJLJ, since dw2 sometimes segfaults with Ruby ;-) > However, I've asked myself that same question. Trouble would be to > define the Ruby environment for building extensions for things like > GTK+/GNOME2, which are available pre-compiled at the moment (storage of > header-files, how mkmf works, what needs to be handled, etc. In short, I > don't know the scope of this tangled mess just yet, and can't start > unraveling the threads). I've been informed about extensions/gems that already build with this 'sandboxed MinGW': wxRuby Ruby-GNOME RMagick 2 So I think getting other projects working is not painful as someone can think of (at least for me). > > The up-shoot is, that I was able to install the tmail extension with > Luis' installer recipe (and tmail compiled itself happily. I have no > idea if it works, though :P), which makes me wonder if it isn't possible > to distribute a Ruby version which comes with a compiler environment for > developers, with an option to build a Ruby redistributable (sort of like > the Visual C runtime, or a Java VM) for deployment, and/or have a Ruby > distribution for end-users only, who want to run pre-defined scripts, > they get handed by somebody (An analogue of the Java world: A Ruby SDK > ala the JDK for developers, and a Ruby RE ala the JRE for end users). Wow, already replied this :-) > > In principle this is possible, as Rubyscript2exe, and exerb demonstrate. > RubyScript2Exe and exerb are kind of "hacks", until there is a mechanism to ship the VM and the required dependencies as "packages", like Rubinius is doing with .rba files or Python do with the custom VM and zip files, we will be stuck on this. There is no mechanism in the Ruby VM to do something like that right now. > If *anybody* has an idea how to tackle the problem of redistributing > extensions, I'd be grateful as heck. > Wrap your extension as a gem, use tools like newgem, Hoe or Echoe and ship precompiled binaries sticking Gem::Platform::CURRENT in your Gem::Specification Regards, -- Luis Lavena