blob: 792a65b5b2227a69cef4b392916fe38a9ca6397b [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001require perl.inc
2
3# We need gnugrep (for -I)
4DEPENDS = "virtual/db grep-native"
5DEPENDS += "gdbm zlib"
6
7# Pick up patches from debian
8# http://ftp.de.debian.org/debian/pool/main/p/perl/perl_5.22.0-1.debian.tar.xz
9SRC_URI += " \
10 file://debian/cpan_definstalldirs.diff \
11 file://debian/db_file_ver.diff \
12 file://debian/doc_info.diff \
13 file://debian/enc2xs_inc.diff \
14 file://debian/errno_ver.diff \
15 file://debian/libperl_embed_doc.diff \
16 file://debian/fixes/respect_umask.diff \
17 file://debian/writable_site_dirs.diff \
18 file://debian/extutils_set_libperl_path.diff \
19 file://debian/no_packlist_perllocal.diff \
20 file://debian/prefix_changes.diff \
21 file://debian/instmodsh_doc.diff \
22 file://debian/ld_run_path.diff \
23 file://debian/libnet_config_path.diff \
24 file://debian/mod_paths.diff \
25 file://debian/prune_libs.diff \
26 file://debian/fixes/net_smtp_docs.diff \
27 file://debian/perlivp.diff \
28 file://debian/squelch-locale-warnings.diff \
29 file://debian/skip-upstream-git-tests.diff \
30 file://debian/skip-kfreebsd-crash.diff \
31 file://debian/fixes/document_makemaker_ccflags.diff \
32 file://debian/find_html2text.diff \
33 file://debian/perl5db-x-terminal-emulator.patch \
34 file://debian/cpan-missing-site-dirs.diff \
35 file://debian/fixes/memoize_storable_nstore.diff \
36 file://debian/regen-skip.diff \
37"
38
39SRC_URI += " \
40 file://Makefile.patch \
41 file://Makefile.SH.patch \
42 file://installperl.patch \
43 file://perl-dynloader.patch \
44 file://perl-moreconfig.patch \
45 file://letgcc-find-errno.patch \
46 file://generate-sh.patch \
47 file://native-perlinc.patch \
48 file://perl-enable-gdbm.patch \
49 file://cross-generate_uudmap.patch \
50 file://fix_bad_rpath.patch \
51 file://perl-archlib-exp.patch \
52 file://dynaloaderhack.patch \
53 file://config.sh \
54 file://config.sh-32 \
55 file://config.sh-32-le \
56 file://config.sh-32-be \
57 file://config.sh-64 \
58 file://config.sh-64-le \
59 file://config.sh-64-be \
60 file://make_ext.pl-fix-regenerate-makefile-failed-while-cc-.patch \
61 file://t-run-switches.t-perl5-perl.patch \
62 file://ext-ODBM_File-hints-linux.pl-link-libgdbm_compat.patch \
63 file://ext-ODBM_File-t-odbm.t-fix-the-path-of-dbmt_common.p.patch \
64 file://perl-PathTools-don-t-filter-out-blib-from-INC.patch \
65 file://perl-errno-generation-gcc5.patch \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060066 file://perl-fix-conflict-between-skip_all-and-END.patch \
67 file://perl-test-customized.patch \
68 file://perl-fix-CVE-2016-2381.patch \
69 file://perl-fix-CVE-2016-6185.patch \
70 file://perl-fix-CVE-2015-8607.patch \
71 file://perl-fix-CVE-2016-1238.patch \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050072"
73
74# Fix test case issues
75SRC_URI_append_class-target = " \
76 file://test/dist-threads-t-join.t-adjust-ps-option.patch \
77 file://test/ext-DynaLoader-t-DynaLoader.t-fix-calling-dl_findfil.patch \
78 "
79
80SRC_URI[md5sum] = "6671e4829cbaf9cecafa9a84f141b0a3"
81SRC_URI[sha256sum] = "9e87317d693ce828095204be0d09af8d60b8785533fadea1a82b6f0e071e5c79"
82
83inherit perlnative siteinfo
84
85# Where to find the native perl
86HOSTPERL = "${STAGING_BINDIR_NATIVE}/perl-native/perl${PV}"
87
88# Where to find .so files - use the -native versions not those from the target build
89export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${PV}/"
90
91# Where to find perl @INC/#include files
92# - use the -native versions not those from the target build
93export PERL_LIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${PV}/"
94export PERL_ARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${PV}/"
95
96EXTRA_OEMAKE = "-e MAKEFLAGS="
97
98# LDFLAGS for shared libraries
99export LDDLFLAGS = "${LDFLAGS} -shared"
100
101LDFLAGS_append = " -fstack-protector"
102
103# We're almost Debian, aren't we?
104CFLAGS += "-DDEBIAN"
105
106do_nolargefile() {
107 sed -i -e "s,\(uselargefiles=\)'define',\1'undef',g" \
108 -e "s,\(d_readdir64_r=\)'define',\1'undef',g" \
109 -e "s,\(readdir64_r_proto=\)'\w+',\1'0',g" \
110 -e "/ccflags_uselargefiles/d" \
111 -e "s/-Duselargefiles//" \
112 -e "s/-D_FILE_OFFSET_BITS=64//" \
113 -e "s/-D_LARGEFILE_SOURCE//" \
114 ${S}/Cross/config.sh-${TARGET_ARCH}-${TARGET_OS}
115}
116
117do_configure() {
118 # Make hostperl in build directory be the native perl
119 ln -sf ${HOSTPERL} hostperl
120
121 if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
122 if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a -e Makefile ]; then
123 ${MAKE} clean
124 fi
125 find ${S} -name *.so -delete
126 fi
127 if [ -n "${CONFIGURESTAMPFILE}" ]; then
128 echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
129 fi
130
131 # Do our work in the cross subdir
132 cd Cross
133
134 # Generate configuration
135 rm -f config.sh-${TARGET_ARCH}-${TARGET_OS}
136 for i in ${WORKDIR}/config.sh \
137 ${WORKDIR}/config.sh-${SITEINFO_BITS} \
138 ${WORKDIR}/config.sh-${SITEINFO_BITS}-${SITEINFO_ENDIANNESS}; do
139 cat $i >> config.sh-${TARGET_ARCH}-${TARGET_OS}
140 done
141
142 # Fixups for uclibc
143 if [ "${TARGET_OS}" = "linux-uclibc" -o "${TARGET_OS}" = "linux-uclibceabi" ]; then
144 sed -i -e "s,\(d_crypt_r=\)'define',\1'undef',g" \
145 -e "s,\(d_futimes=\)'define',\1'undef',g" \
146 -e "s,\(d_finitel=\)'define',\1'undef',g" \
147 -e "s,\(crypt_r_proto=\)'\w+',\1'0',g" \
148 -e "s,\(d_getnetbyname_r=\)'define',\1'undef',g" \
149 -e "s,\(getnetbyname_r_proto=\)'\w+',\1'0',g" \
150 -e "s,\(d_getnetbyaddr_r=\)'define',\1'undef',g" \
151 -e "s,\(getnetbyaddr_r_proto=\)'\w+',\1'0',g" \
152 -e "s,\(d_getnetent_r=\)'define',\1'undef',g" \
153 -e "s,\(getnetent_r_proto=\)'\w+',\1'0',g" \
154 -e "s,\(d_sockatmark=\)'define',\1'undef',g" \
155 -e "s,\(d_sockatmarkproto=\)'\w+',\1'0',g" \
156 -e "s,\(d_eaccess=\)'define',\1'undef',g" \
157 -e "s,\(d_stdio_ptr_lval=\)'define',\1'undef',g" \
158 -e "s,\(d_stdio_ptr_lval_sets_cnt=\)'define',\1'undef',g" \
159 -e "s,\(d_stdiobase=\)'define',\1'undef',g" \
160 -e "s,\(d_stdstdio=\)'define',\1'undef',g" \
161 -e "s,-fstack-protector,-fno-stack-protector,g" \
162 config.sh-${TARGET_ARCH}-${TARGET_OS}
163 fi
164 # Fixups for musl
165 if [ "${TARGET_OS}" = "linux-musl" -o "${TARGET_OS}" = "linux-musleabi" ]; then
166 sed -i -e "s,\(d_libm_lib_version=\)'define',\1'undef',g" \
167 -e "s,\(d_stdio_ptr_lval=\)'define',\1'undef',g" \
168 -e "s,\(d_stdio_ptr_lval_sets_cnt=\)'define',\1'undef',g" \
169 -e "s,\(d_stdiobase=\)'define',\1'undef',g" \
170 -e "s,\(d_stdstdio=\)'define',\1'undef',g" \
171 -e "s,\(d_getnetbyname_r=\)'define',\1'undef',g" \
172 -e "s,\(d_finitel=\)'define',\1'undef',g" \
173 -e "s,\(getprotobyname_r=\)'define',\1'undef',g" \
174 -e "s,\(getpwent_r=\)'define',\1'undef',g" \
175 -e "s,\(getservent_r=\)'define',\1'undef',g" \
176 -e "s,\(gethostent_r=\)'define',\1'undef',g" \
177 -e "s,\(getnetent_r=\)'define',\1'undef',g" \
178 -e "s,\(getnetbyaddr_r=\)'define',\1'undef',g" \
179 -e "s,\(getprotoent_r=\)'define',\1'undef',g" \
180 -e "s,\(getprotobynumber_r=\)'define',\1'undef',g" \
181 -e "s,\(getgrent_r=\)'define',\1'undef',g" \
182 -e "s,\(i_fcntl=\)'undef',\1'define',g" \
183 -e "s,\(h_fcntl=\)'false',\1'true',g" \
184 -e "s,-fstack-protector,-fno-stack-protector,g" \
185 -e "s,-lnsl,,g" \
186 config.sh-${TARGET_ARCH}-${TARGET_OS}
187 fi
188
189 ${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '', 'do_nolargefile', d)}
190
191 # Update some paths in the configuration
192 sed -i -e 's,@ARCH@-thread-multi,,g' \
193 -e 's,@ARCH@,${TARGET_ARCH}-${TARGET_OS},g' \
194 -e 's,@STAGINGDIR@,${STAGING_DIR_HOST},g' \
195 -e "s,@INCLUDEDIR@,${STAGING_INCDIR},g" \
196 -e "s,@LIBDIR@,${libdir},g" \
197 -e "s,@BASELIBDIR@,${base_libdir},g" \
198 -e "s,@EXECPREFIX@,${exec_prefix},g" \
199 -e 's,@USRBIN@,${bindir},g' \
200 config.sh-${TARGET_ARCH}-${TARGET_OS}
201
202 case "${TARGET_ARCH}" in
203 x86_64 | powerpc | s390)
204 sed -i -e "s,\(need_va_copy=\)'undef',\1'define',g" \
205 config.sh-${TARGET_ARCH}-${TARGET_OS}
206 ;;
207 arm)
208 sed -i -e "s,\(d_u32align=\)'undef',\1'define',g" \
209 config.sh-${TARGET_ARCH}-${TARGET_OS}
210 ;;
211 esac
212 # These are strewn all over the source tree
213 for foo in `grep -I --exclude="*.patch" --exclude="*.diff" --exclude="*.pod" --exclude="README*" -m1 "/usr/include/.*\.h" ${S}/* -r -l` ${S}/utils/h2xs.PL ; do
214 echo Fixing: $foo
215 sed -e 's|\([ "^'\''I]\+\)/usr/include/|\1${STAGING_INCDIR}/|g' -i $foo
216 done
217
218 rm -f config
219 echo "ARCH = ${TARGET_ARCH}" > config
220 echo "OS = ${TARGET_OS}" >> config
221}
222
223do_compile() {
224 # Fix to avoid recursive substitution of path
225 sed -i -e 's|(@libpath, ".*"|(@libpath, "${STAGING_LIBDIR}"|g' cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
226
227 cd Cross
228 oe_runmake perl LD="${CCLD}"
229}
230
231do_install() {
232 #export hostperl="${STAGING_BINDIR_NATIVE}/perl-native/perl${PV}"
233 oe_runmake install DESTDIR=${D}
234 # Add perl pointing at current version
235 ln -sf perl${PV} ${D}${bindir}/perl
236
237 ln -sf perl ${D}/${libdir}/perl5
238
239 # Remove unwanted file and empty directories
240 rm -f ${D}/${libdir}/perl/${PV}/.packlist
241 rmdir ${D}/${libdir}/perl/site_perl/${PV}
242 rmdir ${D}/${libdir}/perl/site_perl
243
244 # Fix up shared library
245 mv ${D}/${libdir}/perl/${PV}/CORE/libperl.so ${D}/${libdir}/libperl.so.${PV}
246 ln -sf libperl.so.${PV} ${D}/${libdir}/libperl.so.5
247 ln -sf ../../../libperl.so.${PV} ${D}/${libdir}/perl/${PV}/CORE/libperl.so
248
249 # target config, used by cpan.bbclass to extract version information
250 install config.sh ${D}${libdir}/perl
251
252 ln -s Config_heavy.pl ${D}${libdir}/perl/${PV}/Config_heavy-target.pl
253}
254
255do_install_append_class-nativesdk () {
256 create_wrapper ${D}${bindir}/perl \
257 PERL5LIB='$PERL5LIB:$OECORE_NATIVE_SYSROOT/${libdir_nativesdk}/perl/site_perl/${PV}:$OECORE_NATIVE_SYSROOT/${libdir_nativesdk}/perl/vendor_perl/${PV}:$OECORE_NATIVE_SYSROOT/${libdir_nativesdk}/perl/${PV}'
258}
259
260PACKAGE_PREPROCESS_FUNCS += "perl_package_preprocess"
261
262perl_package_preprocess () {
263 # Fix up installed configuration
264 sed -i -e "s,${D},,g" \
265 -e "s,--sysroot=${STAGING_DIR_HOST},,g" \
266 -e "s,-isystem${STAGING_INCDIR} ,,g" \
267 -e "s,${STAGING_LIBDIR},${libdir},g" \
268 -e "s,${STAGING_BINDIR},${bindir},g" \
269 -e "s,${STAGING_INCDIR},${includedir},g" \
270 -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
271 -e "s,${STAGING_BINDIR_NATIVE}/,,g" \
272 -e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
273 ${PKGD}${bindir}/h2xs \
274 ${PKGD}${bindir}/h2ph \
275 ${PKGD}${bindir}/pod2man \
276 ${PKGD}${bindir}/pod2text \
277 ${PKGD}${bindir}/pod2usage \
278 ${PKGD}${bindir}/podchecker \
279 ${PKGD}${bindir}/podselect \
280 ${PKGD}${libdir}/perl/${PV}/CORE/config.h \
281 ${PKGD}${libdir}/perl/${PV}/CORE/perl.h \
282 ${PKGD}${libdir}/perl/${PV}/CORE/pp.h \
283 ${PKGD}${libdir}/perl/${PV}/Config.pm \
284 ${PKGD}${libdir}/perl/${PV}/Config.pod \
285 ${PKGD}${libdir}/perl/${PV}/Config_heavy.pl \
286 ${PKGD}${libdir}/perl/${PV}/ExtUtils/Liblist/Kid.pm \
287 ${PKGD}${libdir}/perl/${PV}/FileCache.pm \
288 ${PKGD}${libdir}/perl/${PV}/pod/*.pod \
289 ${PKGD}${libdir}/perl/config.sh
290}
291
292PACKAGES = "perl-dbg perl perl-misc perl-dev perl-pod perl-doc perl-lib \
293 perl-module-cpan perl-module-cpanplus perl-module-unicore"
294FILES_${PN} = "${bindir}/perl ${bindir}/perl${PV} \
295 ${libdir}/perl/${PV}/Config.pm \
296 ${libdir}/perl/${PV}/strict.pm \
297 ${libdir}/perl/${PV}/warnings.pm \
298 ${libdir}/perl/${PV}/warnings \
299 ${libdir}/perl/${PV}/vars.pm \
300 "
301FILES_${PN}_append_class-nativesdk = " ${bindir}/perl.real"
302RPROVIDES_${PN} += "perl-module-strict perl-module-vars perl-module-config perl-module-warnings \
303 perl-module-warnings-register"
304FILES_${PN}-dev = "${libdir}/perl/${PV}/CORE"
305FILES_${PN}-lib = "${libdir}/libperl.so* \
306 ${libdir}/perl5 \
307 ${libdir}/perl/config.sh \
308 ${libdir}/perl/${PV}/Config_heavy.pl \
309 ${libdir}/perl/${PV}/Config_heavy-target.pl"
310FILES_${PN}-pod = "${libdir}/perl/${PV}/pod \
311 ${libdir}/perl/${PV}/*.pod \
312 ${libdir}/perl/${PV}/*/*.pod \
313 ${libdir}/perl/${PV}/*/*/*.pod "
314FILES_perl-misc = "${bindir}/*"
315FILES_${PN}-doc = "${libdir}/perl/${PV}/*/*.txt \
316 ${libdir}/perl/${PV}/*/*/*.txt \
317 ${libdir}/perl/${PV}/auto/XS/Typemap \
318 ${libdir}/perl/${PV}/B/assemble \
319 ${libdir}/perl/${PV}/B/cc_harness \
320 ${libdir}/perl/${PV}/B/disassemble \
321 ${libdir}/perl/${PV}/B/makeliblinks \
322 ${libdir}/perl/${PV}/CGI/eg \
323 ${libdir}/perl/${PV}/CPAN/PAUSE2003.pub \
324 ${libdir}/perl/${PV}/CPAN/SIGNATURE \
325 ${libdir}/perl/${PV}/CPANPLUS/Shell/Default/Plugins/HOWTO.pod \
326 ${libdir}/perl/${PV}/Encode/encode.h \
327 ${libdir}/perl/${PV}/ExtUtils/MANIFEST.SKIP \
328 ${libdir}/perl/${PV}/ExtUtils/NOTES \
329 ${libdir}/perl/${PV}/ExtUtils/PATCHING \
330 ${libdir}/perl/${PV}/ExtUtils/typemap \
331 ${libdir}/perl/${PV}/ExtUtils/xsubpp \
332 ${libdir}/perl/${PV}/ExtUtils/Changes_EU-Install \
333 ${libdir}/perl/${PV}/Net/*.eg \
334 ${libdir}/perl/${PV}/unicore/mktables \
335 ${libdir}/perl/${PV}/unicore/mktables.lst \
336 ${libdir}/perl/${PV}/unicore/version "
337
338FILES_perl-module-cpan += "${libdir}/perl/${PV}/CPAN \
339 ${libdir}/perl/${PV}/CPAN.pm"
340FILES_perl-module-cpanplus += "${libdir}/perl/${PV}/CPANPLUS \
341 ${libdir}/perl/${PV}/CPANPLUS.pm"
342FILES_perl-module-unicore += "${libdir}/perl/${PV}/unicore"
343
344# Create a perl-modules package recommending all the other perl
345# packages (actually the non modules packages and not created too)
346ALLOW_EMPTY_perl-modules = "1"
347PACKAGES_append = " perl-modules "
348
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600349PACKAGESPLITFUNCS_prepend = "split_perl_packages "
350
351python split_perl_packages () {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500352 libdir = d.expand('${libdir}/perl/${PV}')
353 do_split_packages(d, libdir, 'auto/([^.]*)/[^/]*\.(so|ld|ix|al)', 'perl-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False)
354 do_split_packages(d, libdir, 'Module/([^\/]*)\.pm', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
355 do_split_packages(d, libdir, 'Module/([^\/]*)/.*', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
356 do_split_packages(d, libdir, '(^(?!(CPAN\/|CPANPLUS\/|Module\/|unicore\/|auto\/)[^\/]).*)\.(pm|pl|e2x)', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
357
358 # perl-modules should recommend every perl module, and only the
359 # modules. Don't attempt to use the result of do_split_packages() as some
360 # modules are manually split (eg. perl-module-unicore).
361 packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES', True).split())
362 d.setVar(d.expand("RRECOMMENDS_${PN}-modules"), ' '.join(packages))
363}
364
365PACKAGES_DYNAMIC += "^perl-module-.*"
366PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
367
368RPROVIDES_perl-lib = "perl-lib"
369
370require perl-rdepends_${PV}.inc
371require perl-ptest.inc
372
373SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh"
374
375BBCLASSEXTEND = "nativesdk"