Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging Compiled Binary /w a Ruby Gem

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?

like image 965
mikegreiling Avatar asked Dec 06 '25 22:12

mikegreiling


1 Answers

Here's a gem that packages the pdftk binary.

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

like image 89
Brad Wheel Avatar answered Dec 09 '25 16:12

Brad Wheel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!