diff options
| author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
|---|---|---|
| committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
| commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
| tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/classes/cpan.bbclass | |
| download | poky-daisy-140929.tar.gz | |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/classes/cpan.bbclass')
| -rw-r--r-- | meta/classes/cpan.bbclass | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass new file mode 100644 index 0000000000..7088039fa0 --- /dev/null +++ b/meta/classes/cpan.bbclass | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | # | ||
| 2 | # This is for perl modules that use the old Makefile.PL build system | ||
| 3 | # | ||
| 4 | inherit cpan-base perlnative | ||
| 5 | |||
| 6 | EXTRA_CPANFLAGS ?= "" | ||
| 7 | EXTRA_PERLFLAGS ?= "" | ||
| 8 | |||
| 9 | # Env var which tells perl if it should use host (no) or target (yes) settings | ||
| 10 | export PERLCONFIGTARGET = "${@is_target(d)}" | ||
| 11 | |||
| 12 | # Env var which tells perl where the perl include files are | ||
| 13 | export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}/CORE" | ||
| 14 | export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}" | ||
| 15 | export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}" | ||
| 16 | export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${@get_perl_version(d)}/" | ||
| 17 | |||
| 18 | cpan_do_configure () { | ||
| 19 | export PERL5LIB="${PERL_ARCHLIB}" | ||
| 20 | yes '' | perl ${EXTRA_PERLFLAGS} Makefile.PL ${EXTRA_CPANFLAGS} | ||
| 21 | |||
| 22 | # Makefile.PLs can exit with success without generating a | ||
| 23 | # Makefile, e.g. in cases of missing configure time | ||
| 24 | # dependencies. This is considered a best practice by | ||
| 25 | # cpantesters.org. See: | ||
| 26 | # * http://wiki.cpantesters.org/wiki/CPANAuthorNotes | ||
| 27 | # * http://www.nntp.perl.org/group/perl.qa/2008/08/msg11236.html | ||
| 28 | [ -e Makefile ] || bbfatal "No Makefile was generated by Makefile.PL" | ||
| 29 | |||
| 30 | if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then | ||
| 31 | . ${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh | ||
| 32 | # Use find since there can be a Makefile generated for each Makefile.PL | ||
| 33 | for f in `find -name Makefile.PL`; do | ||
| 34 | f2=`echo $f | sed -e 's/.PL//'` | ||
| 35 | test -f $f2 || continue | ||
| 36 | sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \ | ||
| 37 | -e 's/perl.real/perl/' \ | ||
| 38 | -e "s|^\(CCFLAGS =.*\)|\1 ${CFLAGS}|" \ | ||
| 39 | $f2 | ||
| 40 | done | ||
| 41 | fi | ||
| 42 | } | ||
| 43 | |||
| 44 | cpan_do_compile () { | ||
| 45 | oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}" | ||
| 46 | } | ||
| 47 | |||
| 48 | cpan_do_install () { | ||
| 49 | oe_runmake DESTDIR="${D}" install_vendor | ||
| 50 | for PERLSCRIPT in `grep -rIEl '#!${bindir}/perl-native.*/perl' ${D}`; do | ||
| 51 | sed -i -e 's|^#!${bindir}/perl-native.*/perl|#!/usr/bin/env nativeperl|' $PERLSCRIPT | ||
| 52 | done | ||
| 53 | } | ||
| 54 | |||
| 55 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||
