Openembedded Core Discussions
 help / color / mirror / Atom feed
* how to add new perl modules to stock OE build?
@ 2016-10-27  9:52 Robert P. J. Day
  2016-10-27 12:46 ` Robert P. J. Day
  0 siblings, 1 reply; 4+ messages in thread
From: Robert P. J. Day @ 2016-10-27  9:52 UTC (permalink / raw)
  To: OE Core mailing list


  (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

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to add new perl modules to stock OE build?
  2016-10-27  9:52 how to add new perl modules to stock OE build? Robert P. J. Day
@ 2016-10-27 12:46 ` Robert P. J. Day
  2016-10-27 13:26   ` Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Robert P. J. Day @ 2016-10-27 12:46 UTC (permalink / raw)
  To: OE Core mailing list


  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

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to add new perl modules to stock OE build?
  2016-10-27 12:46 ` Robert P. J. Day
@ 2016-10-27 13:26   ` Olof Johansson
  2016-10-27 13:55     ` Robert P. J. Day
  0 siblings, 1 reply; 4+ messages in thread
From: Olof Johansson @ 2016-10-27 13:26 UTC (permalink / raw)
  To: Robert P. J. Day, OE Core mailing list

On 16-10-27 08:46 -0400, Robert P. J. Day wrote:
> 
>   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.

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,
-- 
olofjn


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to add new perl modules to stock OE build?
  2016-10-27 13:26   ` Olof Johansson
@ 2016-10-27 13:55     ` Robert P. J. Day
  0 siblings, 0 replies; 4+ messages in thread
From: Robert P. J. Day @ 2016-10-27 13:55 UTC (permalink / raw)
  To: Olof Johansson; +Cc: OE Core mailing list

On Thu, 27 Oct 2016, Olof Johansson wrote:

> On 16-10-27 08:46 -0400, Robert P. J. Day wrote:
> >
> >   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.
>
> 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).

  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.

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

  yup, i noticed that, too.

> 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

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-27 13:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-27  9:52 how to add new perl modules to stock OE build? Robert P. J. Day
2016-10-27 12:46 ` Robert P. J. Day
2016-10-27 13:26   ` Olof Johansson
2016-10-27 13:55     ` Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox