= mkrf -- making C extensions for Ruby a bit easier
mkrf is intended to replace mkmf, a library for building
Makefiles to build C extensions to Ruby. Its major goals are easy code reuse of
its Availability class and simple, well documented, use of the
Generator class for Rakefile generation for extensions.
== Basic Usage
mkrf works similarly to mkmf in that a user writes an
extension configuration (usually extconf.rb) and then runs it, which
generates a Rakefile.
In general, extconf.rb should be placed in the root directory of the
extension and it expects by default that files to be compiled have a .c
extension and are in the lib/ directory.
The most basic usage looks like this, with the name of the library to be linked
as the first argument to Mkrf::Generator.new:
require 'mkrf'
Mkrf::Generator.new('libtrivial')
Extra arguments may be passed to the generator in a block:
Mkrf::Generator.new('libtrivial) do |g|
g.logger.level = Logger::WARN
g.include_library('z')
end
If the extension does not follow the source in lib/ / .c
extension convention, it may be overridden in the constructor:
Mkrf::Generator.new('libxml', '*.c') do |g|
g.include_library('socket','socket')
g.include_header('libxml/xmlversion.h',
'/opt/include/libxml2',
'/usr/local/include/libxml2',
'/usr/include/libxml2')
end
== Credits
* Jim Weirich for writing Rake
== Licence
mkrf is available under an MIT-style license.
Copyright (c) 2006 Kevin Clark
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.