Creating RubyGems .debs for Maemo
January 21st, 2008
I'm writing an application (more on that sometime soon) using the very nice Ruby bindings for Maemo. I've got some dependencies that are packaged as RubyGems that I wanted to be managed through the Application Manager, so I created some .debs for them. Here is their temporary home The rake, hpricot, feed-normalizer, simple-rss, atom and htmlentities gems are available in my repository. I didn't create the rubygems and librubygems packages themselves - I was sent them, but couldn't find them hosted elsewhere.
It took me a little while to suss out how to create the .debs so I've included the steps here in case anyone finds themselves in the same boat. This works for native Ruby gems and compiled C extensions.
- Install the gem inside Scratchbox. Irritatingly, "gem install example" doesn't always want to do very much, so you may need to dowload the gem file and "gem install example-0.1.gem".
- Make a new directory with the rubygems-<package>-<version> syntax (the rubygems- prefix seemed to make sense to me):
mkdir rubygems-example-0.1 cd rubygems-example-0.1/ ; mkdir gems specifications bincp -r /targets/CHINOOK_ARMEL/var/lib/gems/1.8/gems/example-0.1/ gemscp /targets/CHINOOK_ARMEL/var/lib/gems/1.8/specifications/example-0.1.gemspec specifications/cp /targets/CHINOOK_ARMEL/var/lib/gems/1.8/bin/example bin/(if there are any bins)- Create a Makefile with this content (you will need to replace the spaces at the start of the lines with tabs):
all: clean: install: mkdir -p $(DESTDIR)/var/lib/gems/1.8/gems/ mkdir -p $(DESTDIR)/var/lib/gems/1.8/bin/ <------ REMOVE THIS LINE IF THERE ARE NO BINS mkdir -p $(DESTDIR)/var/lib/gems/1.8/specifications/ cp -r gems/* $(DESTDIR)/var/lib/gems/1.8/gems/ cp bin/* $(DESTDIR)/var/lib/gems/1.8/bin/ <------ REMOVE THIS LINE IF THERE ARE NO BINS cp specifications/* $(DESTDIR)/var/lib/gems/1.8/specifications/ dh_make -e you@example.comthen choose the type of package.- Edit debian/control to suit. Make sure the section is something like user/Utilities, not just Utilities if you want the package to show in the Application Manager.
dpkg-buildpackage -rfakeroot -b- The parent directory should now contain rubygems-example_0.1-1_armel.deb
As a final note, /var/lib/gems/1.8/bin/ may not be in $PATH, so you'll need to deal with that if you have files in bin/.
February 11th, 2008 at 03:37 PM hey man only way i could find of contacting you. just wondered if i could get my blog added to scottishclimbs? the address is www.outdooruk.blogspot.com. cheers