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