blob: 18f1b9d575edff87dee50cde9afb1a8674237a74 [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
Brad Bishop19323692019-04-05 15:28:33 -040013export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE"
14export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}"
15export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
16export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/"
17export PERLHOSTARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/${@get_perl_hostarch(d)}/"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018
19cpan_do_configure () {
Brad Bishop19323692019-04-05 15:28:33 -040020 yes '' | perl ${EXTRA_PERLFLAGS} Makefile.PL INSTALLDIRS=vendor NO_PERLLOCAL=1 NO_PACKLIST=1 PERL=$(which perl) ${EXTRA_CPANFLAGS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021
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
Brad Bishop19323692019-04-05 15:28:33 -040031 . ${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/config.sh
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032 # 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
Patrick Williams213cb262021-08-07 19:21:33 -050044do_configure:append:class-target() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045 find . -name Makefile | xargs sed -E -i \
46 -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
47}
48
Patrick Williams213cb262021-08-07 19:21:33 -050049do_configure:append:class-nativesdk() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080050 find . -name Makefile | xargs sed -E -i \
51 -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
52}
53
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054cpan_do_compile () {
55 oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
56}
57
58cpan_do_install () {
59 oe_runmake DESTDIR="${D}" install_vendor
60 for PERLSCRIPT in `grep -rIEl '#! *${bindir}/perl-native.*/perl' ${D}`; do
61 sed -i -e 's|${bindir}/perl-native.*/perl|/usr/bin/env nativeperl|' $PERLSCRIPT
62 done
63}
64
65EXPORT_FUNCTIONS do_configure do_compile do_install