Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

How do I configure Module::Build to build multiple packages from the same lib directory?

by ELISHEVA (Prior)
on Oct 29, 2008 at 18:39 UTC ( [id://720286]=perlquestion: print w/replies, xml ) Need Help??

ELISHEVA has asked for the wisdom of the Perl Monks concerning the following question:

I am preparing some modules for release on CPAN. The code consists of a core group of modules and several modules defining optional extensions. I would like to release the core and four extension modules as separate packages.

The Module::Build documentation (tutorials, cookbooks, etc) all seem to assume that one is building a single tarball for distribution rather than five at once with one that should be defined as the precursor of the other four.

All the examples using precursors also assume that the precursor modules are already installed rather than one of the packages that need to be built. I can't seem to find any examples or discussions explaining how I can

  1. use Module::Build to let me build five modules
  2. declare one of those modules as a precursor of the others.

If some one knows some links with examples or has some practical experience of their own to share, I would be most grateful. I'm not stuck on Module::Build - if there are better tools out there for building multiple tarballs, I welcome recommendations.

Many thanks in advance, beth
  • Comment on How do I configure Module::Build to build multiple packages from the same lib directory?

Replies are listed 'Best First'.
Re: How do I configure Module::Build to build multiple packages from the same lib directory?
by ig (Vicar) on Oct 31, 2008 at 01:28 UTC

    Maybe you can write multiple Build.PL and MANIFEST files (e.g. Build.PL.p1, MANIFEST.p1, Build.PL.p2, MANIFEST.p2, etc.), one for each package you want to produce, and write a script to copy these to the standard names before building each package. The MANIFEST can include only the files you want in the package.

    Update: Here is a very crude script which demonstrates my suggestion.

      Thanks for the concrete example!

      I'm thinking though it might be easier to link the codebase lib directory into the build directory rather than the other way around, e.g.

      #error checking, use... omitted #may have typos - read as perl-ish pseudocode my @buildirs = ("foo1", "foo2"); my $repo="myrepo"; my $startdir=File::Spec::curdir(); foreach my $buildme (@buildirs) { chdir($buildme); symlink($repo, "lib"); system("perl Build.PL"); unlink("lib"); } chdir($startdir);
      The advantage of this approach is that I don't have to have to make assumptions about the support files used by the build process, e.g. is there a MANIFEST.SKIP? is there a special subclass of Module::Build that needs other kinds of support files?, etc, etc.

      The main disadvantage of any linking approach is that it isn't well behaved on MS-Win platforms. Although I do most of my development on Linux, there are situations when I need to work on MS machines. Cygwin/Vista has a particularly nasty bug where un-linking a symbolic link defined in Vista via anything using cygwin libraries not only removes the link, but also the underlying file or directory!

      beth
Re: How do I configure Module::Build to build multiple packages from the same lib directory?
by Anonymous Monk on Oct 30, 2008 at 10:38 UTC

      Thank-you for taking the time to consider my question, but it isn't quite what I am looking for. My question concerns the process used to create what is uploaded to CPAN, not its final form.

      As for the final form: A bundle isn't really necessary in this case. Once the tarballs are constructed and uploaded to CPAN, it is pretty easy to insure that downloading an extension tarball triggers the downloading of the core package. Each CPAN package merely needs to declare the core package as a prerequisite. Once that is done, any user who instructs CPAN/CPAN-PLUS to follow all prerequisites will automatically download the core module along with the desired extensions.

      beth
        My question concerns the process used to create what is uploaded to CPAN, not its final form.
        Could have fooled me :) Maybe this
        % cd one-dist % perl Build.PL % perl build dist % cpan-upload -verbose one-dist-0.1.tar.gz % cd .. % cd two-dist % perl Build.PL % perl build dist % cpan-upload -verbose two-dist-0.1.tar.gz
        if thats not it, maybe you can explain better what you're asking :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://720286]
Approved by toolic
Front-paged by almut
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found