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