diff options
Diffstat (limited to 'meta/classes/cpan_build.bbclass')
-rw-r--r-- | meta/classes/cpan_build.bbclass | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/classes/cpan_build.bbclass b/meta/classes/cpan_build.bbclass new file mode 100644 index 0000000000..2eb8162314 --- /dev/null +++ b/meta/classes/cpan_build.bbclass | |||
@@ -0,0 +1,53 @@ | |||
1 | # | ||
2 | # This is for perl modules that use the new Build.PL build system | ||
3 | # | ||
4 | inherit cpan-base perlnative | ||
5 | |||
6 | EXTRA_CPAN_BUILD_FLAGS ?= "" | ||
7 | |||
8 | # Env var which tells perl if it should use host (no) or target (yes) settings | ||
9 | export PERLCONFIGTARGET = "${@is_target(d)}" | ||
10 | export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}" | ||
11 | export LD = "${CCLD}" | ||
12 | |||
13 | # | ||
14 | # We also need to have built libmodule-build-perl-native for | ||
15 | # everything except libmodule-build-perl-native itself (which uses | ||
16 | # this class, but uses itself as the provider of | ||
17 | # libmodule-build-perl) | ||
18 | # | ||
19 | def cpan_build_dep_prepend(d): | ||
20 | if d.getVar('CPAN_BUILD_DEPS', True): | ||
21 | return '' | ||
22 | pn = d.getVar('PN', True) | ||
23 | if pn in ['libmodule-build-perl', 'libmodule-build-perl-native']: | ||
24 | return '' | ||
25 | return 'libmodule-build-perl-native ' | ||
26 | |||
27 | DEPENDS_prepend = "${@cpan_build_dep_prepend(d)}" | ||
28 | |||
29 | cpan_build_do_configure () { | ||
30 | if [ "${@is_target(d)}" = "yes" ]; then | ||
31 | # build for target | ||
32 | . ${STAGING_LIBDIR}/perl/config.sh | ||
33 | fi | ||
34 | |||
35 | perl Build.PL --installdirs vendor \ | ||
36 | --destdir ${D} \ | ||
37 | --install_path arch="${libdir}/perl" \ | ||
38 | --install_path script=${bindir} \ | ||
39 | --install_path bin=${bindir} \ | ||
40 | --install_path bindoc=${mandir}/man1 \ | ||
41 | --install_path libdoc=${mandir}/man3 \ | ||
42 | ${EXTRA_CPAN_BUILD_FLAGS} | ||
43 | } | ||
44 | |||
45 | cpan_build_do_compile () { | ||
46 | perl Build | ||
47 | } | ||
48 | |||
49 | cpan_build_do_install () { | ||
50 | perl Build install | ||
51 | } | ||
52 | |||
53 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||