whitequark/rlua — pull request #1 by sw17ch (2012-09-06 21:31:33+00:00)
Title: Fix for homebrew 5.1.4

I noticed that RLua fails to install with the current version of Lua on Homebrew (5.1.4). Following is the error I get when trying to install. Several variations of the options also failed.

```
$ gem install rlua -- --with-lua5.1-lib=/usr/local/Cellar/lua/5.1.4/lib/ --with-opt-include=/usr/local/Cellar/lua/5.1.4/include/
Building native extensions. This could take a while...
ERROR: Error installing rlua:
ERROR: Failed to build gem native extension.

/Users/me/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-lua5.1-lib=/usr/local/Cellar/lua/5.1.4/lib/ --with-opt-include=/usr/local/Cellar/lua/5.1.4/include/
checking for luaL_newstate() in -llua5.1... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--with-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/me/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-lua5.1-dir
--without-lua5.1-dir
--with-lua5.1-include
--without-lua5.1-include=${lua5.1-dir}/include
--with-lua5.1-lib=${lua5.1-dir}/lib
--with-lua5.1lib
--without-lua5.1lib
extconf failure: need liblua5.1

Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rlua-1.0 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rlua-1.0/ext/gem_make.out
```

These commits do a few things, but mainly:

1. Search for a library that includes a `.` before the version number in extconf.rb
2. `#include ` instead of `#include `.

I'm not sure if #2 above is preferable. After making the changes in this pull request, running the following command manages to install the gem:

```
$ rake gem && gem install pkg/rlua-1.1.rc.1.gem -- --with-lua5.1-lib=/usr/local/Cellar/lua/5.1.4/lib --with-lua5.1-include=/usr/local/Cellar/lua/5.1.4/include/rake/gempackagetask is deprecated. Use rubygems/package_task instead
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /Users/johnvanenk/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
mkdir -p pkg
rm -f pkg/rlua-1.1.rc.1/ext/rlua.c
ln ext/rlua.c pkg/rlua-1.1.rc.1/ext/rlua.c
rm -f pkg/rlua-1.1.rc.1/lib/rlua.rb
ln lib/rlua.rb pkg/rlua-1.1.rc.1/lib/rlua.rb
rm -f pkg/rlua-1.1.rc.1/LICENSE.rdoc
ln LICENSE.rdoc pkg/rlua-1.1.rc.1/LICENSE.rdoc
rm -f pkg/rlua-1.1.rc.1/README.rdoc
ln README.rdoc pkg/rlua-1.1.rc.1/README.rdoc
rm -f pkg/rlua-1.1.rc.1/TODO.rdoc
ln TODO.rdoc pkg/rlua-1.1.rc.1/TODO.rdoc
rm -f pkg/rlua-1.1.rc.1/ext/extconf.rb
ln ext/extconf.rb pkg/rlua-1.1.rc.1/ext/extconf.rb
cd pkg/rlua-1.1.rc.1
mv rlua-1.1.rc.1.gem ..
cd -
Building native extensions. This could take a while...
Successfully installed rlua-1.1.rc.1
1 gem installed
Installing ri documentation for rlua-1.1.rc.1...
Installing RDoc documentation for rlua-1.1.rc.1...
```