summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/perl/perl_5.30.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/perl/perl_5.30.1.bb')
-rw-r--r--meta/recipes-devtools/perl/perl_5.30.1.bb356
1 files changed, 356 insertions, 0 deletions
diff --git a/meta/recipes-devtools/perl/perl_5.30.1.bb b/meta/recipes-devtools/perl/perl_5.30.1.bb
new file mode 100644
index 0000000000..b633acfcea
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl_5.30.1.bb
@@ -0,0 +1,356 @@
1SUMMARY = "Perl scripting language"
2HOMEPAGE = "http://www.perl.org/"
3SECTION = "devel"
4LICENSE = "Artistic-1.0 | GPL-1.0+"
5LIC_FILES_CHKSUM = "file://Copying;md5=5b122a36d0f6dc55279a0ebc69f3c60b \
6 file://Artistic;md5=71a4d5d9acc18c0952a6df2218bb68da \
7 "
8
9
10SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \
11 https://github.com/arsv/perl-cross/releases/download/1.3.1/perl-cross-1.3.1.tar.gz;name=perl-cross \
12 file://perl-rdepends.txt \
13 file://0001-configure_tool.sh-do-not-quote-the-argument-to-comma.patch \
14 file://0001-ExtUtils-MakeMaker-add-LDFLAGS-when-linking-binary-m.patch \
15 file://0001-Somehow-this-module-breaks-through-the-perl-wrapper-.patch \
16 file://errno_ver.diff \
17 file://native-perlinc.patch \
18 file://0001-perl-cross-add-LDFLAGS-when-linking-libperl.patch \
19 file://perl-dynloader.patch \
20 file://0001-configure_path.sh-do-not-hardcode-prefix-lib-as-libr.patch \
21 file://0001-enc2xs-Add-environment-variable-to-suppress-comments.patch \
22 file://0002-Constant-Fix-up-shebang.patch \
23 file://0001-tests-adjust-to-correctly-exclude-unbuilt-extensions.patch \
24 file://determinism.patch \
25 file://racefix.patch \
26 file://CVE-2020-10543.patch \
27 file://CVE-2020-10878_1.patch \
28 file://CVE-2020-10878_2.patch \
29 "
30SRC_URI_append_class-native = " \
31 file://perl-configpm-switch.patch \
32"
33SRC_URI_append_class-target = " \
34 file://encodefix.patch \
35"
36
37SRC_URI[perl.md5sum] = "6438eb7b8db9bbde28e01086de376a46"
38SRC_URI[perl.sha256sum] = "bf3d25571ff1ee94186177c2cdef87867fd6a14aa5a84f0b1fb7bf798f42f964"
39SRC_URI[perl-cross.md5sum] = "1e463b105cfa56d251a86979af23e3a7"
40SRC_URI[perl-cross.sha256sum] = "edce0b0c2f725e2db3f203d6d8e9f3f7161256f5d1590551e40694f21200141d"
41
42S = "${WORKDIR}/perl-${PV}"
43
44inherit upstream-version-is-even
45
46DEPENDS += "gdbm zlib virtual/crypt"
47
48PERL_LIB_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}.0"
49
50PACKAGECONFIG ??= "bdb"
51PACKAGECONFIG[bdb] = ",-Ui_db,db"
52
53# Don't generate comments in enc2xs output files. They are not reproducible
54export ENC2XS_NO_COMMENTS = "1"
55
56do_unpack_append() {
57 bb.build.exec_func('do_copy_perlcross', d)
58}
59
60do_copy_perlcross() {
61 cp -rfp ${WORKDIR}/perl-cross*/* ${S}
62}
63
64do_configure_class-target() {
65 ./configure --prefix=${prefix} --libdir=${libdir} \
66 --target=${TARGET_SYS} \
67 -Duseshrplib \
68 -Dsoname=libperl.so.5 \
69 -Dvendorprefix=${prefix} \
70 -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \
71 ${PACKAGECONFIG_CONFARGS}
72
73 #perl.c uses an ARCHLIB_EXP define to generate compile-time code that
74 #adds the archlibexp path to @INC during run-time initialization of a
75 #new perl interpreter.
76
77 #Because we've changed this value in a temporary way to make it
78 #possible to use ExtUtils::Embed in the target build (the temporary
79 #value in config.sh gets re-stripped out during packaging), the
80 #ARCHLIB_EXP value that gets generated still uses the temporary version
81 #instead of the original expected version (i.e. becauses it's in the
82 #generated config.h, it doesn't get stripped out during packaging like
83 #the others in config.sh).
84
85 sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h
86}
87
88do_configure_class-nativesdk() {
89 ./configure --prefix=${prefix} \
90 --target=${TARGET_SYS} \
91 -Duseshrplib \
92 -Dsoname=libperl.so.5 \
93 -Dvendorprefix=${prefix} \
94 -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \
95 ${PACKAGECONFIG_CONFARGS}
96
97 # See the comment above
98 sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h
99}
100
101do_configure_class-native() {
102 ./configure --prefix=${prefix} \
103 -Dbin=${bindir}/perl-native \
104 -Duseshrplib \
105 -Dsoname=libperl.so.5 \
106 -Dvendorprefix=${prefix} \
107 -Ui_xlocale \
108 ${PACKAGECONFIG_CONFARGS}
109}
110
111do_configure_append() {
112 if [ -n "$SOURCE_DATE_EPOCH" ]; then
113 PERL_BUILD_DATE="$(${PYTHON} -c "\
114from datetime import datetime, timezone; \
115print(datetime.fromtimestamp($SOURCE_DATE_EPOCH, timezone.utc).strftime('%a %b %d %H:%M:%S %Y')) \
116 ")"
117 echo "#define PERL_BUILD_DATE \"$PERL_BUILD_DATE\"" >> config.h
118 fi
119}
120
121do_compile() {
122 oe_runmake
123 # This isn't generated reliably so delete and re-generate.
124 # https://github.com/arsv/perl-cross/issues/86
125
126 if [ -e pod/perltoc.pod ]; then
127 bbnote Rebuilding perltoc.pod
128 rm -f pod/perltoc.pod
129 oe_runmake pod/perltoc.pod
130 fi
131}
132
133do_install() {
134 oe_runmake 'DESTDIR=${D}' install
135
136 install -d ${D}${libdir}/perl5
137 install -d ${D}${libdir}/perl5/${PV}/
138 install -d ${D}${libdir}/perl5/${PV}/ExtUtils/
139
140 # Save native config
141 install config.sh ${D}${libdir}/perl5
142 install lib/Config.pm ${D}${libdir}/perl5/${PV}/
143 install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/
144
145 # Fix up shared library
146 rm ${D}/${libdir}/perl5/${PV}/*/CORE/libperl.so
147 ln -sf ../../../../libperl.so.${PERL_LIB_VER} $(echo ${D}/${libdir}/perl5/${PV}/*/CORE)/libperl.so
148}
149
150do_install_append_class-target() {
151 # This is used to substitute target configuration when running native perl via perl-configpm-switch.patch
152 ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl
153
154 # This contains host-specific information used for building miniperl (a helper executable built with host compiler)
155 # and therefore isn't reproducible. I believe the file isn't actually needed on target.
156 rm ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/xconfig.h
157}
158
159do_install_append_class-nativesdk() {
160 # This is used to substitute target configuration when running native perl via perl-configpm-switch.patch
161 ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl
162
163 create_wrapper ${D}${bindir}/perl \
164 PERL5LIB='$PERL5LIB:$OECORE_NATIVE_SYSROOT/${libdir_nativesdk}/perl5/site_perl/${PV}:$OECORE_NATIVE_SYSROOT/${libdir_nativesdk}/perl5/vendor_perl/${PV}:$OECORE_NATIVE_SYSROOT/${libdir_nativesdk}/perl5/${PV}'
165}
166
167do_install_append_class-native () {
168 # Those wrappers mean that perl installed from sstate (which may change
169 # path location) works and that in the nativesdk case, the SDK can be
170 # installed to a different location from the one it was built for.
171 create_wrapper ${D}${bindir}/perl-native/perl PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl5/site_perl/${PV}:${STAGING_LIBDIR}/perl5/vendor_perl/${PV}:${STAGING_LIBDIR}/perl5/${PV}'
172
173 # Use /usr/bin/env nativeperl for the perl script.
174 for f in `grep -Il '#! *${bindir}/perl' ${D}/${bindir}/*`; do
175 sed -i -e 's|${bindir}/perl|/usr/bin/env nativeperl|' $f
176 done
177}
178
179PACKAGE_PREPROCESS_FUNCS += "perl_package_preprocess"
180
181perl_package_preprocess () {
182 # Fix up installed configuration
183 sed -i -e "s,${D},,g" \
184 -e "s,${DEBUG_PREFIX_MAP},,g" \
185 -e "s,--sysroot=${STAGING_DIR_HOST},,g" \
186 -e "s,-isystem${STAGING_INCDIR} ,,g" \
187 -e "s,${STAGING_LIBDIR},${libdir},g" \
188 -e "s,${STAGING_BINDIR},${bindir},g" \
189 -e "s,${STAGING_INCDIR},${includedir},g" \
190 -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
191 -e "s,${STAGING_BINDIR_NATIVE}/,,g" \
192 -e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
193 -e 's:${RECIPE_SYSROOT}::g' \
194 ${PKGD}${bindir}/h2xs \
195 ${PKGD}${bindir}/h2ph \
196 ${PKGD}${bindir}/pod2man \
197 ${PKGD}${bindir}/pod2text \
198 ${PKGD}${bindir}/pod2usage \
199 ${PKGD}${bindir}/podchecker \
200 ${PKGD}${bindir}/podselect \
201 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/config.h \
202 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/perl.h \
203 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/pp.h \
204 ${PKGD}${libdir}/perl5/${PV}/Config.pm \
205 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pm \
206 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pod \
207 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_git.pl \
208 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy.pl \
209 ${PKGD}${libdir}/perl5/${PV}/ExtUtils/Liblist/Kid.pm \
210 ${PKGD}${libdir}/perl5/${PV}/FileCache.pm \
211 ${PKGD}${libdir}/perl5/${PV}/pod/*.pod \
212 ${PKGD}${libdir}/perl5/config.sh
213}
214
215require perl-ptest.inc
216
217FILES_${PN} = "${bindir}/perl ${bindir}/perl.real ${bindir}/perl${PV} ${libdir}/libperl.so* \
218 ${libdir}/perl5/site_perl \
219 ${libdir}/perl5/${PV}/Config.pm \
220 ${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pm \
221 ${libdir}/perl5/${PV}/*/Config_git.pl \
222 ${libdir}/perl5/${PV}/*/Config_heavy-target.pl \
223 ${libdir}/perl5/config.sh \
224 ${libdir}/perl5/${PV}/strict.pm \
225 ${libdir}/perl5/${PV}/warnings.pm \
226 ${libdir}/perl5/${PV}/warnings \
227 ${libdir}/perl5/${PV}/vars.pm \
228 ${libdir}/perl5/site_perl \
229 ${libdir}/perl5/${PV}/ExtUtils/MANIFEST.SKIP \
230 ${libdir}/perl5/${PV}/ExtUtils/xsubpp \
231 ${libdir}/perl5/${PV}/ExtUtils/typemap \
232 "
233RPROVIDES_${PN} += "perl-module-strict perl-module-vars perl-module-config perl-module-warnings \
234 perl-module-warnings-register"
235
236FILES_${PN}-staticdev_append = " ${libdir}/perl5/${PV}/*/CORE/libperl.a"
237
238FILES_${PN}-dev_append = " ${libdir}/perl5/${PV}/*/CORE"
239
240FILES_${PN}-doc_append = " ${libdir}/perl5/${PV}/Unicode/Collate/*.txt \
241 ${libdir}/perl5/${PV}/*/.packlist \
242 ${libdir}/perl5/${PV}/Encode/encode.h \
243 "
244PACKAGES += "${PN}-misc"
245
246FILES_${PN}-misc = "${bindir}/*"
247
248PACKAGES += "${PN}-pod"
249
250FILES_${PN}-pod = "${libdir}/perl5/${PV}/pod \
251 ${libdir}/perl5/${PV}/*.pod \
252 ${libdir}/perl5/${PV}/*/*.pod \
253 ${libdir}/perl5/${PV}/*/*/*.pod \
254 ${libdir}/perl5/${PV}/*/*/*/*.pod \
255 "
256
257PACKAGES += "${PN}-module-cpan ${PN}-module-unicore"
258
259FILES_${PN}-module-cpan += "${libdir}/perl5/${PV}/CPAN \
260 "
261FILES_${PN}-module-unicore += "${libdir}/perl5/${PV}/unicore"
262
263# Create a perl-modules package recommending all the other perl
264# packages (actually the non modules packages and not created too)
265ALLOW_EMPTY_${PN}-modules = "1"
266PACKAGES += "${PN}-modules "
267
268PACKAGESPLITFUNCS_prepend = "split_perl_packages "
269
270python split_perl_packages () {
271 libdir = d.expand('${libdir}/perl5/${PV}')
272 do_split_packages(d, libdir, r'.*/auto/([^.]*)/[^/]*\.(so|ld|ix|al)', '${PN}-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False)
273 do_split_packages(d, libdir, r'.*linux/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
274 do_split_packages(d, libdir, r'Module/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
275 do_split_packages(d, libdir, r'Module/([^\/]*)/.*', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
276 do_split_packages(d, libdir, r'.*linux/([^\/].*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
277 do_split_packages(d, libdir, r'(^(?!(CPAN\/|CPANPLUS\/|Module\/|unicore\/|.*linux\/)[^\/]).*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
278
279 # perl-modules should recommend every perl module, and only the
280 # modules. Don't attempt to use the result of do_split_packages() as some
281 # modules are manually split (eg. perl-module-unicore).
282 packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES').split())
283 d.setVar(d.expand("RRECOMMENDS_${PN}-modules"), ' '.join(packages))
284
285 # Read the pre-generated dependency file, and use it to set module dependecies
286 for line in open(d.expand("${WORKDIR}") + '/perl-rdepends.txt').readlines():
287 splitline = line.split()
288 if bb.data.inherits_class('native', d):
289 module = splitline[0] + '-native'
290 depends = "perl-native"
291 else:
292 module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
293 depends = splitline[2].strip('"').replace("perl-module", "${PN}-module")
294 d.appendVar(d.expand(module), " " + depends)
295}
296
297python() {
298 if d.getVar('CLASSOVERRIDE') == "class-target":
299 d.setVar("PACKAGES_DYNAMIC", "^perl-module-.*(?<!native)$")
300 elif d.getVar('CLASSOVERRIDE') == "class-native":
301 d.setVar("PACKAGES_DYNAMIC", "^perl-module-.*-native$")
302 elif d.getVar('CLASSOVERRIDE') == "class-nativesdk":
303 d.setVar("PACKAGES_DYNAMIC", "^nativesdk-perl-module-.*")
304}
305
306RDEPENDS_${PN}-misc += "perl perl-modules"
307RDEPENDS_${PN}-pod += "perl"
308
309BBCLASSEXTEND = "native nativesdk"
310
311SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh"
312
313do_create_rdepends_inc() {
314 cd ${WORKDIR}
315 cat <<'EOPREAMBLE' > ${WORKDIR}/perl-rdepends.inc
316
317# Some additional dependencies that the above doesn't manage to figure out
318RDEPENDS_${PN}-module-file-spec += "${PN}-module-file-spec-unix"
319RDEPENDS_${PN}-module-math-bigint += "${PN}-module-math-bigint-calc"
320RDEPENDS_${PN}-module-thread-queue += "${PN}-module-attributes"
321RDEPENDS_${PN}-module-overload += "${PN}-module-overloading"
322
323# Generated depends list beyond this line
324EOPREAMBLE
325 test -e packages-split.new && rm -rf packages-split.new
326 cp -r packages-split packages-split.new && cd packages-split.new
327 find . -name \*.pm | xargs sed -i '/^=head/,/^=cut/d'
328 egrep -r "^\s*(\<use .*|\<require .*);?" perl-module-* --include="*.pm" | \
329 sed "s/\/.*\.pm: */ += /g;s/[\"\']//g;s/;.*/\"/g;s/+= .*\(require\|use\)\> */+= \"perl-module-/g;s/CPANPLUS::.*/cpanplus/g;s/CPAN::.*/cpan/g;s/::/-/g;s/ [^+\"].*//g;s/_/-/g;s/\.pl\"$/\"/;s/\"\?\$/\"/;s/(//;" | tr [:upper:] [:lower:] | \
330 awk '{if ($3 != "\x22"$1"\x22"){ print $0}}'| \
331 grep -v -e "\-vms\-" -e module-5 -e "^$" -e "\\$" -e your -e tk -e autoperl -e html -e http -e parse-cpan -e perl-ostype -e ndbm-file -e module-mac -e fcgi -e lwp -e dbd -e dbix | \
332 sort -u | \
333 sed 's/^/RDEPENDS_/;s/perl-module-/${PN}-module-/g;s/module-\(module-\)/\1/g;s/\(module-load\)-conditional/\1/g;s/encode-configlocal/&-pm/;' | \
334 egrep -wv '=>|module-a|module-apache.?|module-apr|module-authen-sasl|module-b-asmdata|module-convert-ebcdic|module-devel-size|module-digest-perl-md5|module-dumpvalue|module-extutils-constant-aaargh56hash|module-extutils-xssymset|module-file-bsdglob|module-for|module-it|module-io-socket-inet6|module-io-socket-ssl|module-io-string|module-ipc-system-simple|module-lexical|module-local-lib|metadata|module-modperl-util|module-pluggable-object|module-test-builder-io-scalar|module-test2|module-text-unidecode|module-unicore|module-win32|objects\sload|syscall.ph|systeminfo.ph|%s' | \
335 egrep -wv '=>|module-algorithm-diff|module-carp|module-c<extutils-mm-unix>|module-encode-hanextra|module-extutils-makemaker-version-regex|module-file-spec|module-io-compress-lzma|module-locale-maketext-lexicon|module-log-agent|module-meta-notation|module-net-localcfg|module-net-ping-external|module-b-deparse|module-scalar-util|module-some-module|module-symbol|module-uri|module-win32api-file' >> ${WORKDIR}/perl-rdepends.generated
336 cp ${WORKDIR}/perl-rdepends.generated ${THISDIR}/files/perl-rdepends.txt
337}
338
339# bitbake perl -c create_rdepends_inc
340addtask do_create_rdepends_inc
341
342SYSROOT_PREPROCESS_FUNCS += "perl_sysroot_create_wrapper"
343
344perl_sysroot_create_wrapper () {
345 mkdir -p ${SYSROOT_DESTDIR}${bindir}
346 # Create a wrapper that /usr/bin/env perl will use to get perl-native.
347 # This MUST live in the normal bindir.
348 cat > ${SYSROOT_DESTDIR}${bindir}/nativeperl << EOF
349#!/bin/sh
350realpath=\`readlink -fn \$0\`
351exec \`dirname \$realpath\`/perl-native/perl "\$@"
352EOF
353 chmod 0755 ${SYSROOT_DESTDIR}${bindir}/nativeperl
354 cat ${SYSROOT_DESTDIR}${bindir}/nativeperl
355}
356