Mkmf-lite 0.1.0


I’m happy to announce the release of mkmf-lite 0.1.0. This is the
initial release of this library.

= What is it?

A very lite version of mkmf. Unlike mkmf it is designed to be a library,
rather than a Makefile generator.

= How do you use it?

require ‘mkmf/lite’
require ‘ffi’

class Foo
include Mkmf::Lite
extend FFI::Library

No Makefile generation, no output, just true or false

if have_struct(‘struct stat’, ‘st_uid’, ‘sys/stat.h’)
# Do something funky with FFI

= What functions does it offer?

  • have_header
  • have_func
  • have_struct_member

= Ok, but why this instead of just mkmf?

First, mkmf is meant to be used as a Makefile generator, run from the
command line. It is NOT designed to be used as an independent library.

The mkmf-lite library does not generate a Makefile, nor does it create
an mkmf.log file. It does not emit anything to standard output, either.

What it does have are a few handy methods that you can use for C
extensions, FFI libraries, and tests. You can simply mix it into your
class or tests, and use the methods for handy C related construct

= How do I get it?

gem install mkmf-lite