Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | require perl.inc |
| 2 | |
| 3 | SRC_URI += "\ |
| 4 | file://Configure-multilib.patch \ |
| 5 | file://perl-configpm-switch.patch \ |
| 6 | file://native-nopacklist.patch \ |
| 7 | file://native-perlinc.patch \ |
| 8 | file://MM_Unix.pm.patch \ |
| 9 | file://debian/errno_ver.diff \ |
| 10 | file://dynaloaderhack.patch \ |
| 11 | file://perl-PathTools-don-t-filter-out-blib-from-INC.patch \ |
| 12 | " |
| 13 | |
| 14 | SRC_URI[md5sum] = "ff0f09b17de426eff323426cb140ee79" |
| 15 | SRC_URI[sha256sum] = "be83ead0c5c26cbbe626fa4bac1a4beabe23a9eebc15d35ba49ccde11878e196" |
| 16 | |
| 17 | inherit native |
| 18 | |
| 19 | NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}" |
| 20 | |
| 21 | export LD="${CCLD}" |
| 22 | |
| 23 | do_configure () { |
| 24 | ./Configure \ |
| 25 | -Dcc="${CC}" \ |
| 26 | -Dcflags="${CFLAGS}" \ |
| 27 | -Dldflags="${LDFLAGS}" \ |
| 28 | -Dcf_by="Open Embedded" \ |
| 29 | -Dprefix=${prefix} \ |
| 30 | -Dvendorprefix=${prefix} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | -Dsiteprefix=${prefix} \ |
| 32 | \ |
| 33 | -Dbin=${STAGING_BINDIR}/${PN} \ |
| 34 | -Dprivlib=${STAGING_LIBDIR}/perl/${PV} \ |
| 35 | -Darchlib=${STAGING_LIBDIR}/perl/${PV} \ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 36 | -Dvendorlib=${STAGING_LIBDIR}/perl/vendor_perl/${PV} \ |
| 37 | -Dvendorarch=${STAGING_LIBDIR}/perl/vendor_perl/${PV} \ |
| 38 | -Dsitelib=${STAGING_LIBDIR}/perl/site_perl/${PV} \ |
| 39 | -Dsitearch=${STAGING_LIBDIR}/perl/site_perl/${PV} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | \ |
| 41 | -Duseshrplib \ |
| 42 | -Dusethreads \ |
| 43 | -Duseithreads \ |
| 44 | -Duselargefiles \ |
| 45 | -Dnoextensions=ODBM_File \ |
| 46 | -Ud_dosuid \ |
| 47 | -Ui_db \ |
| 48 | -Ui_ndbm \ |
| 49 | -Ui_gdbm \ |
| 50 | -Ui_gdbm_ndbm \ |
| 51 | -Ui_gdbmndbm \ |
| 52 | -Di_shadow \ |
| 53 | -Di_syslog \ |
| 54 | -Duseperlio \ |
| 55 | -Dman3ext=3pm \ |
| 56 | -Dsed=/bin/sed \ |
| 57 | -Uafs \ |
| 58 | -Ud_csh \ |
| 59 | -Uusesfio \ |
| 60 | -Uusenm -des |
| 61 | } |
| 62 | |
| 63 | do_install () { |
| 64 | oe_runmake 'DESTDIR=${D}' install |
| 65 | |
| 66 | # We need a hostperl link for building perl |
| 67 | ln -sf perl${PV} ${D}${bindir}/hostperl |
| 68 | |
| 69 | ln -sf perl ${D}${libdir}/perl5 |
| 70 | |
| 71 | install -d ${D}${libdir}/perl/${PV}/CORE \ |
| 72 | ${D}${datadir}/perl/${PV}/ExtUtils |
| 73 | |
| 74 | # Save native config |
| 75 | install config.sh ${D}${libdir}/perl |
| 76 | install lib/Config.pm ${D}${libdir}/perl/${PV}/ |
| 77 | install lib/ExtUtils/typemap ${D}${libdir}/perl/${PV}/ExtUtils/ |
| 78 | |
| 79 | # perl shared library headers |
| 80 | # reference perl 5.20.0-1 in debian: |
| 81 | # https://packages.debian.org/experimental/i386/perl/filelist |
| 82 | for i in av.h bitcount.h charclass_invlists.h config.h cop.h cv.h dosish.h \ |
| 83 | embed.h embedvar.h EXTERN.h fakesdio.h feature.h form.h git_version.h \ |
| 84 | gv.h handy.h hv_func.h hv.h inline.h INTERN.h intrpvar.h iperlsys.h \ |
| 85 | keywords.h l1_char_class_tab.h malloc_ctl.h metaconfig.h mg_data.h \ |
| 86 | mg.h mg_raw.h mg_vtable.h mydtrace.h nostdio.h opcode.h op.h \ |
| 87 | opnames.h op_reg_common.h overload.h pad.h parser.h patchlevel.h \ |
| 88 | perlapi.h perl.h perlio.h perliol.h perlsdio.h perlvars.h perly.h \ |
| 89 | pp.h pp_proto.h proto.h reentr.h regcharclass.h regcomp.h regexp.h \ |
| 90 | regnodes.h scope.h sv.h thread.h time64_config.h time64.h uconfig.h \ |
| 91 | unicode_constants.h unixish.h utf8.h utfebcdic.h util.h uudmap.h \ |
| 92 | vutil.h warnings.h XSUB.h |
| 93 | do |
| 94 | install $i ${D}${libdir}/perl/${PV}/CORE |
| 95 | done |
| 96 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 97 | # Those wrappers mean that perl installed from sstate (which may change |
| 98 | # path location) works and that in the nativesdk case, the SDK can be |
| 99 | # installed to a different location from the one it was built for. |
| 100 | create_wrapper ${D}${bindir}/perl PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl/site_perl/${PV}:${STAGING_LIBDIR}/perl/vendor_perl/${PV}:${STAGING_LIBDIR}/perl/${PV}' |
| 101 | create_wrapper ${D}${bindir}/perl${PV} PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl/site_perl/${PV}:${STAGING_LIBDIR}/perl/vendor_perl/${PV}:${STAGING_LIBDIR}/perl/${PV}' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 102 | |
| 103 | # Use /usr/bin/env nativeperl for the perl script. |
| 104 | for f in `grep -Il '#! *${bindir}/perl' ${D}/${bindir}/*`; do |
| 105 | sed -i -e 's|${bindir}/perl|/usr/bin/env nativeperl|' $f |
| 106 | done |
| 107 | } |
| 108 | |
| 109 | SYSROOT_PREPROCESS_FUNCS += "perl_sysroot_create_wrapper" |
| 110 | |
| 111 | perl_sysroot_create_wrapper () { |
| 112 | mkdir -p ${SYSROOT_DESTDIR}${bindir} |
| 113 | # Create a wrapper that /usr/bin/env perl will use to get perl-native. |
| 114 | # This MUST live in the normal bindir. |
| 115 | cat > ${SYSROOT_DESTDIR}${bindir}/../nativeperl << EOF |
| 116 | #!/bin/sh |
| 117 | realpath=\`readlink -fn \$0\` |
| 118 | exec \`dirname \$realpath\`/perl-native/perl "\$@" |
| 119 | EOF |
| 120 | chmod 0755 ${SYSROOT_DESTDIR}${bindir}/../nativeperl |
| 121 | cat ${SYSROOT_DESTDIR}${bindir}/../nativeperl |
| 122 | } |
| 123 | |
| 124 | # Fix the path in sstate |
| 125 | SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh" |