Find system package dependency on a gem

Hello,

Is there anyway to find the C library dependency when installing a gem
containing a native extension?

For now my only solution is to do a ldd on the so file.

By example I know which C lib is needed by nokogiri by doing that:
ldd ./gems/nokogiri-1.5.9/ext/nokogiri/nokogiri.so
linux-vdso.so.1 => (0x00007fff659ff000)
libruby-1.9.1.so.1.9 => /usr/lib/libruby-1.9.1.so.1.9
(0x00007f86362c1000)
libexslt.so.0 => /usr/lib/x86_64-linux-gnu/libexslt.so.0
(0x00007f86360ac000)

Then I can search in by ubuntu repo with apt-cache/apt-file.

I’d need that in order to package my app, the goal being to have a .deb
file with all my app code + all the gems (with or without native
extension) + dependencies in the .deb package for the C libraries
(libxml/libssl/whateevr is needed).
The build of the package will be done on the CI environment (it will run
the bundle install then put the above in the package).
So an apt-get install myapp will deploy my code (with vendor/bundle from
my bundle install) and install the C dependency (libsqlite3-dev by
example)

Thanks for your help!