-
Notifications
You must be signed in to change notification settings - Fork 168
Gems with Native Extensions
...and they said it couldn't be done...
...or, well, sort of...
I googled the be-jaysus out of ways to install gems with native dependencies in Shoes, and came up with nothing. ...But thanks to a lot of help from Steve Klabnik I was able to do just that, and I thought I'd post how I worked it out here in case other folks are trying to do the same.
I installed GStreamer and its dependencies - but I imagine the process would be the same for other gems. This was done in Ubuntu 10.04 Lucid, with Shoes Policeman - not sure if the same will work in other systems...
GStreamer is dependent on glib2 and pkg-config - as it turned out I didn't have to install pkg-config as it is included with Shoes (or so it would seem....)
So here's what I did -
First, I made a copy of my working shoes directory in case I screwed things up to the point of no return.
Steve pointed me to the shoes/req directory, and the shoes/make/make.rb file. These are the keys...
I have GStreamer installed already on my system-wide ruby, so I had the gem directories for GStreamer and glib2, and I copied them into shoes/req.
The next step (though I didn't know it at the time) is to find the gemspec files, which in my case were located in /usr/local/lib/ruby/gems/1.9.1/specifications.
The two I was looking for were glib2-0.90.8.gemspec, and gstreamer-0.90.8.gemspec. I copied each one into it's new home in shoes/req/glib2 and shoes/req/gstreamer respectively, and renamed each gemspec - (took a couple of failed rakes and more help from Steve to figure that one out!)
Then it was a matter of editing two lines of the shoes/make/make.rb file.
To the array in line 63, I added this:
req/glib2/ext/glib2 req/gstreamer/ext/gstreamer
and to the hash in line 67, this:
'glib2' => 'lib/glib2/ext', 'gstreamer' => 'lib/gstreamer/ext',
Then it was time to rebuild Shoes, running rake from the /shoes directory.
AND SO, after much hacking, whacking, sweating, and cursing (which hopefully this post will spare you,) the rake ran smoothly - and I'm now happily GStreaming with Shoes.
Thanks again to Steve for his patience and knowhow...
Now... to figure out how to package the thing! ;)
rock and roll buddy...