angstrom: prefer the git version of tslib
[openembedded.git] / classes / cpan-base.bbclass
blob53621edc62e4818b781ae736b5f3e39805a6d55c
2 # cpan-base providers various perl related information needed for building
3 # cpan modules
5 FILES_${PN} += "${libdir}/perl5 ${datadir}/perl5"
7 DEPENDS  += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}"
8 RDEPENDS_${PN}  += "${@["perl", ""][(bb.data.inherits_class('native', d))]}"
10 # Determine the staged version of perl from the perl configuration file
11 def get_perl_version(d):
12         import re
13         cfg = bb.data.expand('${STAGING_LIBDIR}/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
27 # Determine where the library directories are
28 def perl_get_libdirs(d):
29         libdir = bb.data.getVar('libdir', d, 1)
30         libdirs = libdir + '/perl5'
31         return libdirs
33 def is_target(d):
34     if not bb.data.inherits_class('native', d):
35         return bb.data.expand('${TARGET_SYS}', d)
36     return ""
38 PERLLIBDIRS = "${@perl_get_libdirs(d)}"
40 FILES_${PN}-dbg += "${PERLLIBDIRS}/auto/*/.debug \
41                     ${PERLLIBDIRS}/auto/*/*/.debug \
42                     ${PERLLIBDIRS}/auto/*/*/*/.debug"
44 # Env var which tells perl if it should use host ('') or target ('$TARGET_SYS') settings
45 export PERLCONFIGTARGET = "${@is_target(d)}"
47 EXTRA_CPANFLAGS ?= ""
49 # Env var which tells perl where the perl include files are
50 export PERL_INC = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}/CORE"
51 export PERL_LIB = "${STAGING_DATADIR}/perl/${@get_perl_version(d)}"
52 export PERL_ARCHLIB = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}"