[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mkmf.rb Documentation

Brian Schröder

2/1/2005 9:11:00 PM

Hello Group,

does there exist a mkmf.rb documentation except for the page in the pickaxe? The code is not very readable and I have found nothing so far?

At the moment I am wondering if it is possible to generate Makefiles for the following task:

For an extension baz I have a directory structure like this:

baz/
baz/src/
baz/src/baz.rb
baz/src/baz.base.c
baz/src/foo/
baz/src/foo/foo.rb
baz/src/foo/foo.base.c
baz/src/bar/
baz/src/bar/bar.rb
baz/src/bar/bar.base.c

and I want mkmf to create makefiles that compile and copy the files to:

baz/lib/
baz/lib/baz.rb
baz/lib/baz.base.so
baz/lib/baz/foo.rb
baz/lib/baz/foo.base.so
baz/lib/baz/bar.rb
baz/lib/baz/bar.base.so

such that I can require my extensions as

require 'baz'
require 'baz/foo'
require 'baz/bar'

when I include the lib directory in the ruby search path.

thanks a lot,

Brian


3 Answers

Steven Jenkins

2/2/2005 12:49:00 AM

0

Brian Schröder wrote:
> does there exist a mkmf.rb documentation except for the page in the
> pickaxe? The code is not very readable and I have found nothing so
> far?

It's not exactly what you asked, but have you seen
http://i.loveruby.net/en/man/setup/i... That's what I've used to
package extension libraries.

Steve




Charles Mills

2/2/2005 1:37:00 AM

0

Brian,

Brian Schröder wrote:
> Hello Group,
>
> does there exist a mkmf.rb documentation except for the page in the
pickaxe? The code is not very readable and I have found nothing so far?
>
> At the moment I am wondering if it is possible to generate Makefiles
for the following task:
>
> For an extension baz I have a directory structure like this:
>
> baz/
> baz/src/
> baz/src/baz.rb
> baz/src/baz.base.c
> baz/src/foo/
> baz/src/foo/foo.rb
> baz/src/foo/foo.base.c
> baz/src/bar/
> baz/src/bar/bar.rb
> baz/src/bar/bar.base.c
>
So I assume you have a *.base.so file for each *.base.c file. Then you
should have a 'extconf.rb' file for each of these .so files. ie.
insert
baz/src/extconf.rb
baz/src/foo/extconf.rb
baz/src/bar/extconf.rb

> and I want mkmf to create makefiles that compile and copy the files
to:

Not really a job for 'mkmf.rb'... see below.

>
> baz/lib/
> baz/lib/baz.rb
> baz/lib/baz.base.so
> baz/lib/baz/foo.rb
> baz/lib/baz/foo.base.so
> baz/lib/baz/bar.rb
> baz/lib/baz/bar.base.so
>
> such that I can require my extensions as
>
> require 'baz'
> require 'baz/foo'
> require 'baz/bar'
>
> when I include the lib directory in the ruby search path.
>
This part is a job for 'setup.rb'. Put setup.rb in baz/ and create the
file 'pre-config.rb'.
Your 'pre-config.rb' file will do the following
For src/ and each directory in src/
1) run extconf.rb
2) run make
3) copy the .rb and .so files in the directory to baz/lib/baz/-d-/
where -d- is the current directory above src/

Seems like you cleaverly use Dir.[], Dir.chdir(), and system() to do
all this in a few lines of code.

-Charlie

Charles Mills

2/2/2005 2:01:00 AM

0

s/you cleaverly/you can cleverly/