blob: bf8b3b60be1749ecf35ad7b3c502804f11f19991 [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 \
66"
67
68# Fix test case issues
69SRC_URI_append_class-target = " \
70 file://test/dist-threads-t-join.t-adjust-ps-option.patch \
71 file://test/ext-DynaLoader-t-DynaLoader.t-fix-calling-dl_findfil.patch \
72 "
73
74SRC_URI[md5sum] = "6671e4829cbaf9cecafa9a84f141b0a3"
75SRC_URI[sha256sum] = "9e87317d693ce828095204be0d09af8d60b8785533fadea1a82b6f0e071e5c79"
76
77inherit perlnative siteinfo
78
79# Where to find the native perl
80HOSTPERL = "${STAGING_BINDIR_NATIVE}/perl-native/perl${PV}"
81
82# Where to find .so files - use the -native versions not those from the target build
83export PERLHOSTLIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${PV}/"
84
85# Where to find perl @INC/#include files
86# - use the -native versions not those from the target build
87export PERL_LIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${PV}/"
88export PERL_ARCHLIB = "${STAGING_LIBDIR_NATIVE}/perl-native/perl/${PV}/"
89
90EXTRA_OEMAKE = "-e MAKEFLAGS="
91
92# LDFLAGS for shared libraries
93export LDDLFLAGS = "${LDFLAGS} -shared"
94
95LDFLAGS_append = " -fstack-protector"
96
97# We're almost Debian, aren't we?
98CFLAGS += "-DDEBIAN"
99
100do_nolargefile() {
101 sed -i -e "s,\(uselargefiles=\)'define',\1'undef',g" \
102 -e "s,\(d_readdir64_r=\)'define',\1'undef',g" \
103 -e "s,\(readdir64_r_proto=\)'\w+',\1'0',g" \
104 -e "/ccflags_uselargefiles/d" \
105 -e "s/-Duselargefiles//" \
106 -e "s/-D_FILE_OFFSET_BITS=64//" \
107 -e "s/-D_LARGEFILE_SOURCE//" \
108 ${S}/Cross/config.sh-${TARGET_ARCH}-${TARGET_OS}
109}
110
111do_configure() {
112 # Make hostperl in build directory be the native perl
113 ln -sf ${HOSTPERL} hostperl
114
115 if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
116 if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a -e Makefile ]; then
117 ${MAKE} clean
118 fi
119 find ${S} -name *.so -delete
120 fi
121 if [ -n "${CONFIGURESTAMPFILE}" ]; then
122 echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
123 fi
124
125 # Do our work in the cross subdir
126 cd Cross
127
128 # Generate configuration
129 rm -f config.sh-${TARGET_ARCH}-${TARGET_OS}
130 for i in ${WORKDIR}/config.sh \
131 ${WORKDIR}/config.sh-${SITEINFO_BITS} \
132 ${WORKDIR}/config.sh-${SITEINFO_BITS}-${SITEINFO_ENDIANNESS}; do
133 cat $i >> config.sh-${TARGET_ARCH}-${TARGET_OS}
134 done
135
136 # Fixups for uclibc
137 if [ "${TARGET_OS}" = "linux-uclibc" -o "${TARGET_OS}" = "linux-uclibceabi" ]; then
138 sed -i -e "s,\(d_crypt_r=\)'define',\1'undef',g" \
139 -e "s,\(d_futimes=\)'define',\1'undef',g" \
140 -e "s,\(d_finitel=\)'define',\1'undef',g" \
141 -e "s,\(crypt_r_proto=\)'\w+',\1'0',g" \
142 -e "s,\(d_getnetbyname_r=\)'define',\1'undef',g" \
143 -e "s,\(getnetbyname_r_proto=\)'\w+',\1'0',g" \
144 -e "s,\(d_getnetbyaddr_r=\)'define',\1'undef',g" \
145 -e "s,\(getnetbyaddr_r_proto=\)'\w+',\1'0',g" \
146 -e "s,\(d_getnetent_r=\)'define',\1'undef',g" \
147 -e "s,\(getnetent_r_proto=\)'\w+',\1'0',g" \
148 -e "s,\(d_sockatmark=\)'define',\1'undef',g" \
149 -e "s,\(d_sockatmarkproto=\)'\w+',\1'0',g" \
150 -e "s,\(d_eaccess=\)'define',\1'undef',g" \
151 -e "s,\(d_stdio_ptr_lval=\)'define',\1'undef',g" \
152 -e "s,\(d_stdio_ptr_lval_sets_cnt=\)'define',\1'undef',g" \
153 -e "s,\(d_stdiobase=\)'define',\1'undef',g" \
154 -e "s,\(d_stdstdio=\)'define',\1'undef',g" \
155 -e "s,-fstack-protector,-fno-stack-protector,g" \
156 config.sh-${TARGET_ARCH}-${TARGET_OS}
157 fi
158 # Fixups for musl
159 if [ "${TARGET_OS}" = "linux-musl" -o "${TARGET_OS}" = "linux-musleabi" ]; then
160 sed -i -e "s,\(d_libm_lib_version=\)'define',\1'undef',g" \
161 -e "s,\(d_stdio_ptr_lval=\)'define',\1'undef',g" \
162 -e "s,\(d_stdio_ptr_lval_sets_cnt=\)'define',\1'undef',g" \
163 -e "s,\(d_stdiobase=\)'define',\1'undef',g" \
164 -e "s,\(d_stdstdio=\)'define',\1'undef',g" \
165 -e "s,\(d_getnetbyname_r=\)'define',\1'undef',g" \
166 -e "s,\(d_finitel=\)'define',\1'undef',g" \
167 -e "s,\(getprotobyname_r=\)'define',\1'undef',g" \
168 -e "s,\(getpwent_r=\)'define',\1'undef',g" \
169 -e "s,\(getservent_r=\)'define',\1'undef',g" \
170 -e "s,\(gethostent_r=\)'define',\1'undef',g" \
171 -e "s,\(getnetent_r=\)'define',\1'undef',g" \
172 -e "s,\(getnetbyaddr_r=\)'define',\1'undef',g" \
173 -e "s,\(getprotoent_r=\)'define',\1'undef',g" \
174 -e "s,\(getprotobynumber_r=\)'define',\1'undef',g" \
175 -e "s,\(getgrent_r=\)'define',\1'undef',g" \
176 -e "s,\(i_fcntl=\)'undef',\1'define',g" \
177 -e "s,\(h_fcntl=\)'false',\1'true',g" \
178 -e "s,-fstack-protector,-fno-stack-protector,g" \
179 -e "s,-lnsl,,g" \
180 config.sh-${TARGET_ARCH}-${TARGET_OS}
181 fi
182
183 ${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '', 'do_nolargefile', d)}
184
185 # Update some paths in the configuration
186 sed -i -e 's,@ARCH@-thread-multi,,g' \
187 -e 's,@ARCH@,${TARGET_ARCH}-${TARGET_OS},g' \
188 -e 's,@STAGINGDIR@,${STAGING_DIR_HOST},g' \
189 -e "s,@INCLUDEDIR@,${STAGING_INCDIR},g" \
190 -e "s,@LIBDIR@,${libdir},g" \
191 -e "s,@BASELIBDIR@,${base_libdir},g" \
192 -e "s,@EXECPREFIX@,${exec_prefix},g" \
193 -e 's,@USRBIN@,${bindir},g' \
194 config.sh-${TARGET_ARCH}-${TARGET_OS}
195
196 case "${TARGET_ARCH}" in
197 x86_64 | powerpc | s390)
198 sed -i -e "s,\(need_va_copy=\)'undef',\1'define',g" \
199 config.sh-${TARGET_ARCH}-${TARGET_OS}
200 ;;
201 arm)
202 sed -i -e "s,\(d_u32align=\)'undef',\1'define',g" \
203 config.sh-${TARGET_ARCH}-${TARGET_OS}
204 ;;
205 esac
206 # These are strewn all over the source tree
207 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
208 echo Fixing: $foo
209 sed -e 's|\([ "^'\''I]\+\)/usr/include/|\1${STAGING_INCDIR}/|g' -i $foo
210 done
211
212 rm -f config
213 echo "ARCH = ${TARGET_ARCH}" > config
214 echo "OS = ${TARGET_OS}" >> config
215}
216
217do_compile() {
218 # Fix to avoid recursive substitution of path
219 sed -i -e 's|(@libpath, ".*"|(@libpath, "${STAGING_LIBDIR}"|g' cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
220
221 cd Cross
222 oe_runmake perl LD="${CCLD}"
223}
224
225do_install() {
226 #export hostperl="${STAGING_BINDIR_NATIVE}/perl-native/perl${PV}"
227 oe_runmake install DESTDIR=${D}
228 # Add perl pointing at current version
229 ln -sf perl${PV} ${D}${bindir}/perl
230
231 ln -sf perl ${D}/${libdir}/perl5
232
233 # Remove unwanted file and empty directories
234 rm -f ${D}/${libdir}/perl/${PV}/.packlist
235 rmdir ${D}/${libdir}/perl/site_perl/${PV}
236 rmdir ${D}/${libdir}/perl/site_perl
237
238 # Fix up shared library
239 mv ${D}/${libdir}/perl/${PV}/CORE/libperl.so ${D}/${libdir}/libperl.so.${PV}
240 ln -sf libperl.so.${PV} ${D}/${libdir}/libperl.so.5
241 ln -sf ../../../libperl.so.${PV} ${D}/${libdir}/perl/${PV}/CORE/libperl.so
242
243 # target config, used by cpan.bbclass to extract version information
244 install config.sh ${D}${libdir}/perl
245
246 ln -s Config_heavy.pl ${D}${libdir}/perl/${PV}/Config_heavy-target.pl
247}
248
249do_install_append_class-nativesdk () {
250 create_wrapper ${D}${bindir}/perl \
251 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}'
252}
253
254PACKAGE_PREPROCESS_FUNCS += "perl_package_preprocess"
255
256perl_package_preprocess () {
257 # Fix up installed configuration
258 sed -i -e "s,${D},,g" \
259 -e "s,--sysroot=${STAGING_DIR_HOST},,g" \
260 -e "s,-isystem${STAGING_INCDIR} ,,g" \
261 -e "s,${STAGING_LIBDIR},${libdir},g" \
262 -e "s,${STAGING_BINDIR},${bindir},g" \
263 -e "s,${STAGING_INCDIR},${includedir},g" \
264 -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
265 -e "s,${STAGING_BINDIR_NATIVE}/,,g" \
266 -e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
267 ${PKGD}${bindir}/h2xs \
268 ${PKGD}${bindir}/h2ph \
269 ${PKGD}${bindir}/pod2man \
270 ${PKGD}${bindir}/pod2text \
271 ${PKGD}${bindir}/pod2usage \
272 ${PKGD}${bindir}/podchecker \
273 ${PKGD}${bindir}/podselect \
274 ${PKGD}${libdir}/perl/${PV}/CORE/config.h \
275 ${PKGD}${libdir}/perl/${PV}/CORE/perl.h \
276 ${PKGD}${libdir}/perl/${PV}/CORE/pp.h \
277 ${PKGD}${libdir}/perl/${PV}/Config.pm \
278 ${PKGD}${libdir}/perl/${PV}/Config.pod \
279 ${PKGD}${libdir}/perl/${PV}/Config_heavy.pl \
280 ${PKGD}${libdir}/perl/${PV}/ExtUtils/Liblist/Kid.pm \
281 ${PKGD}${libdir}/perl/${PV}/FileCache.pm \
282 ${PKGD}${libdir}/perl/${PV}/pod/*.pod \
283 ${PKGD}${libdir}/perl/config.sh
284}
285
286PACKAGES = "perl-dbg perl perl-misc perl-dev perl-pod perl-doc perl-lib \
287 perl-module-cpan perl-module-cpanplus perl-module-unicore"
288FILES_${PN} = "${bindir}/perl ${bindir}/perl${PV} \
289 ${libdir}/perl/${PV}/Config.pm \
290 ${libdir}/perl/${PV}/strict.pm \
291 ${libdir}/perl/${PV}/warnings.pm \
292 ${libdir}/perl/${PV}/warnings \
293 ${libdir}/perl/${PV}/vars.pm \
294 "
295FILES_${PN}_append_class-nativesdk = " ${bindir}/perl.real"
296RPROVIDES_${PN} += "perl-module-strict perl-module-vars perl-module-config perl-module-warnings \
297 perl-module-warnings-register"
298FILES_${PN}-dev = "${libdir}/perl/${PV}/CORE"
299FILES_${PN}-lib = "${libdir}/libperl.so* \
300 ${libdir}/perl5 \
301 ${libdir}/perl/config.sh \
302 ${libdir}/perl/${PV}/Config_heavy.pl \
303 ${libdir}/perl/${PV}/Config_heavy-target.pl"
304FILES_${PN}-pod = "${libdir}/perl/${PV}/pod \
305 ${libdir}/perl/${PV}/*.pod \
306 ${libdir}/perl/${PV}/*/*.pod \
307 ${libdir}/perl/${PV}/*/*/*.pod "
308FILES_perl-misc = "${bindir}/*"
309FILES_${PN}-doc = "${libdir}/perl/${PV}/*/*.txt \
310 ${libdir}/perl/${PV}/*/*/*.txt \
311 ${libdir}/perl/${PV}/auto/XS/Typemap \
312 ${libdir}/perl/${PV}/B/assemble \
313 ${libdir}/perl/${PV}/B/cc_harness \
314 ${libdir}/perl/${PV}/B/disassemble \
315 ${libdir}/perl/${PV}/B/makeliblinks \
316 ${libdir}/perl/${PV}/CGI/eg \
317 ${libdir}/perl/${PV}/CPAN/PAUSE2003.pub \
318 ${libdir}/perl/${PV}/CPAN/SIGNATURE \
319 ${libdir}/perl/${PV}/CPANPLUS/Shell/Default/Plugins/HOWTO.pod \
320 ${libdir}/perl/${PV}/Encode/encode.h \
321 ${libdir}/perl/${PV}/ExtUtils/MANIFEST.SKIP \
322 ${libdir}/perl/${PV}/ExtUtils/NOTES \
323 ${libdir}/perl/${PV}/ExtUtils/PATCHING \
324 ${libdir}/perl/${PV}/ExtUtils/typemap \
325 ${libdir}/perl/${PV}/ExtUtils/xsubpp \
326 ${libdir}/perl/${PV}/ExtUtils/Changes_EU-Install \
327 ${libdir}/perl/${PV}/Net/*.eg \
328 ${libdir}/perl/${PV}/unicore/mktables \
329 ${libdir}/perl/${PV}/unicore/mktables.lst \
330 ${libdir}/perl/${PV}/unicore/version "
331
332FILES_perl-module-cpan += "${libdir}/perl/${PV}/CPAN \
333 ${libdir}/perl/${PV}/CPAN.pm"
334FILES_perl-module-cpanplus += "${libdir}/perl/${PV}/CPANPLUS \
335 ${libdir}/perl/${PV}/CPANPLUS.pm"
336FILES_perl-module-unicore += "${libdir}/perl/${PV}/unicore"
337
338# Create a perl-modules package recommending all the other perl
339# packages (actually the non modules packages and not created too)
340ALLOW_EMPTY_perl-modules = "1"
341PACKAGES_append = " perl-modules "
342
343python populate_packages_prepend () {
344 libdir = d.expand('${libdir}/perl/${PV}')
345 do_split_packages(d, libdir, 'auto/([^.]*)/[^/]*\.(so|ld|ix|al)', 'perl-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False)
346 do_split_packages(d, libdir, 'Module/([^\/]*)\.pm', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
347 do_split_packages(d, libdir, 'Module/([^\/]*)/.*', 'perl-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
348 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)
349
350 # perl-modules should recommend every perl module, and only the
351 # modules. Don't attempt to use the result of do_split_packages() as some
352 # modules are manually split (eg. perl-module-unicore).
353 packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES', True).split())
354 d.setVar(d.expand("RRECOMMENDS_${PN}-modules"), ' '.join(packages))
355}
356
357PACKAGES_DYNAMIC += "^perl-module-.*"
358PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
359
360RPROVIDES_perl-lib = "perl-lib"
361
362require perl-rdepends_${PV}.inc
363require perl-ptest.inc
364
365SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh"
366
367BBCLASSEXTEND = "nativesdk"