[Rubygems-developers] Gem build process for C extension

Kevin Clark kevin.clark at gmail.com
Fri Jan 4 21:54:15 EST 2008

> (a) How do I tell rubygems to invoke "rake" rather than "make" during
> the build process? I assume I just need to put something in
> the .gemspec, but I don't know what.

If you have a Rakefile or a mkrf_config in the ext directory, it
should use those instead of an extconf.

> (b) How do I tell rubygems that my gem now has a dependency on the
> "mkrf" gem?

Just add mkrf as a dependency like you would with other gems.

> Are there documents or examples showing how to properly use gems in
> conjunction with a C extension and its build process? How do other
> people make sure path names are quoted properly? Should I use mkmf or
> mkrf?

There's an example in the Pickaxe, and one here

I can't speak to quoting pathnames. I'd say mkrf is probably a better
starting point if _any_ hacking is to be done. I've quarantined the
part of my brain that understood mkmf for fear the disease would
spread. It isn't as widely used though, so there may be things
missing. Please _do_ file bug reports if that's the case.

> Is there comprehensive documentation for a .gemspec file?

Probably, but honestly at this point I end up going to the source or
to my other gems.

Kevin Clark

More information about the Rubygems-developers mailing list