C extensions (was [GitHub] rdp sent you a message)

7 views
Skip to first unread message

Josh Nichols

unread,
Nov 1, 2009, 12:39:14 PM11/1/09
to jewel...@googlegroups.com
Forwarded from my GitHub inbox.

I myself am particularly knowledgeable in Ruby C extensions (yet?!?),
so I figured I'd send this around for input.

As far as gemspecs go, I think it really only cares about 'extconf.rb'
files. By convention, it looks like these live somewhere under 'ext'.
So, I'd propose having jeweler have this default:

gemspec.extensions = FileList["ext/**/extconf.rb"]

This seems pretty reasonable and straightforward.

And since we're on the subject, I'm sure the next thing people would
ask is about generating a project which includes the basic stuff for
doing a C extension. I haven't looked enough C extension libraries to
know what is considered good practices. For example, I've seen
extconf.rb as `ext/extconf.rb` or `ext/my-library/extconf.rb`. I'm
also not sure if there's any special rake tasks that are needed. Like,
do you need to compile the extensions before running tests?

Anyways, what are people's thoughts on this?

- Josh


---------- Forwarded message ----------
From: GitHub <nor...@github.com>
Date: Thu, Oct 29, 2009 at 6:24 PM
Subject: [GitHub] rdp sent you a message
To: jo...@technicalpickles.com

rdp sent you a message.

--------------------
Subject: jeweler extensions?

Might be nice to add

 s.extensions = ["ext/extconf.rb"]

if ext/*.rb throw them in there :)
Thanks!
-r

--------------------

Reply on GitHub: http://github.com/inbox/299088#reply

Josh Nichols

unread,
Nov 1, 2009, 12:55:48 PM11/1/09
to jewel...@googlegroups.com
I just used my googlefu, and came across rake-compiler:

http://github.com/luislavena/rake-compiler/

This seems pretty straightforward, and is probably easy to generate a
Rakefile setup for this.

Relatedly, I came across rake-tester, which is an extension to
rake-compiler for running C tests.

http://github.com/karottenreibe/rake-tester

That's cool, but even cooler was an example using both of these AND jeweler:

http://github.com/karottenreibe/joker

- Josh

rogerdpack

unread,
Nov 2, 2009, 1:33:49 PM11/2/09
to jeweler.rb
>    gemspec.extensions = FileList["ext/**/extconf.rb"]

[in reply to other message].

appears that for building extensions you have two options--either
extconf.rb [builds a makefile] or mkrf_conf.rb [builds a rakefile].
So it's basically a sibling to extconf.rb

Also is there a link to the group on the main README? That might be
nice.

Thanks!
-r

Josh Nichols

unread,
Nov 2, 2009, 1:45:24 PM11/2/09
to jewel...@googlegroups.com
I'm not really familiar with mkrf, but... If gemspec.extensions
includes mkrf_conf.rb, does gem know what to do with it?

If so, that'd make sense to look for mkrf_conf.rb as well.

- Josh

rogerdpack

unread,
Dec 15, 2009, 12:54:34 PM12/15/09
to jeweler.rb
> I'm not really familiar with mkrf, but...  If gemspec.extensions
> includes mkrf_conf.rb, does gem know what to do with it?

Yeah it does. ex: faster_rubygems gem

-r
Reply all
Reply to author
Forward
0 new messages