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 0000000000..a5fdb33895
--- /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}/perl5 ${datadir}/perl5"
6
7DEPENDS += "perl perl-native"
8RDEPENDS += "perl"
9
10# Determine the staged version of perl from the perl configuration file
11def get_perl_version(d):
12 import os, bb, re
13 cfg = bb.data.expand('${STAGING_DIR}/${HOST_SYS}/perl/config.sh', d)
14 try:
15 f = open(cfg, 'r')
16 except IOError:
17 return None
18 l = f.readlines();
19 f.close();
20 r = re.compile("version='(\d\.\d\.\d)'")
21 for s in l:
22 m = r.match(s)
23 if m:
24 return m.group(1)
25 return None
26
27# Only 5.8.7 and 5.8.4 existed at the time we moved to the new layout
28def is_new_perl(d):
29 ver = get_perl_version(d)
30 if ver == "5.8.4" or ver == "5.8.7":
31 return "no"
32 return "yes"
33
34# Determine where the library directories are
35def perl_get_libdirs(d):
36 import bb
37 libdir = bb.data.getVar('libdir', d, 1)
38 if is_new_perl(d) == "yes":
39 libdirs = libdir + '/perl5'
40 else:
41 libdirs = libdir + '/*/*/perl5'
42 return libdirs
43
44def is_target(d):
45 import bb
46 if not bb.data.inherits_class('native', d):
47 return "yes"
48 return "no"
49
50IS_NEW_PERL = "${@is_new_perl(d)}"
51PERLLIBDIRS = "${@perl_get_libdirs(d)}"
52
53FILES_${PN}-dbg += "${PERLLIBDIRS}/auto/*/.debug \
54 ${PERLLIBDIRS}/auto/*/*/.debug \
55 ${PERLLIBDIRS}/auto/*/*/*/.debug"