merge of '3a4c124aa9688e101e4d5547ad18d4512d45e47b'
[openembedded.git] / classes / cpan.bbclass
1 #
2 # This is for perl modules that use the old Makefile.PL build system
3 #
4 FILES_${PN} += '${libdir}/perl5'
5 EXTRA_CPANFLAGS = ""
6
7 DEPENDS  += "perl-native"
8 RDEPENDS += "perl"
9
10 cpan_do_configure () {
11         perl Makefile.PL ${EXTRA_CPANFLAGS}
12         if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
13                 . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh
14                 sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \
15                        -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \
16                        -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \
17                        -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \
18                        -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \
19                        Makefile
20         fi
21 }
22
23 cpan_do_compile () {
24         # You must use gcc to link on sh
25         OPTIONS=""
26         if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then
27                 OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc"
28         fi
29         oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS
30 }
31
32 cpan_do_install () {
33         oe_runmake install_vendor
34 }
35
36 EXPORT_FUNCTIONS do_configure do_compile do_install