blob: a5bc301898dd9f8d1d296b3f9b9940c9309eef2f [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#
2# This is for perl modules that use the old Makefile.PL build system
3#
4inherit cpan-base perlnative
5
6EXTRA_CPANFLAGS ?= ""
7EXTRA_PERLFLAGS ?= ""
8
9# Env var which tells perl if it should use host (no) or target (yes) settings
10export PERLCONFIGTARGET = "${@is_target(d)}"
11
12# Env var which tells perl where the perl include files are
13export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}/CORE"
14export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
15export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}"
16export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${@get_perl_version(d)}/"
17
18cpan_do_configure () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019 yes '' | perl ${EXTRA_PERLFLAGS} Makefile.PL INSTALLDIRS=vendor NO_PERLLOCAL=1 NO_PACKLIST=1 ${EXTRA_CPANFLAGS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020
21 # Makefile.PLs can exit with success without generating a
22 # Makefile, e.g. in cases of missing configure time
23 # dependencies. This is considered a best practice by
24 # cpantesters.org. See:
25 # * http://wiki.cpantesters.org/wiki/CPANAuthorNotes
26 # * http://www.nntp.perl.org/group/perl.qa/2008/08/msg11236.html
27 [ -e Makefile ] || bbfatal "No Makefile was generated by Makefile.PL"
28
29 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
30 . ${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh
31 # Use find since there can be a Makefile generated for each Makefile.PL
32 for f in `find -name Makefile.PL`; do
33 f2=`echo $f | sed -e 's/.PL//'`
34 test -f $f2 || continue
35 sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
36 -e 's/perl.real/perl/' \
37 -e "s|^\(CCFLAGS =.*\)|\1 ${CFLAGS}|" \
38 $f2
39 done
40 fi
41}
42
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080043do_configure_append_class-target() {
44 find . -name Makefile | xargs sed -E -i \
45 -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
46}
47
48do_configure_append_class-nativesdk() {
49 find . -name Makefile | xargs sed -E -i \
50 -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
51}
52
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053cpan_do_compile () {
54 oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
55}
56
57cpan_do_install () {
58 oe_runmake DESTDIR="${D}" install_vendor
59 for PERLSCRIPT in `grep -rIEl '#! *${bindir}/perl-native.*/perl' ${D}`; do
60 sed -i -e 's|${bindir}/perl-native.*/perl|/usr/bin/env nativeperl|' $PERLSCRIPT
61 done
62}
63
64EXPORT_FUNCTIONS do_configure do_compile do_install