update-rc.d: update package LICENSE
[openembedded.git] / classes / cpan_build.bbclass
blob15c93fb56d20547aa689c6aa4fdc4e6b5962a445
2 # This is for perl modules that use the new Build.PL build system
4 inherit cpan-base
6 NATIVE_INSTALL_WORKS = "1"
9 # We also need to have built libmodule-build-perl-native for
10 # everything except libmodule-build-perl-native itself (which uses
11 # this class, but uses itself as the provider of
12 # libmodule-build-perl)
14 def cpan_build_deps(d):
15         if bb.data.getVar('CPAN_BUILD_DEPS', d, 1):
16                 return ''
17         pn = bb.data.getVar('PN', d, 1)
18         if pn in ['libmodule-build-perl', 'libmodule-build-perl-native']:
19                 return ''
20         return 'libmodule-build-perl-native '
22 DEPENDS_prepend = "${@cpan_build_deps(d)}"
24 cpan_build_do_configure () {
25         if [ ${@is_target(d)} == "yes" ]; then
26                 # build for target
27                 . ${STAGING_LIBDIR}/perl/config.sh
28                 perl Build.PL --installdirs vendor \
29                         --destdir ${D} \
30                         --install_path lib="${datadir}/perl5" \
31                         --install_path arch="${libdir}/perl5" \
32                         --install_path script=${bindir} \
33                         --install_path bin=${bindir} \
34                         --install_path bindoc=${mandir}/man1 \
35                         --install_path libdoc=${mandir}/man3
36         else
37                 # build for host
38                 perl Build.PL --installdirs site
39         fi
42 cpan_build_do_compile () {
43         perl Build
46 cpan_build_do_install () {
47         if [ ${@is_target(d)} == "yes" ]; then
48                 perl Build install
49         else
50                 perl Build install destdir="${WORKDIR}/image"
51         fi
54 EXPORT_FUNCTIONS do_configure do_compile do_install