how to add new perl modules to stock OE build?
(followup to earlier thread, but now that i have a better idea of
what i'm trying to do, i decided to start a new thread that should be more focused. apologies for dragging this out just a bit longer.)
as i posted earlier, i want to add some perl modules to a basic poky
build; in this case, building core-image-minimal for qemuppc, if that makes any difference.
initially, i went hunting for existing recipes for the modules i
wanted (meta-perl, meta-cpan, ...), until i noticed that the perl recipe directory contains a "perl-rdepends_5.22.1.inc" file, which as i read it defines all of the modules to be incorporated into the "perl-modules" package, so that *appears* to be the solution -- just extend the set of modules to be built by extending the contents of that file.
so, first, is that the recommended (or even correct) approach? as an
example, i want to add Text::Template; would that involve adding lines similar to the following?
RDEPENDS_${PN}-module-text-template += "${PN}-module-exporter" RDEPENDS_${PN}-module-text-template += "${PN}-module-strict" RDEPENDS_${PN}-module-text-template += "${PN}-module-vars"
(not saying that would be the *complete* set of lines for that module, only that that looks like a starting point.)
next, if that's a valid approach, i can see the code near the bottom
of perl_5.22.1.bb that appears to be taking care of creating the perl-modules package:
===== start =====
# Create a perl-modules package recommending all the other perl
# packages (actually the non modules packages and not created too) ALLOW_EMPTY_perl-modules = "1" PACKAGES_append = " perl-modules "
PACKAGESPLITFUNCS_prepend = "split_perl_packages "
python split_perl_packages () {
libdir = d.expand('${libdir}/perl/${PV}')
do_split_packages(d, libdir, 'auto/([^.]*)/[^/]*\.(so|ld|ix|al)', 'perl-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False)
do_split_packages(d, libdir, 'Module/([^\/]*)\.pm', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
do_split_packages(d, libdir, 'Module/([^\/]*)/.*', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
do_split_packages(d, libdir, '(^(?!(CPAN\/|CPANPLUS\/|Module\/|unicore\/|auto\/)[^\/]).*)\.(pm|pl|e2x)', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
# perl-modules should recommend every perl module, and only the
# modules. Don't attempt to use the result of do_split_packages() as some
# modules are manually split (eg. perl-module-unicore).
packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES', True).split())
d.setVar(d.expand("RRECOMMENDS_${PN}-modules"), ' '.join(packages))
}PACKAGES_DYNAMIC += "^perl-module-.*"
===== end =====
i sort of see what that's doing -- don't understand it completely,
but i'm assuming it's processing the contents of that .inc file to list all modules to be built and incorporated into the "perl-modules" dynamic package.
is this even remotely the right approach? is there an OE/YP manual
that explains this somewhere? thanks.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
======================================================================== ack ... never mind, i see my fundamental misunderstanding. i thought
all of the recipes being processed via the "perl-modules" package were being (if necessary) downloaded from CPAN, or something like that, then turned into installable rpms. i didn't look closely enough into the perl source to see that all the modules listed in "perl-rdepends_5.22.1.inc" are already in the perl source tree.
so i'm back to my original question -- what is the proper way to add
arbitrary perl modules to an image? if someone has a simple example of how it's done, that'd be great. as proof-of-concept, i'd like to add the Text::Template module to my "qemuppc" target.
thoughts? sorry for all the earlier noise, i thought i had it
figured out but ... no.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 8 lines · Robert P. J. Day
ack ... never mind, i see my fundamental misunderstanding. i thought
all of the recipes being processed via the "perl-modules" package were being (if necessary) downloaded from CPAN, or something like that, then turned into installable rpms. i didn't look closely enough into the perl source to see that all the modules listed in "perl-rdepends_5.22.1.inc" are already in the perl source tree.
Quoted 7 lines
so i'm back to my original question -- what is the proper way to add
arbitrary perl modules to an image? if someone has a simple example of how it's done, that'd be great. as proof-of-concept, i'd like to add theText::Templatemodule to my "qemuppc" target.thoughts? sorry for all the earlier noise, i thought i had it
figured out but ... no.
Hi,
Take a look at meta-perl in the meta-openembedded repository. It contains a lot of recipes for Perl modules (Text::Template isn't one of them though).
The cpan class in oe-core knows how to build Makefile.PL (ExtUtils::MakeMaker) based perl modules (like Text::Template), and cpan_build knows how to handle Build.PL (Module::Build) based perl modules.
Note also the naming convention of perl-module-foo is used by core modules (those shipped with perl itself); the convention used for third party cpan modules is "libfoo-perl", e.g. libtext-template-perl.
Hope this helps,
Signature · 1 line
olofjn
Quoted 15 lines · Olof Johansson
Quoted 14 lines · Robert P. J. Day
ack ... never mind, i see my fundamental misunderstanding. i
thought all of the recipes being processed via the "perl-modules" package were being (if necessary) downloaded from CPAN, or something like that, then turned into installable rpms. i didn't look closely enough into the perl source to see that all the modules listed in "perl-rdepends_5.22.1.inc" are already in the perl source tree.so i'm back to my original question -- what is the proper way to
add arbitrary perl modules to an image? if someone has a simple example of how it's done, that'd be great. as proof-of-concept, i'd like to add theText::Templatemodule to my "qemuppc" target.
Quoted 8 lines
Quoted 2 lines
thoughts? sorry for all the earlier noise, i thought i had it
figured out but ... no.Hi,
Take a look at meta-perl in the meta-openembedded repository. It contains a lot of recipes for Perl modules (
Text::Templateisn't one of them though).
yes, i *finally* clued in to how it's done ... i'll just start
whipping together recipes files for the modules i need, given that most of them will be standard boilerplate, it shouldn't take that long, just make a list and start writing.
Quoted 4 lines
The cpan class in oe-core knows how to build Makefile.PL (
ExtUtils::MakeMaker) based perl modules (likeText::Template), andcpan_buildknows how to handle Build.PL (Module::Build) based perl modules.
yup, i noticed that, too.
Quoted 4 lines
Note also the naming convention of perl-module-foo is used by core modules (those shipped with perl itself); the convention used for third party cpan modules is "libfoo-perl", e.g. libtext-template-perl.
ah, i was unaware of that, thanks. so i'll know how to name my
recipes now, thanks very much.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================