merge of '8ee8881d5b5bf5ad5998774d3c0ce966a84a0abb'
[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
30         if test ${TARGET_ARCH} = "powerpc" ; then
31                 OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc"
32         fi
33
34
35         oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS
36 }
37
38 cpan_do_install () {
39         oe_runmake install_vendor
40 }
41
42 EXPORT_FUNCTIONS do_configure do_compile do_install