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