2 # This is for perl modules that use the old Makefile.PL build system
4 FILES_${PN} += '${libdir}/perl5 ${datadir}/perl5'
7 DEPENDS += "perl-native"
10 # Determine the staged version of perl from the perl configuration file
11 def get_perl_version(d):
13 cfg = bb.data.expand('${STAGING_DIR}/${HOST_SYS}/perl/config.sh', d)
20 r = re.compile("version='(\d\.\d\.\d)'")
27 # Only 5.8.7 and 5.8.4 existed at the time we moved to the new layout
29 ver = get_perl_version(d)
30 if ver == "5.8.4" or ver == "5.8.7":
34 # Determine where the library directories are
35 def perl_get_libdirs(d):
37 libdir = bb.data.getVar('libdir', d, 1)
38 if is_new_perl(d) == "yes":
39 libdirs = libdir + '/perl5'
41 libdirs = libdir + '/*/*/perl5'
46 if not bb.data.inherits_class('native', d):
50 IS_NEW_PERL = "${@is_new_perl(d)}"
51 PERLLIBDIRS = "${@perl_get_libdirs(d)}"
53 # Env var which tells perl if it should use host (no) or target (yes) settings
54 export PERLCONFIGTARGET = "${@is_target(d)}"
56 cpan_do_configure () {
57 perl Makefile.PL ${EXTRA_CPANFLAGS}
58 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
59 . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh
60 if [ "${IS_NEW_PERL}" = "yes" ]; then
61 sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \
62 -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \
63 -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${datadir}/perl5:" \
64 -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5:" \
65 -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \
68 sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \
69 -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \
70 -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \
71 -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \
72 -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \
79 if [ "${IS_NEW_PERL}" = "yes" ]; then
80 oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}"
82 # You must use gcc to link on sh
84 if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then
85 OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc"
87 if test ${TARGET_ARCH} = "powerpc" ; then
88 OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc"
90 oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS
95 oe_runmake install_vendor
98 EXPORT_FUNCTIONS do_configure do_compile do_install