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