From: Jon Forums Date: 2012-11-26T08:32:14+09:00 Subject: Re: How to create a gem which conditionally compiles/installs a C extension? >> 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 When you get a moment would you try replacing https://github.com/rubygems/rubygems/blob/master/lib/rubygems/ext/builder.rb#L15-L17 with this little hack return unless File.exist? 'Makefile' and try your idea of not creating a Makefile from extconf.rb upon certain conditions. It assumes (a) all sucessful exits from extconf.rb (with or without generating a Makefile) is what the author intended, and (b) all extconf.rb failures will be handled as-is by RG. When I get time I'll test on both my Win7 and Arch systems. If it turns out to be this easy *and* solid, well... Jon -- Posted via http://www.ruby-forum.com/.