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
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 setup.rb User Manual? That's what I've used to package extension libraries.
Steve
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
s/you cleaverly/you can cleverly/