Integrating Inline-C-based module into a Perl distribution

Discussion in 'Perl Misc' started by Thomas, Sep 1, 2008.

  1. Thomas

    Thomas Guest

    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!
    Thomas, Sep 1, 2008
    #1
    1. Advertising

  2. Thomas

    sisyphus Guest

    On Sep 2, 1:49 am, Thomas <> wrote:
    ..
    ..
    > 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
    sisyphus, Sep 3, 2008
    #2
    1. Advertising

  3. Thomas

    sisyphus Guest

    On Sep 3, 9:43 am, sisyphus <> wrote:
    > On Sep 2, 1:49 am, Thomas <> wrote:

    ..
    ..
    > > 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.


    Ooh ... sorry, wrong link (I should have checked :)
    I thought that link you posted was a link to the Inline-FAQ. It's not.
    The Inline-FAQ is here:
    http://search.cpan.org/~ingy/Inline-0.44/Inline-FAQ.pod
    Look for the section "How do I create a binary distribution using
    Inline?".

    That's the documentation you need to read.

    Cheers,
    Rob
    sisyphus, Sep 3, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Webdiyer
    Replies:
    0
    Views:
    698
    Webdiyer
    Nov 18, 2003
  2. Spam Survivor
    Replies:
    3
    Views:
    491
    Nick Kew
    Sep 15, 2003
  3. Giampaolo Rodola'

    Integrating a GUI with an asyncore-based server

    Giampaolo Rodola', Oct 16, 2007, in forum: Python
    Replies:
    1
    Views:
    322
    Michele Simionato
    Oct 16, 2007
  4. Giampaolo Rodola'

    Integrating a GUI with an asyncore-based server

    Giampaolo Rodola', Oct 16, 2007, in forum: Python
    Replies:
    0
    Views:
    232
    Giampaolo Rodola'
    Oct 16, 2007
  5. Daryl Rose
    Replies:
    5
    Views:
    118
    Tad J McClellan
    Dec 14, 2007
Loading...

Share This Page