summaryrefslogtreecommitdiffstats
path: root/meta/classes/cpan-base.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/cpan-base.bbclass')
-rw-r--r--meta/classes/cpan-base.bbclass55
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/classes/cpan-base.bbclass b/meta/classes/cpan-base.bbclass
new file mode 100644
index 0000000..d9817ba
--- /dev/null
+++ b/meta/classes/cpan-base.bbclass
@@ -0,0 +1,55 @@
1#
2# cpan-base providers various perl related information needed for building
3# cpan modules
4#
5FILES_${PN} += "${libdir}/perl ${datadir}/perl"
6
7DEPENDS += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}"
8RDEPENDS_${PN} += "${@["perl", ""][(bb.data.inherits_class('native', d))]}"
9
10PERL_OWN_DIR = "${@["", "/perl-native"][(bb.data.inherits_class('native', d))]}"
11
12# Determine the staged version of perl from the perl configuration file
13# Assign vardepvalue, because otherwise signature is changed before and after
14# perl is built (from None to real version in config.sh).
15get_perl_version[vardepvalue] = "${PERL_OWN_DIR}"
16def get_perl_version(d):
17 import re
18 cfg = d.expand('${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh')
19 try:
20 f = open(cfg, 'r')
21 except IOError:
22 return None
23 l = f.readlines();
24 f.close();
25 r = re.compile("^version='(\d*\.\d*\.\d*)'")
26 for s in l:
27 m = r.match(s)
28 if m:
29 return m.group(1)
30 return None
31
32# Determine where the library directories are
33def perl_get_libdirs(d):
34 libdir = d.getVar('libdir', True)
35 if is_target(d) == "no":
36 libdir += '/perl-native'
37 libdir += '/perl'
38 return libdir
39
40def is_target(d):
41 if not bb.data.inherits_class('native', d):
42 return "yes"
43 return "no"
44
45PERLLIBDIRS := "${@perl_get_libdirs(d)}"
46PERLVERSION := "${@get_perl_version(d)}"
47PERLVERSION[vardepvalue] = ""
48
49FILES_${PN}-dbg += "${PERLLIBDIRS}/auto/*/.debug \
50 ${PERLLIBDIRS}/auto/*/*/.debug \
51 ${PERLLIBDIRS}/auto/*/*/*/.debug \
52 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/.debug \
53 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/*/.debug \
54 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/*/*/.debug \
55 "