blob: 7810a4dc61c49b6adde28bce8bc02bca585b0f89 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#
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 \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050052 ${PERLLIBDIRS}/auto/*/*/*/*/.debug \
53 ${PERLLIBDIRS}/auto/*/*/*/*/*/.debug \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/.debug \
55 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/*/.debug \
56 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/*/*/.debug \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050057 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/*/*/*/.debug \
58 ${PERLLIBDIRS}/vendor_perl/${PERLVERSION}/auto/*/*/*/*/*/.debug \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059 "