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>
This commit is contained in:
Alexander Kanavin
2018-12-02 12:43:30 +01:00
committed by Richard Purdie
parent d94ac527b3
commit ead379657b
15 changed files with 5058 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
From 2f74a899474f428a4a5368a94accf801c5f97ae4 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Mon, 4 Jun 2018 18:33:50 +0300
Subject: [PATCH] ExtUtils-MakeMaker: add $(LDFLAGS) when linking binary
modules
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
index fe53be1..249c048 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
@@ -1050,7 +1050,7 @@ sub xs_make_dynamic_lib {
}
push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $dlsyms_arg, $ldfrom, $self->xs_obj_opt('$@'), $libs, $exportlist;
- %s$(LD) %s $(LDDLFLAGS) %s %s $(OTHERLDFLAGS) %s $(MYEXTLIB) \
+ %s$(LD) %s $(LDDLFLAGS) %s %s $(LDFLAGS) $(OTHERLDFLAGS) %s $(MYEXTLIB) \
$(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) %s \
$(INST_DYNAMIC_FIX)
$(CHMOD) $(PERM_RWX) $@

View File

@@ -0,0 +1,34 @@
From e8e095b9c71c58f8197d6315359446b6b084cb2b Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Tue, 5 Jun 2018 14:58:42 +0300
Subject: [PATCH] Somehow this module breaks through the perl wrapper and
declares perl binary to be 'perl.real'. This patch forces it back to perl.
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
index 948c476..f537526 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
@@ -1110,6 +1110,9 @@ WARNING
}
foreach my $name (@$names){
+ # Getting MakeMaker.pm use perl wrapper instead of 'perl.real' directly
+ $name =~ s/perl\.real/perl/ if ($name =~ /perl\.real/);
+
my ($abs, $use_dir);
if ($self->file_name_is_absolute($name)) { # /foo/bar
$abs = $name;
@@ -2006,6 +2009,7 @@ sub init_PERL {
$self->{PERL} ||=
$self->find_perl(5.0, \@perls, \@defpath, $Verbose );
+
my $perl = $self->{PERL};
$perl =~ s/^"//;

View File

@@ -0,0 +1,69 @@
From 19c1987b455998d2959a5fdf3d1ed911d35e70f2 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 2 Jan 2019 17:55:35 +0100
Subject: [PATCH] configure_path.sh: do not hardcode $prefix/lib as library
path
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
cnf/configure_args.sh | 2 +-
cnf/configure_path.sh | 11 ++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/cnf/configure_args.sh b/cnf/configure_args.sh
index 29ca4f5..3297fb3 100644
--- a/cnf/configure_args.sh
+++ b/cnf/configure_args.sh
@@ -155,7 +155,7 @@ while [ $i -le $# -o -n "$n" ]; do
help) mode="help" ;;
regen|regenerate) mode="regen" ;;
keeplog) defuser "$a" 1 ;;
- prefix|html[13]dir|libsdir) defuser $a "$v" ;;
+ prefix|html[13]dir|libsdir|libdir) defuser $a "$v" ;;
man[13]dir|otherlibsdir) defuser $a "$v" ;;
siteprefix|sitehtml[13]dir) defuser $a "$v" ;;
siteman[13]dir|vendorman[13]dir)defuser $a "$v" ;;
diff --git a/cnf/configure_path.sh b/cnf/configure_path.sh
index fe7eac7..bcba8b8 100644
--- a/cnf/configure_path.sh
+++ b/cnf/configure_path.sh
@@ -30,6 +30,7 @@ definst() {
define "$1" "$installpath$v"
}
+define libdir "$prefix/lib"
define sharedir "$prefix/share"
define html1dir "$sharedir/doc/$perlname/html"
define html3dir "$sharedir/doc/$perlname/html"
@@ -38,16 +39,16 @@ define man1ext "1"
define man3dir "$sharedir/man/man3"
define man3ext "3"
define bin "$prefix/bin"
-define lib "$prefix/lib"
+define lib "$libdir"
define scriptdir "$prefix/bin"
define libsdirs ' '
-defrel privlib "$prefix/lib/$package/$version"
-defrel archlib "$prefix/lib/$package/$version/$archname"
+defrel privlib "$libdir/$package/$version"
+defrel archlib "$libdir/$package/$version/$archname"
define perlpath "$prefix/bin/$perlname"
define d_archlib 'define'
define sitebin "$prefix/bin"
-defrel sitelib_stem "$prefix/lib/$package/site_perl"
+defrel sitelib_stem "$libdir/$package/site_perl"
define sitelib "$sitelib_stem/$version"
define sitearch "$sitelib_stem/$version/$archname"
define siteprefix "$prefix"
@@ -145,7 +146,7 @@ vendortest() {
}
vendorpath vendorbin "$vendorprefix/bin"
-vendorpath vendorlib_stem "$vendorprefix/lib/$package/vendor_perl"
+vendorpath vendorlib_stem "$libdir/$package/vendor_perl"
vendorpath vendorlib "$vendorlib_stem/$version"
vendorpath vendorarch "$vendorlib_stem/$version/$archname"
vendorpath vendorscript "$vendorprefix/bin"

