4 ms·
I haven't worked much with Ruby, but would love to try it! These python package don't even need to compile native extensions, the pre-compiled SQLite extension
by alexgarcia-xyz 4y ago
I haven't worked much with Ruby, but would love to try it! These python package don't even need to compile native extensions, the pre-compiled SQLite extension just gets stuffed into the package under `package_data`.
For ruby gems, do you know if it's possible to include arbitrary files into a gem?
- e12e 4y agoIf you have the binary all ready, you could mimic this ancient gem that bundles pdftk binaries (for use with heroku): https://github.com/charliemaffitt/pdftk-heroku https://github.com/charliemaffitt/pdftk-heroku But I think it might be possible to leverage gem compile, maybe even with extensions for cross compiling. You'd need to specify the platform to match your binaries, and those as files (for extensions) or binaries (for executables you want added to path). https://github.com/luislavena/gem-compiler https://github.com/luislavena/gem-compiler https://github.com/rake-compiler/rake-compiler-dock https://github.com/rake-compiler/rake-compiler-dock AFAIK when a gem is compiled, a makefile or a rake-file is invoked - and can be made to do just about anything. Add some ruby in the gemspec - and it should be possible to distribute almost anything as a platform specific gem. Ed: note that sqlite3 for ruby is an example of how to build and distribute pre-compiled, native ruby extensions[1]. I suppose it might be possible to just fork it, and massage the build to spit out/include dlls (via cargo build or whatever). That would be doing much more than creating a sqlite3-some_ext gem that depends on the sqlite3 gem, though. I guess if you just wrapped some extensions in a gem, there would be some way to find them on the filesystem / append to a relevant path setting after install? [1] https://github.com/sparklemotion/sqlite3-ruby/pull/320 https://github.com/sparklemotion/sqlite3-ruby/pull/320