Packaging Compiled Binary /w a Ruby Gem

397 Views Asked by At

I am creating a small daemon, written in Ruby, which relies in part on a small binary utility compiled from C code. I want to package this as a gem and include this dependency along with it.

Essentially, this daemon will need to run commands such as ip addr add ... without requiring sudo, so I created a small C program to proxy those commands which must be compiled, chowned to root, and have the setuid bit set.

I would like to have the gem compile and install this dependency along with the daemon, but I am unsure how to do so. I understand extensions can be compiled via extconf.rb, but that is specifically meant for managing Ruby extensions, right? Would it be an ugly hack to have this compile and install a binary to /usr/local/bin or similar?

Does anyone know of an existing gem which does a similar thing which I can study as an example?

1

There are 1 best solutions below

0
Brad Wheel On

Here's a gem that packages the pdftk binary.

https://github.com/charliemaffitt/pdftk-heroku