Integrating Inline-C-based module into a Perl distribution


T

Thomas

I want to integrate my module Foo.pm which relies on Inline::C into an
existing Perl distribution. Luckily, I can add directories and files to
perl/site/lib and perl/site/lib/auto as I please and give the complete
Perl directory tree to the user to run it. (I *don't* want my module to
become a part of any official distribution or CPAN, that's not what this
is about.)

However, I still set libraries I depend on as absolute paths in the LIBS
setting of my use Inline statement (..., 'LIBS => c:/foo/bar.lib', ...).
Unfortunately, I can't keep doing that. I can't influence where the perl
directory tree will be installed (could be c:\perl, d:\perl). What am I
supposed to use as LIBS value? Where should the .lib files (or .so under
Unix) go?

What's the standard way of distributing a module like mine? I have seen
the Math::Simple example in
http://search.cpan.org/~ingy/Inline-0.44/Inline.pod#Writing_Modules_with_Inline
However, I haven't followed that way (calling h2xs -PAXn Math::Simple
and extending that). I have two Windows .lib files I depend on and the
DLL and other files Inline created in
/build/Foo_a3d7/blib/arch/auto/Foo_a3d7 Everything works fine with
absolute paths, but the exact configuration is my (last) obstacle. BTW,
I also depend on the files Inline built to remain unchanged -- the
user's system does not have a compiler or make to do the compilation.

Thanks in advance!
 
Ad

Advertisements

S

sisyphus

..
..
However, I still set libraries I depend on as absolute paths in the LIBS
setting of my use Inline statement (..., 'LIBS => c:/foo/bar.lib', ...)..
Unfortunately, I can't keep doing that.

Actually, you *can* keep doing that. That config info is used only
during compilation of the C code. Since the user doesn't have a
compiler, and since you're distributing pre-compiled binaries, there
will be no compilation done on the users machine. The LIBS setting
won't even be looked at ... you can ignore this aspect completely.
I can't influence where the perl
directory tree will be installed (could be c:\perl, d:\perl). What am I
supposed to use as LIBS value? Where should the .lib files (or .so under
Unix) go?

Those .lib files don't need to distributed at all. If they are import
libs for dlls, then the user needs only those dll's (as well as the
dll's that inline built). If those .lib files are static libraries,
then their functionality will have already been incorporated into the
dll's that inline built. Either way, there's no need to distribute
those .lib files.
What's the standard way of distributing a module like mine? I have seen
the Math::Simple example inhttp://search.cpan.org/~ingy/Inline-0.44/Inline.pod#Writing_Modules_w...

I think that's the best way to go in your case. Another alternative is
to rewrite your module as a "normal" cpan-type distribution - that has
no dependency upon Inline::C. (InlineX::C2XS can help with that - it
will write your XS file for you, even a Makefile.PL and .pm file if
you want.) Then you can build your module in the usual way and
distribute the package as a "normal" ppm.
Everything works fine with
absolute paths, but the exact configuration is my (last) obstacle. BTW,
I also depend on the files Inline built to remain unchanged -- the
user's system does not have a compiler or make to do the compilation.

Also, with this approach, the user's system will need to have the
Inline module installed. And if the user changes the C code in any
way, then Inline is going to want to re-compile ... which it can't do.
Better to go with the method outlined in the Inline-FAQ you referenced
above. I'm assuming that method removes the Inline dependency, as is
implied in that Inline-FAQ ... I *think* it does.

Cheers,
Rob
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top