summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/perl-sanity/perl_5.28.1.bb
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2018-12-02 12:43:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-11 10:39:09 +0000
commitead379657b85dad0104661b9162b0b847b9391fd (patch)
tree8b6935d9d7c0a72dabd46637ce554042a654363d /meta/recipes-devtools/perl-sanity/perl_5.28.1.bb
parentd94ac527b3a2bf1a8330b676513062bf699fbbe3 (diff)
downloadpoky-ead379657b85dad0104661b9162b0b847b9391fd.tar.gz
perl: add a version that builds the recipe using perl-cross, and update to 5.28.1
perl-cross is a build system overlay from buildroot project that aims to bring a bit of sanity to cross-building perl. The advantage of using that is that we can drop a lot of custom patches (that no one really understands), and simplify the perl recipe as well. Also the build time goes down from several minutes to about 30 seconds. The whole thing becomes maintainable again, in my opinion. When rewriting the recipe I had two goals in mind: 1. Stay with upstream defaults as much as possible 2. Add custom patches only when their necessity was proven through testing. http://arsv.github.io/perl-cross/ (From OE-Core rev: 52f2828314f851263ca3a6beb41ec936fab4d3ab) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/perl-sanity/perl_5.28.1.bb')
-rw-r--r--meta/recipes-devtools/perl-sanity/perl_5.28.1.bb298
1 files changed, 298 insertions, 0 deletions
diff --git a/meta/recipes-devtools/perl-sanity/perl_5.28.1.bb b/meta/recipes-devtools/perl-sanity/perl_5.28.1.bb
new file mode 100644
index 0000000000..4ce158f4f8
--- /dev/null
+++ b/meta/recipes-devtools/perl-sanity/perl_5.28.1.bb
@@ -0,0 +1,298 @@
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.2.1/perl-cross-1.2.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://perl-configpm-switch.patch \
17 file://errno_ver.diff \
18 file://native-perlinc.patch \
19 file://0001-perl-cross-add-LDFLAGS-when-linking-libperl.patch \
20 file://perl-dynloader.patch \
21 file://0001-configure_path.sh-do-not-hardcode-prefix-lib-as-libr.patch \
22 file://fix-race-failures.patch \
23 file://fix-race-failures-2.patch \
24 "
25
26SRC_URI[perl.md5sum] = "838198c43d4f39d7af797e2f59c2bee5"
27SRC_URI[perl.sha256sum] = "3ebf85fe65df2ee165b22596540b7d5d42f84d4b72d84834f74e2e0b8956c347"
28SRC_URI[perl-cross.md5sum] = "c5cdc8b7ebc449ee57fe18fc1ac60c80"
29SRC_URI[perl-cross.sha256sum] = "8b706bc688ddf71b62d649bde72f648669f18b37fe0c54ec6201142ca3943498"
30
31S = "${WORKDIR}/perl-${PV}"
32
33inherit upstream-version-is-even
34
35do_unpack_append() {
36 bb.build.exec_func('do_copy_perlcross', d)
37}
38
39do_copy_perlcross() {
40 cp -rf ${WORKDIR}/perl-cross*/* ${S}
41}
42
43do_configure_class-target() {
44 ./configure --prefix=${prefix} --libdir=${libdir} \
45 --target=${TARGET_SYS} \
46 -Duseshrplib \
47 -Dsoname=libperl.so.5 \
48 -Dvendorprefix=${prefix} \
49 -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux
50
51 #perl.c uses an ARCHLIB_EXP define to generate compile-time code that
52 #adds the archlibexp path to @INC during run-time initialization of a
53 #new perl interpreter.
54
55 #Because we've changed this value in a temporary way to make it
56 #possible to use ExtUtils::Embed in the target build (the temporary
57 #value in config.sh gets re-stripped out during packaging), the
58 #ARCHLIB_EXP value that gets generated still uses the temporary version
59 #instead of the original expected version (i.e. becauses it's in the
60 #generated config.h, it doesn't get stripped out during packaging like
61 #the others in config.sh).
62
63 sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h
64}
65
66do_configure_class-nativesdk() {
67 ./configure --prefix=${prefix} \
68 --target=${TARGET_SYS} \
69 -Duseshrplib \
70 -Dsoname=libperl.so.5 \
71 -Dvendorprefix=${prefix} \
72 -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux
73
74 # See the comment above
75 sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h
76}
77
78do_configure_class-native() {
79 ./configure --prefix=${prefix} \
80 -Dbin=${bindir}/perl-native \
81 -Duseshrplib \
82 -Dsoname=libperl.so.5 \
83 -Dvendorprefix=${prefix}
84}
85
86do_compile() {
87 oe_runmake
88}
89
90do_install() {
91 oe_runmake 'DESTDIR=${D}' install
92
93 install -d ${D}${libdir}/perl5
94 install -d ${D}${libdir}/perl5/${PV}/
95 install -d ${D}${libdir}/perl5/${PV}/ExtUtils/
96
97 # Save native config
98 install config.sh ${D}${libdir}/perl5
99 install lib/Config.pm ${D}${libdir}/perl5/${PV}/
100 install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/
101
102 # Fix up shared library
103 rm ${D}/${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/libperl.so
104 ln -sf ../../../../libperl.so.${PV} ${D}/${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/libperl.so
105}
106
107do_install_append_class-target() {
108 # This is used to substitute target configuration when running native perl via perl-configpm-switch.patch
109 ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl
110
111}
112
113do_install_append_class-nativesdk() {
114 # This is used to substitute target configuration when running native perl via perl-configpm-switch.patch
115 ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl
116
117 create_wrapper ${D}${bindir}/perl \
118 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}'
119}
120
121do_install_append_class-native () {
122 # Those wrappers mean that perl installed from sstate (which may change
123 # path location) works and that in the nativesdk case, the SDK can be
124 # installed to a different location from the one it was built for.
125 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}'
126 create_wrapper ${D}${bindir}/perl-native/perl${PV} PERL5LIB='$PERL5LIB:${STAGING_LIBDIR}/perl5/site_perl/${PV}:${STAGING_LIBDIR}/perl5/vendor_perl/${PV}:${STAGING_LIBDIR}/perl5/${PV}'
127
128 # Use /usr/bin/env nativeperl for the perl script.
129 for f in `grep -Il '#! *${bindir}/perl' ${D}/${bindir}/*`; do
130 sed -i -e 's|${bindir}/perl|/usr/bin/env nativeperl|' $f
131 done
132}
133
134PACKAGE_PREPROCESS_FUNCS += "perl_package_preprocess"
135
136perl_package_preprocess () {
137 # Fix up installed configuration
138 sed -i -e "s,${D},,g" \
139 -e "s,${DEBUG_PREFIX_MAP},,g" \
140 -e "s,--sysroot=${STAGING_DIR_HOST},,g" \
141 -e "s,-isystem${STAGING_INCDIR} ,,g" \
142 -e "s,${STAGING_LIBDIR},${libdir},g" \
143 -e "s,${STAGING_BINDIR},${bindir},g" \
144 -e "s,${STAGING_INCDIR},${includedir},g" \
145 -e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
146 -e "s,${STAGING_BINDIR_NATIVE}/,,g" \
147 -e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
148 -e 's:${RECIPE_SYSROOT}::g' \
149 ${PKGD}${bindir}/h2xs \
150 ${PKGD}${bindir}/h2ph \
151 ${PKGD}${bindir}/pod2man \
152 ${PKGD}${bindir}/pod2text \
153 ${PKGD}${bindir}/pod2usage \
154 ${PKGD}${bindir}/podchecker \
155 ${PKGD}${bindir}/podselect \
156 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/config.h \
157 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/perl.h \
158 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/pp.h \
159 ${PKGD}${libdir}/perl5/${PV}/Config.pm \
160 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pm \
161 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pod \
162 ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy.pl \
163 ${PKGD}${libdir}/perl5/${PV}/ExtUtils/Liblist/Kid.pm \
164 ${PKGD}${libdir}/perl5/${PV}/FileCache.pm \
165 ${PKGD}${libdir}/perl5/${PV}/pod/*.pod \
166 ${PKGD}${libdir}/perl5/config.sh
167}
168
169require perl-ptest.inc
170
171FILES_${PN} = "${bindir}/perl ${bindir}/perl.real ${bindir}/perl${PV} ${libdir}/libperl.so* \
172 ${libdir}/perl5/site_perl \
173 ${libdir}/perl5/${PV}/Config.pm \
174 ${libdir}/perl5/${PV}/*/Config_heavy-target.pl \
175 ${libdir}/perl5/config.sh \
176 ${libdir}/perl5/${PV}/strict.pm \
177 ${libdir}/perl5/${PV}/warnings.pm \
178 ${libdir}/perl5/${PV}/warnings \
179 ${libdir}/perl5/${PV}/vars.pm \
180 ${libdir}/perl5/site_perl \
181 "
182RPROVIDES_${PN} += "perl-module-strict perl-module-vars perl-module-config perl-module-warnings \
183 perl-module-warnings-register"
184
185FILES_${PN}-staticdev_append = " ${libdir}/perl5/${PV}/*/CORE/libperl.a"
186
187FILES_${PN}-dev_append = " ${libdir}/perl5/${PV}/*/CORE"
188
189FILES_${PN}-doc_append = " ${libdir}/perl5/${PV}/Unicode/Collate/*.txt \
190 ${libdir}/perl5/${PV}/*/.packlist \
191 ${libdir}/perl5/${PV}/ExtUtils/MANIFEST.SKIP \
192 ${libdir}/perl5/${PV}/ExtUtils/xsubpp \
193 ${libdir}/perl5/${PV}/ExtUtils/typemap \
194 ${libdir}/perl5/${PV}/Encode/encode.h \
195 "
196PACKAGES += "${PN}-misc"
197
198FILES_${PN}-misc = "${bindir}/*"
199
200PACKAGES += "${PN}-pod"
201
202FILES_${PN}-pod = "${libdir}/perl5/${PV}/pod \
203 ${libdir}/perl5/${PV}/*.pod \
204 ${libdir}/perl5/${PV}/*/*.pod \
205 ${libdir}/perl5/${PV}/*/*/*.pod \
206 ${libdir}/perl5/${PV}/*/*/*/*.pod \
207 "
208
209PACKAGES += "${PN}-module-cpan ${PN}-module-unicore"
210
211FILES_${PN}-module-cpan += "${libdir}/perl5/${PV}/CPAN \
212 "
213FILES_${PN}-module-unicore += "${libdir}/perl5/${PV}/unicore"
214
215# Create a perl-modules package recommending all the other perl
216# packages (actually the non modules packages and not created too)
217ALLOW_EMPTY_${PN}-modules = "1"
218PACKAGES += "${PN}-modules "
219
220PACKAGESPLITFUNCS_prepend = "split_perl_packages "
221
222python split_perl_packages () {
223 libdir = d.expand('${libdir}/perl5/${PV}')
224 do_split_packages(d, libdir, '.*/auto/([^.]*)/[^/]*\.(so|ld|ix|al)', '${PN}-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False)
225 do_split_packages(d, libdir, '.*linux/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
226 do_split_packages(d, libdir, 'Module/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
227 do_split_packages(d, libdir, 'Module/([^\/]*)/.*', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
228 do_split_packages(d, libdir, '.*linux/([^\/].*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
229 do_split_packages(d, libdir, '(^(?!(CPAN\/|CPANPLUS\/|Module\/|unicore\/)[^\/]).*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
230
231 # perl-modules should recommend every perl module, and only the
232 # modules. Don't attempt to use the result of do_split_packages() as some
233 # modules are manually split (eg. perl-module-unicore).
234 packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES').split())
235 d.setVar(d.expand("RRECOMMENDS_${PN}-modules"), ' '.join(packages))
236
237 # Read the pre-generated dependency file, and use it to set module dependecies
238 for line in open(d.expand("${WORKDIR}") + '/perl-rdepends.txt').readlines():
239 splitline = line.split()
240 module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
241 depends = splitline[2].strip('"').replace("perl-module", "${PN}-module")
242 d.appendVar(d.expand(module), " " + depends)
243}
244
245PACKAGES_DYNAMIC_class-target += "^perl-module-.*"
246PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
247
248RDEPENDS_${PN}-misc += "perl perl-modules"
249RDEPENDS_${PN}-pod += "perl"
250
251BBCLASSEXTEND = "native nativesdk"
252
253SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh"
254
255do_create_rdepends_inc() {
256 cd ${WORKDIR}
257 cat <<'EOPREAMBLE' > ${WORKDIR}/perl-rdepends.inc
258
259# Some additional dependencies that the above doesn't manage to figure out
260RDEPENDS_${PN}-module-file-spec += "${PN}-module-file-spec-unix"
261RDEPENDS_${PN}-module-math-bigint += "${PN}-module-math-bigint-calc"
262RDEPENDS_${PN}-module-thread-queue += "${PN}-module-attributes"
263RDEPENDS_${PN}-module-overload += "${PN}-module-overloading"
264
265# Generated depends list beyond this line
266EOPREAMBLE
267 test -e packages-split.new && rm -rf packages-split.new
268 cp -r packages-split packages-split.new && cd packages-split.new
269 find . -name \*.pm | xargs sed -i '/^=head/,/^=cut/d'
270 egrep -r "^\s*(\<use .*|\<require .*);?" perl-module-* --include="*.pm" | \
271 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:] | \
272 awk '{if ($3 != "\x22"$1"\x22"){ print $0}}'| \
273 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 | \
274 sort -u | \
275 sed 's/^/RDEPENDS_/;s/perl-module-/${PN}-module-/g;s/module-\(module-\)/\1/g;s/\(module-load\)-conditional/\1/g;s/encode-configlocal/&-pm/;' | \
276 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' | \
277 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
278 cp ${WORKDIR}/perl-rdepends.generated ${THISDIR}/files/perl-rdepends.txt
279}
280
281# bitbake perl -c create_rdepends_inc
282addtask do_create_rdepends_inc
283
284SYSROOT_PREPROCESS_FUNCS += "perl_sysroot_create_wrapper"
285
286perl_sysroot_create_wrapper () {
287 mkdir -p ${SYSROOT_DESTDIR}${bindir}
288 # Create a wrapper that /usr/bin/env perl will use to get perl-native.
289 # This MUST live in the normal bindir.
290 cat > ${SYSROOT_DESTDIR}${bindir}/nativeperl << EOF
291#!/bin/sh
292realpath=\`readlink -fn \$0\`
293exec \`dirname \$realpath\`/perl-native/perl "\$@"
294EOF
295 chmod 0755 ${SYSROOT_DESTDIR}${bindir}/nativeperl
296 cat ${SYSROOT_DESTDIR}${bindir}/nativeperl
297}
298