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

I've been doing something for a while now and I'm pretty sure this is wrong. I build a distribution tree for a device. Once the tree is complete I use mkcramfs to create a tiny image and then make it part of a package that can be written to the devices flash. Both the device and my workstation are x86 so cross-compiling is not an issue. When I make build perl I do it like this
make make DESTDIR=/tmp/perl install
I now have a perl tree in /tmp/perl that has the prefix of /opt/perl. To build modules I have them in my Makefile listed in order of dependence. I have each module untarred
ln -s /tmp/perl/opt/perl ${TEMPLATEE_ROOT}/opt/perl for i in each_module (cd $i && /opt/perl/bin/perl Makefile.PL && make install) done
I simplified the code above to simply show what I'm doing. Before I squash the template I remove that link and copy /tmp/perl/opt/perl into ${TEMPLATE_ROOT}/opt/.

What is the best way to do this?

1. Copy all my modules into the perl source tree and build it as part of the perl build?

2. Use CPAN to install them from the drive? Not online since I want to maintain module versions.

The only issue I see here is where I need to specify library paths, like when building DBD::mysql, or interacting when 'perl Makefile.PL' asks me a question. I can scrip that.

I do have my own MYMakefile in each module tree that takes care of using Build or Makefile.PL when required.

I can provide my makefile if needed so you can see what I'm doing. This method I'm using is a pain and hard to maintain as the modules numbers grow.

Thanks, Chris

Replies are listed 'Best First'.
Re: Building CPAN modules for new tree
by taint (Chaplain) on May 22, 2014 at 03:55 UTC
    Greetings, linxdev.

    I dunno. Seems to me, you've already pretty much scripted the whole operation up already.

    As to those things needing external libs, and such; is there any issue(s) saving those operations for after Perl's been written to the flash drive? Won't Perl be used from the Flash drive anyway?

    Well. Unless I somehow misunderstood your goal. Seems to me, any of the "troublesome" operations, could simply be done after Perl has been written to the Flash drive.

    All the best.

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

      Once the image is written to flash no modules can be added. They image is small and loaded as a ram drive. Any changes to that are volatile on restart. There is no compiler either on the system.
        Ahh. I wasn't privy to that little important detail. :)

        --Chris

        ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Re: Building CPAN modules for new tree
by Anonymous Monk on May 22, 2014 at 21:01 UTC
      Borderline information-overload.

      But rather enlightening. Who knew there were so many possibilities.
      What with the CPAN, it's no wonder, so many people choose Perl, over other languages. :)

      --Chris

      ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH