mount.sh: Fixed some small errors
[openembedded.git] / classes / cpan_build.bbclass
1 #
2 # This is for perl modules that use the new Build.PL build system
3 #
4 inherit cpan-base
5
6 NATIVE_INSTALL_WORKS = "1"
7
8 #
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)
13 #
14 def cpan_build_dep_prepend(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 '
21
22 DEPENDS_prepend = "${@cpan_build_dep_prepend(d)}"
23
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
40 }
41
42 cpan_build_do_compile () {
43         perl Build
44 }
45
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
52 }
53
54 EXPORT_FUNCTIONS do_configure do_compile do_install