cpan_build.bbclass 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # This is for perl modules that use the new Build.PL build system
  3. #
  4. inherit cpan-base perlnative
  5. EXTRA_CPAN_BUILD_FLAGS ?= ""
  6. # Env var which tells perl if it should use host (no) or target (yes) settings
  7. export PERLCONFIGTARGET = "${@is_target(d)}"
  8. export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
  9. export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/"
  10. export PERLHOSTARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/${@get_perl_hostarch(d)}/"
  11. export LD = "${CCLD}"
  12. cpan_build_do_configure () {
  13. if [ "${@is_target(d)}" = "yes" ]; then
  14. # build for target
  15. . ${STAGING_LIBDIR}/perl5/config.sh
  16. fi
  17. perl Build.PL --installdirs vendor --destdir ${D} \
  18. ${EXTRA_CPAN_BUILD_FLAGS}
  19. # Build.PLs can exit with success without generating a
  20. # Build, e.g. in cases of missing configure time
  21. # dependencies. This is considered a best practice by
  22. # cpantesters.org. See:
  23. # * http://wiki.cpantesters.org/wiki/CPANAuthorNotes
  24. # * http://www.nntp.perl.org/group/perl.qa/2008/08/msg11236.html
  25. [ -e Build ] || bbfatal "No Build was generated by Build.PL"
  26. }
  27. cpan_build_do_compile () {
  28. perl Build --perl "${bindir}/perl" verbose=1
  29. }
  30. cpan_build_do_install () {
  31. perl Build install --destdir ${D}
  32. }
  33. EXPORT_FUNCTIONS do_configure do_compile do_install