View File

@@ -0,0 +1,29 @@
From a66811c487ecf8ba8724879c253bb10dfa82aeb5 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 1 Jun 2018 19:57:32 +0300
Subject: [PATCH] configure_tool.sh: do not quote the argument to 'command'
As it seems to break things if the argument has spaces and arguments in it.
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
cnf/configure_tool.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cnf/configure_tool.sh b/cnf/configure_tool.sh
index 32201c0..461bc68 100644
--- a/cnf/configure_tool.sh
+++ b/cnf/configure_tool.sh
@@ -2,7 +2,7 @@
tryprog() {
log "trying $1=$2"
- if command -v "$2" 1>/dev/null 2>/dev/null; then
+ if command -v $2 1>/dev/null 2>/dev/null; then
define "$1" "$2"
result "$2"
return 0
--
2.17.0

View File

@@ -0,0 +1,27 @@
From f824cbec9ac8f113a4ae35d57bd18625d415a71b Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Tue, 27 Nov 2018 15:37:40 +0100
Subject: [PATCH] perl-cross: add LDFLAGS when linking libperl
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 01644cd..be811a7 100644
--- a/Makefile
+++ b/Makefile
@@ -180,7 +180,7 @@ endif
ifeq ($(useshrplib),true)
$(LIBPERL):
- $(CC) $(LDDLFLAGS) -o $@ $(filter %$o,$^) $(LIBS)
+ $(CC) $(LDFLAGS) $(LDDLFLAGS) -o $@ $(filter %$o,$^) $(LIBS)
else
$(LIBPERL):
$(AR) cru $@ $(filter %$o,$^)
--
2.17.1

View File

@@ -0,0 +1,37 @@
From 8e1efba7560d8d55524c7a0f1b0539ddce419b86 Mon Sep 17 00:00:00 2001
From: Brendan O'Dea <bod@debian.org>
Date: Fri, 16 Dec 2005 01:32:14 +1100
Subject: [PATCH 6/8] Remove Errno version check due to upgrade problems with
long-running processes.
Bug-Debian: http://bugs.debian.org/343351
Remove version check which can cause problems for long running
processes embedding perl when upgrading to a newer version,
compatible, but built on a different machine.
Patch-Name: debian/errno_ver.diff
Upstream-Status: Pending
---
ext/Errno/Errno_pm.PL | 5 -----
1 file changed, 5 deletions(-)
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index 6251a3c..eeed445 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -294,11 +294,6 @@ EDQ
# they've already declared perl doesn't need to worry about this risk.
if(!$ENV{'PERL_BUILD_EXPAND_CONFIG_VARS'}) {
print <<"CONFIG_CHECK_END";
-use Config;
-"\$Config{'archname'}-\$Config{'osvers'}" eq
-"$archname-$Config{'osvers'}" or
- die "Errno architecture ($archname-$Config{'osvers'}) does not match executable architecture (\$Config{'archname'}-\$Config{'osvers'})";
-
CONFIG_CHECK_END
}
--
2.1.4

View File

@@ -0,0 +1,34 @@
From e1e159a189247af1557fe400ca861714e5ed5af4 Mon Sep 17 00:00:00 2001
From: Alex Suykov <alex.suykov@gmail.com>
Date: Thu, 3 Jan 2019 22:03:20 +0200
Subject: [PATCH] force crosspatch before any CC/HOSTCC rules
Upstream-Status: Submitted [https://github.com/arsv/perl-cross/issues/72]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
Makefile | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 01644cd..62bfc8c 100644
--- a/Makefile
+++ b/Makefile
@@ -71,9 +71,13 @@ $(CROSSPATCHED): %.applied: %.patch
# (mostly Makefile.PLs, but others can be annoying too)
.SECONDARY:
-# Force early building of miniperl -- not really necessary, but makes
-# the build process more logical. No reason to try CC if HOSTCC fails.
-all: crosspatch miniperl$X dynaloader perl$x nonxs_ext utilities extensions pods
+# Force full patching before any building starts. Als, force early building
+# of miniperl -- not really necessary, but makes the build process more logical.
+# No reason to try CC if HOSTCC fails.
+all:
+ $(MAKE) crosspatch
+ $(MAKE) miniperl$X
+ $(MAKE) dynaloader perl$x nonxs_ext utilities extensions pods
config.h: config.sh config_h.SH
CONFIG_H=$@ CONFIG_SH=$< ./config_h.SH

View File

@@ -0,0 +1,36 @@
From 3e2c1ddd06be97ba75104b1be4b6fdbd08e16bbe Mon Sep 17 00:00:00 2001
From: Alex Suykov <alex.suykov@gmail.com>
Date: Wed, 2 Jan 2019 20:37:47 +0200
Subject: [PATCH] fix Yocto intermittent failures with modules
Having -Ilib/ above -Idist/... in miniperl_top means miniperl may
attempt to switch from dist/ to lib/ while the modules are being
built, possibly picking incompletely-written files there.
Any module available via -Idist/* should only be loaded from dist/
and never from lib/ even if it gets installed into lib/ at some point.
Upstream-Status: Submitted [https://github.com/arsv/perl-cross/issues/72]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
miniperl_top | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/miniperl_top b/miniperl_top
index 96ab1a2..a0426b9 100755
--- a/miniperl_top
+++ b/miniperl_top
@@ -25,7 +25,6 @@ top=$(cd $top; pwd)
exec $top/miniperl\
-I$top/cnf/stub\
-I$top/cnf/cpan\
- -I$top/lib\
-I$top/cpan/AutoLoader/lib\
-I$top/dist/Exporter/lib\
-I$top/dist/Cwd\
@@ -50,4 +49,5 @@ exec $top/miniperl\
-I$top/cpan/parent/lib\
-I$top/cpan/version/lib\
-I$top/dist/Pod-Simple/lib\
+ -I$top/lib\
"$@"

View File

@@ -0,0 +1,27 @@
Upstream-Status:Inappropriate [embedded specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Index: perl-5.8.8/lib/ExtUtils/MM_Unix.pm
===================================================================
--- perl-5.12.3.orig/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm 2008-10-31 22:01:35.000000000 +0000
+++ perl-5.12.3/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm 2008-10-31 22:01:35.000000000 +0000
@@ -1597,6 +1597,19 @@
$self->{PERL_LIB} ||= $Config{privlibexp};
$self->{PERL_ARCHLIB} ||= $Config{archlibexp};
$self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
+ # Check for environment override so we'll find the headers in the correct place
+ if (defined $ENV{PERL_LIB})
+ {
+ $self->{PERL_LIB} = $ENV{PERL_LIB};
+ }
+ if (defined $ENV{PERL_ARCHLIB})
+ {
+ $self->{PERL_ARCHLIB} = $ENV{PERL_ARCHLIB};
+ }
+ if (defined $ENV{PERL_INC})
+ {
+ $self->{PERL_INC} = $ENV{PERL_INC};
+ }
my $perl_h;
if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))

View File

@@ -0,0 +1,48 @@
This patch is used for perl-native only. It enables the switching of
configuration files between Config_heavy.pl and
Config_heavy-target.pl by setting the environment variables
PERLCONFIGTARGET - the later containing settings for the target while
the former contains those for the host. This will allow cpan.bbclass
to use the settings appropriate for the native and/or target builds
as required. This also disables the use of the cache since the cached
values would be valid for the host only.
Upstream-Status: Inappropriate [native]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Index: perl-5.14.2/configpm
===================================================================
--- perl-5.14.2.orig/configpm
+++ perl-5.14.2/configpm
@@ -658,7 +658,7 @@ sub FETCH {
my($self, $key) = @_;
# check for cached value (which may be undef so we use exists not defined)
- return exists $self->{$key} ? $self->{$key} : $self->fetch_string($key);
+ return $self->fetch_string($key);
}
ENDOFEND
@@ -816,7 +816,21 @@ $config_txt .= sprintf <<'ENDOFTIE', $fa
sub DESTROY { }
sub AUTOLOAD {
- require 'Config_heavy.pl';
+ my $cfgfile = 'Config_heavy.pl';
+ if (defined $ENV{PERLCONFIGTARGET} and $ENV{PERLCONFIGTARGET} eq "yes")
+ {
+ $cfgfile = 'Config_heavy-target.pl';
+ }
+ if (defined $ENV{PERL_ARCHLIB})
+ {
+ push @INC, $ENV{PERL_ARCHLIB};
+ require $cfgfile;
+ pop @INC;
+ }
+ else
+ {
+ require $cfgfile;
+ }
goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/;
die "&Config::AUTOLOAD failed on $Config::AUTOLOAD";
}

View File

@@ -0,0 +1,38 @@
Upstream-Status:Inappropriate [embedded specific]
Allow the location that .so files are searched for for dynamic
loading to be changed via an environment variable. This is to allow
us to load .so's from the host system while building for the target
system.
Update by Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/21
Index: perl-5.24.1/dist/XSLoader/XSLoader_pm.PL
===================================================================
--- perl-5.24.1.orig/dist/XSLoader/XSLoader_pm.PL
+++ perl-5.24.1/dist/XSLoader/XSLoader_pm.PL
@@ -52,6 +52,24 @@ sub load {
my ($caller, $modlibname) = caller();
my $module = $caller;
+ # OE: Allow env to form dynamic loader to look in a different place
+ # This is so it finds the host .so files, not the targets
+ if (defined $ENV{PERLHOSTLIB})
+ {
+ my $hostlib = $ENV{PERLHOSTLIB};
+ my $hostarchlib = $ENV{PERLHOSTARCHLIB};
+ print STDERR "*** Module name IN: $modlibname\n";
+ ($p1, $p2, $p3, $p4, $p5, $p6, $p7) = $modlibname =~ m/(^(.*lib\w*\/)?)((perl5\/[0-9\.]*\/)?)(([^\/]*)\/)?(.*)$/;
+ print STDERR "*** p1: $p1 p3: $p3 p5: $p5 p7: $p7\n";
+ if ( $p1 ne "" ) {
+ $modlibname = $hostlib.$p7;
+ }
+ if ( $p6 ne "" ) {
+ $modlibname = $hostarchlib.$p7;
+ }
+ print STDERR "*** Module name OUT: $modlibname\n";
+ }
+
if (@_) {
$module = $_[0];
} else {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
#!/bin/sh
cd t && PERL_BUILD_PACKAGING=1 ./TEST | sed -u -e 's|\(.*\) .* ok$|PASS: \1|' -e 's|\(.*\) .* skipped|SKIP: \1|' -e 's|\(.*\) \.\(.*\)|FAIL: \1|'

View File

@@ -0,0 +1,57 @@
inherit ptest
SRC_URI += "file://run-ptest \
"
do_install_ptest () {
mkdir -p ${D}${PTEST_PATH}
sed -e "s:\/usr\/local:${bindir}:g" -i cpan/version/t/*
sed -e "s:\/opt:\/usr:" -i Porting/add-package.pl
sed -e "s:\/local\/gnu\/:\/:" -i hints/cxux.sh
tar -c --exclude=try --exclude=a.out --exclude='*.o' --exclude=libperl.so* --exclude=Makefile --exclude=makefile --exclude=hostperl \
--exclude=cygwin --exclude=os2 --exclude=djgpp --exclude=qnx --exclude=symbian --exclude=haiku \
--exclude=vms --exclude=vos --exclude=NetWare --exclude=amigaos4 --exclude=buildcustomize.pl \
--exclude='win32/config.*' --exclude=plan9 --exclude=README.plan9 --exclude=perlplan9.pod --exclude=Configure \
--exclude=veryclean.sh --exclude=realclean.sh --exclude=getioctlsizes \
--exclude=dl_aix.xs --exclude=sdbm.3 --exclude='cflags.SH' --exclude=makefile.old \
--exclude=miniperl --exclude=generate_uudmap --exclude=patches * | ( cd ${D}${PTEST_PATH} && tar -x )
ln -sf ${bindir}/perl ${D}${PTEST_PATH}/t/perl
# Remove build host references from various scattered files...
find "${D}${PTEST_PATH}" \
\( -name '*.PL' -o -name 'myconfig' -o -name 'cflags' -o -name '*.pl' -o -name '*.sh' -o -name '*.pm' \
-o -name 'h2xs' -o -name 'h2ph' \
-o -name '*.h' -o -name 'config.sh-*' -o -name 'pod2man' -o -name 'pod2text' \) \
-type f -exec sed -i \
-e "s,${D},,g" \
-e "s,--sysroot=${STAGING_DIR_HOST},,g" \
-e "s,-isystem${STAGING_INCDIR} ,,g" \
-e 's|${DEBUG_PREFIX_MAP}||g' \
-e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
-e "s,${STAGING_LIBDIR},${libdir},g" \
-e "s,${STAGING_BINDIR},${bindir},g" \
-e "s,${STAGING_INCDIR},${includedir},g" \
-e "s,${STAGING_BINDIR_NATIVE}/,,g" \
-e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
-e 's:${RECIPE_SYSROOT_NATIVE}::g' \
-e 's:${RECIPE_SYSROOT}::g' \
{} +
# Remove a useless timestamp...
sed -i -e '/Autogenerated starting on/d' ${D}${PTEST_PATH}/lib/unicore/mktables.lst
}
python populate_packages_prepend() {
# Put all *.t files from the lib dir in the ptest package
# do_split_packages requires a pair of () in the regex, but we have nothing
# to match, so use an empty pair.
if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d):
do_split_packages(d, d.expand('${libdir}/perl/${PV}'), '.*\.t()',
'${PN}-ptest%s', '%s', recursive=True, match_path=True)
}
RDEPENDS_${PN}-ptest += "${PN}-modules ${PN}-doc sed"
# The perl-ptest package contains Perl internal modules and generating file
# dependencies for it causes problems.
SKIP_FILEDEPS_${PN}-ptest = '1'

View File

@@ -0,0 +1,298 @@
SUMMARY = "Perl scripting language"
HOMEPAGE = "http://www.perl.org/"
SECTION = "devel"
LICENSE = "Artistic-1.0 | GPL-1.0+"
LIC_FILES_CHKSUM = "file://Copying;md5=5b122a36d0f6dc55279a0ebc69f3c60b \
file://Artistic;md5=71a4d5d9acc18c0952a6df2218bb68da \
"
SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \
https://github.com/arsv/perl-cross/releases/download/1.2.1/perl-cross-1.2.1.tar.gz;name=perl-cross \
file://perl-rdepends.txt \
file://0001-configure_tool.sh-do-not-quote-the-argument-to-comma.patch \
file://0001-ExtUtils-MakeMaker-add-LDFLAGS-when-linking-binary-m.patch \
file://0001-Somehow-this-module-breaks-through-the-perl-wrapper-.patch \
file://perl-configpm-switch.patch \
file://errno_ver.diff \
file://native-perlinc.patch \
file://0001-perl-cross-add-LDFLAGS-when-linking-libperl.patch \
file://perl-dynloader.patch \
file://0001-configure_path.sh-do-not-hardcode-prefix-lib-as-libr.patch \
file://fix-race-failures.patch \
file://fix-race-failures-2.patch \
"
SRC_URI[perl.md5sum] = "838198c43d4f39d7af797e2f59c2bee5"
SRC_URI[perl.sha256sum] = "3ebf85fe65df2ee165b22596540b7d5d42f84d4b72d84834f74e2e0b8956c347"
SRC_URI[perl-cross.md5sum] = "c5cdc8b7ebc449ee57fe18fc1ac60c80"
SRC_URI[perl-cross.sha256sum] = "8b706bc688ddf71b62d649bde72f648669f18b37fe0c54ec6201142ca3943498"
S = "${WORKDIR}/perl-${PV}"
inherit upstream-version-is-even
do_unpack_append() {
bb.build.exec_func('do_copy_perlcross', d)
}
do_copy_perlcross() {
cp -rf ${WORKDIR}/perl-cross*/* ${S}
}
do_configure_class-target() {
./configure --prefix=${prefix} --libdir=${libdir} \
--target=${TARGET_SYS} \
-Duseshrplib \
-Dsoname=libperl.so.5 \
-Dvendorprefix=${prefix} \
-Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux
#perl.c uses an ARCHLIB_EXP define to generate compile-time code that
#adds the archlibexp path to @INC during run-time initialization of a
#new perl interpreter.
#Because we've changed this value in a temporary way to make it
#possible to use ExtUtils::Embed in the target build (the temporary
#value in config.sh gets re-stripped out during packaging), the
#ARCHLIB_EXP value that gets generated still uses the temporary version
#instead of the original expected version (i.e. becauses it's in the
#generated config.h, it doesn't get stripped out during packaging like
#the others in config.sh).
sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h
}
do_configure_class-nativesdk() {
./configure --prefix=${prefix} \
--target=${TARGET_SYS} \
-Duseshrplib \
-Dsoname=libperl.so.5 \
-Dvendorprefix=${prefix} \
-Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux
# See the comment above
sed -i -e "s,${STAGING_LIBDIR},${libdir},g" config.h
}
do_configure_class-native() {
./configure --prefix=${prefix} \
-Dbin=${bindir}/perl-native \
-Duseshrplib \
-Dsoname=libperl.so.5 \
-Dvendorprefix=${prefix}
}
do_compile() {
oe_runmake
}
do_install() {
oe_runmake 'DESTDIR=${D}' install
install -d ${D}${libdir}/perl5
install -d ${D}${libdir}/perl5/${PV}/
install -d ${D}${libdir}/perl5/${PV}/ExtUtils/
# Save native config
install config.sh ${D}${libdir}/perl5
install lib/Config.pm ${D}${libdir}/perl5/${PV}/
install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/
# Fix up shared library
rm ${D}/${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/libperl.so
ln -sf ../../../../libperl.so.${PV} ${D}/${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/libperl.so
}
do_install_append_class-target() {
# This is used to substitute target configuration when running native perl via perl-configpm-switch.patch
ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl
}
do_install_append_class-nativesdk() {
# This is used to substitute target configuration when running native perl via perl-configpm-switch.patch
ln -s Config_heavy.pl ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy-target.pl
create_wrapper ${D}${bindir}/perl \
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}'
}
do_install_append_class-native () {
# Those wrappers mean that perl installed from sstate (which may change
# path location) works and that in the nativesdk case, the SDK can be
# installed to a different location from the one it was built for.
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}'
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}'
# Use /usr/bin/env nativeperl for the perl script.
for f in `grep -Il '#! *${bindir}/perl' ${D}/${bindir}/*`; do
sed -i -e 's|${bindir}/perl|/usr/bin/env nativeperl|' $f
done
}
PACKAGE_PREPROCESS_FUNCS += "perl_package_preprocess"
perl_package_preprocess () {
# Fix up installed configuration
sed -i -e "s,${D},,g" \
-e "s,${DEBUG_PREFIX_MAP},,g" \
-e "s,--sysroot=${STAGING_DIR_HOST},,g" \
-e "s,-isystem${STAGING_INCDIR} ,,g" \
-e "s,${STAGING_LIBDIR},${libdir},g" \
-e "s,${STAGING_BINDIR},${bindir},g" \
-e "s,${STAGING_INCDIR},${includedir},g" \
-e "s,${STAGING_BINDIR_NATIVE}/perl-native/,${bindir}/,g" \
-e "s,${STAGING_BINDIR_NATIVE}/,,g" \
-e "s,${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX},${bindir},g" \
-e 's:${RECIPE_SYSROOT}::g' \
${PKGD}${bindir}/h2xs \
${PKGD}${bindir}/h2ph \
${PKGD}${bindir}/pod2man \
${PKGD}${bindir}/pod2text \
${PKGD}${bindir}/pod2usage \
${PKGD}${bindir}/podchecker \
${PKGD}${bindir}/podselect \
${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/config.h \
${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/perl.h \
${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/pp.h \
${PKGD}${libdir}/perl5/${PV}/Config.pm \
${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pm \
${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config.pod \
${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/Config_heavy.pl \
${PKGD}${libdir}/perl5/${PV}/ExtUtils/Liblist/Kid.pm \
${PKGD}${libdir}/perl5/${PV}/FileCache.pm \
${PKGD}${libdir}/perl5/${PV}/pod/*.pod \
${PKGD}${libdir}/perl5/config.sh
}
require perl-ptest.inc
FILES_${PN} = "${bindir}/perl ${bindir}/perl.real ${bindir}/perl${PV} ${libdir}/libperl.so* \
${libdir}/perl5/site_perl \
${libdir}/perl5/${PV}/Config.pm \
${libdir}/perl5/${PV}/*/Config_heavy-target.pl \
${libdir}/perl5/config.sh \
${libdir}/perl5/${PV}/strict.pm \
${libdir}/perl5/${PV}/warnings.pm \
${libdir}/perl5/${PV}/warnings \
${libdir}/perl5/${PV}/vars.pm \
${libdir}/perl5/site_perl \
"
RPROVIDES_${PN} += "perl-module-strict perl-module-vars perl-module-config perl-module-warnings \
perl-module-warnings-register"
FILES_${PN}-staticdev_append = " ${libdir}/perl5/${PV}/*/CORE/libperl.a"
FILES_${PN}-dev_append = " ${libdir}/perl5/${PV}/*/CORE"
FILES_${PN}-doc_append = " ${libdir}/perl5/${PV}/Unicode/Collate/*.txt \
${libdir}/perl5/${PV}/*/.packlist \
${libdir}/perl5/${PV}/ExtUtils/MANIFEST.SKIP \
${libdir}/perl5/${PV}/ExtUtils/xsubpp \
${libdir}/perl5/${PV}/ExtUtils/typemap \
${libdir}/perl5/${PV}/Encode/encode.h \
"
PACKAGES += "${PN}-misc"
FILES_${PN}-misc = "${bindir}/*"
PACKAGES += "${PN}-pod"
FILES_${PN}-pod = "${libdir}/perl5/${PV}/pod \
${libdir}/perl5/${PV}/*.pod \
${libdir}/perl5/${PV}/*/*.pod \
${libdir}/perl5/${PV}/*/*/*.pod \
${libdir}/perl5/${PV}/*/*/*/*.pod \
"
PACKAGES += "${PN}-module-cpan ${PN}-module-unicore"
FILES_${PN}-module-cpan += "${libdir}/perl5/${PV}/CPAN \
"
FILES_${PN}-module-unicore += "${libdir}/perl5/${PV}/unicore"
# Create a perl-modules package recommending all the other perl
# packages (actually the non modules packages and not created too)
ALLOW_EMPTY_${PN}-modules = "1"
PACKAGES += "${PN}-modules "
PACKAGESPLITFUNCS_prepend = "split_perl_packages "
python split_perl_packages () {
libdir = d.expand('${libdir}/perl5/${PV}')
do_split_packages(d, libdir, '.*/auto/([^.]*)/[^/]*\.(so|ld|ix|al)', '${PN}-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False)
do_split_packages(d, libdir, '.*linux/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
do_split_packages(d, libdir, 'Module/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
do_split_packages(d, libdir, 'Module/([^\/]*)/.*', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
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)
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)
# perl-modules should recommend every perl module, and only the
# modules. Don't attempt to use the result of do_split_packages() as some
# modules are manually split (eg. perl-module-unicore).
packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES').split())
d.setVar(d.expand("RRECOMMENDS_${PN}-modules"), ' '.join(packages))
# Read the pre-generated dependency file, and use it to set module dependecies
for line in open(d.expand("${WORKDIR}") + '/perl-rdepends.txt').readlines():
splitline = line.split()
module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
depends = splitline[2].strip('"').replace("perl-module", "${PN}-module")
d.appendVar(d.expand(module), " " + depends)
}
PACKAGES_DYNAMIC_class-target += "^perl-module-.*"
PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
RDEPENDS_${PN}-misc += "perl perl-modules"
RDEPENDS_${PN}-pod += "perl"
BBCLASSEXTEND = "native nativesdk"
SSTATE_SCAN_FILES += "*.pm *.pod *.h *.pl *.sh"
do_create_rdepends_inc() {
cd ${WORKDIR}
cat <<'EOPREAMBLE' > ${WORKDIR}/perl-rdepends.inc
# Some additional dependencies that the above doesn't manage to figure out
RDEPENDS_${PN}-module-file-spec += "${PN}-module-file-spec-unix"
RDEPENDS_${PN}-module-math-bigint += "${PN}-module-math-bigint-calc"
RDEPENDS_${PN}-module-thread-queue += "${PN}-module-attributes"
RDEPENDS_${PN}-module-overload += "${PN}-module-overloading"
# Generated depends list beyond this line
EOPREAMBLE
test -e packages-split.new && rm -rf packages-split.new
cp -r packages-split packages-split.new && cd packages-split.new
find . -name \*.pm | xargs sed -i '/^=head/,/^=cut/d'
egrep -r "^\s*(\<use .*|\<require .*);?" perl-module-* --include="*.pm" | \
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:] | \
awk '{if ($3 != "\x22"$1"\x22"){ print $0}}'| \
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 | \
sort -u | \
sed 's/^/RDEPENDS_/;s/perl-module-/${PN}-module-/g;s/module-\(module-\)/\1/g;s/\(module-load\)-conditional/\1/g;s/encode-configlocal/&-pm/;' | \
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' | \
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
cp ${WORKDIR}/perl-rdepends.generated ${THISDIR}/files/perl-rdepends.txt
}
# bitbake perl -c create_rdepends_inc
addtask do_create_rdepends_inc
SYSROOT_PREPROCESS_FUNCS += "perl_sysroot_create_wrapper"
perl_sysroot_create_wrapper () {
mkdir -p ${SYSROOT_DESTDIR}${bindir}
# Create a wrapper that /usr/bin/env perl will use to get perl-native.
# This MUST live in the normal bindir.
cat > ${SYSROOT_DESTDIR}${bindir}/nativeperl << EOF
#!/bin/sh
realpath=\`readlink -fn \$0\`
exec \`dirname \$realpath\`/perl-native/perl "\$@"
EOF
chmod 0755 ${SYSROOT_DESTDIR}${bindir}/nativeperl
cat ${SYSROOT_DESTDIR}${bindir}/nativeperl
}