From: "Rocky B." Date: 2012-11-25T23:46:43+09:00 Subject: Re: How to create a gem which conditionally compiles/installs a C extension? Jon Forums wrote in post #1086252: >> * Figure out some way in the gem to dynamically disable compiling the >> extension on MRI 1.9.3. For example in ext/extconf.rb: >> >> if '1.9.2' == RUBY_VERSION >> create_makefile(...) >> else >> ??? >> end > > `Gem::Ext::ExtConfBuilder` makes this difficult by (incorrectly) > assuming it should always run make after extconf.rb; you must create a > Makefile (even if it's just a no-op stub) and have an activated make on > your system. > > I recently had a similar idea (comined pure-ruby and native gem with > build decision made at install time by extconf.rb) and briefly toyed > with wrapping the extconf.rb with a Rakefile. The quick hack didn't > work, and I haven't had time to swing back and dance with the little > monster. > > https://github.com/jonforums/ffi-bogus > > Perhaps it just needs another set of eyes and a bit more time. That > said, a Rakefile + extconf.rb solution is a kludge. The right solution > is to find a clever way to make RubyGems more nimble and not break > existing extconf.rb builds. Agreed. I couldn't see how to make it work either. So until something better comes along I've gone with the bogus C extension approach when it is not needed. See https://github.com/rocky/rb-threadframe/tree/master/ext > > Jon -- Posted via http://www.ruby-forum.com/.