mattn/mruby-require — pull request #18 by pbosetti (2014-03-13 15:50:58+00:00)
Title: Partially solved regression introduced in last commit. 

I am deeply sorry, but my latest pull request was flawed. The fact is that the `g.objs` field is only created AFTER the loading of all the gems, so my previous solution did never actually compile the requested libraries.

This new PR fixes this by forcing a call to `g.setup` within the `each` loop, so that the list of object files is known annd the bundled gems are actually compiled. This solution works as expected: gems required in setup after the mruby-require gem itself are compiled as shared object files, those appearing before are compiled into the libmruby library.

There is still an issue, though, for which I'd like to discuss the better implementation: when another gem depends on a system-level dynamic library (e.g. `pcre`), when linking any one of the gems appearing after the mruby-require the linker fails, because the libmruby.a depends on a dll, which does not appear on the linker command line (as `-lpcre`).

Any idea on how to fix this? we could track all the external libs required by other gems by calling the `setup` method for each gem, and then accumulating all the dependencies into an array for using it when calling the linker. But it seems cumbersome to me.