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