Today I tagged mkrf’s 0.1.1 release. It fixes several of the
shortcomings of it’s predecessor.
= What Is It?
mkrf is a library to generate Rakefiles which build extensions to
Ruby. It aims to replace mkmf with a properly tested, cleanly coded,
easy to use (and reuse) alternative.
The most obvious change is that the Mkrf::Generator constructor now
takes the name of the library without a file extension. The generator
will now figure out what file extension makes sense on the build
The second change development-wise is that you can now inject your own
code into the generated Rakefile as a string set in the
additional_code attribute. Yes this smells. I’m not very happy with it
at the moment either but it seemed the simplest clean way to allow for
things like gem specs. If you have a better way to implement this, by
all means, tell me about it and we’ll make it better together.
Another change that I’d been avoiding a while is adding proper
logging. Initially it uglied up my code a bit, but after some
refactoring I’m mostly satisfied. mkrf.log will now tell you all about
it’s quest to find the libraries and headers on your system. The
logger is set to the “info” severity level by default, but you can
tweak it easily:
Mkrf::Generator.new(‘somelib’) do |g|
g.logger.level = Logger::WARN
On my (quickly growing) list of things to do is a proper writeup on
using mkrf for you extensions. I expect that if you’re familiar with
mkmf it shouldn’t be hard to wrap your brain around it.