From 5b18d7a0c04832aa0881272ff53e6e9a69545b1b Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Wed, 6 Sep 2023 18:56:22 +0200 Subject: perl: update 5.36.1 -> 5.38.0 Rebase perl-configpm-switch.patch. Add a patch to perl-cross to unbreak perl's line numbers printing. (From OE-Core rev: f90922cdeef5a6a4b711c5be2156c05bdb20d5b5) Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- ...re_pfmt.sh-add-32-bit-integer-format-defi.patch | 28 ++ meta/recipes-devtools/perl-cross/perlcross_1.5.bb | 1 + .../perl/files/CVE-2023-31484.patch | 29 -- .../perl/files/CVE-2023-31486-0001.patch | 217 ----------- .../perl/files/CVE-2023-31486-0002.patch | 36 -- .../perl/files/perl-configpm-switch.patch | 66 ++-- meta/recipes-devtools/perl/perl_5.36.1.bb | 420 --------------------- meta/recipes-devtools/perl/perl_5.38.0.bb | 419 ++++++++++++++++++++ 8 files changed, 481 insertions(+), 735 deletions(-) create mode 100644 meta/recipes-devtools/perl-cross/files/0001-cnf-configure_pfmt.sh-add-32-bit-integer-format-defi.patch delete mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31484.patch delete mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31486-0001.patch delete mode 100644 meta/recipes-devtools/perl/files/CVE-2023-31486-0002.patch delete mode 100644 meta/recipes-devtools/perl/perl_5.36.1.bb create mode 100644 meta/recipes-devtools/perl/perl_5.38.0.bb diff --git a/meta/recipes-devtools/perl-cross/files/0001-cnf-configure_pfmt.sh-add-32-bit-integer-format-defi.patch b/meta/recipes-devtools/perl-cross/files/0001-cnf-configure_pfmt.sh-add-32-bit-integer-format-defi.patch new file mode 100644 index 0000000000..4de4a5b955 --- /dev/null +++ b/meta/recipes-devtools/perl-cross/files/0001-cnf-configure_pfmt.sh-add-32-bit-integer-format-defi.patch @@ -0,0 +1,28 @@ +From 920abf3dc39c851a655b719622c76a6f0dc9981d Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Tue, 5 Sep 2023 19:47:33 +0200 +Subject: [PATCH] cnf/configure_pfmt.sh: add 32 bit integer format definitions + +These started to matter in perl 5.38 where they are used to print +line numbers. + +Upstream-Status: Submitted [https://github.com/arsv/perl-cross/pull/143] +Signed-off-by: Alexander Kanavin +--- + cnf/configure_pfmt.sh | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/cnf/configure_pfmt.sh b/cnf/configure_pfmt.sh +index 8f93da1..7bb4b6f 100644 +--- a/cnf/configure_pfmt.sh ++++ b/cnf/configure_pfmt.sh +@@ -52,3 +52,9 @@ else + define uvxformat '"lx"' + define uvXUformat '"lX"' + fi ++ ++define i32dformat 'PRId32' ++define u32uformat 'PRIu32' ++define u32oformat 'PRIo32' ++define u32xformat 'PRIx32' ++define u32XUformat 'PRIX32' diff --git a/meta/recipes-devtools/perl-cross/perlcross_1.5.bb b/meta/recipes-devtools/perl-cross/perlcross_1.5.bb index d17945480e..7ca4977b97 100644 --- a/meta/recipes-devtools/perl-cross/perlcross_1.5.bb +++ b/meta/recipes-devtools/perl-cross/perlcross_1.5.bb @@ -15,6 +15,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/perl-cross-${PV}.tar.gz;name=perl-c file://0001-perl-cross-add-LDFLAGS-when-linking-libperl.patch \ file://determinism.patch \ file://0001-Makefile-check-the-file-if-patched-or-not.patch \ + file://0001-cnf-configure_pfmt.sh-add-32-bit-integer-format-defi.patch \ " GITHUB_BASE_URI = "https://github.com/arsv/perl-cross/releases/" diff --git a/meta/recipes-devtools/perl/files/CVE-2023-31484.patch b/meta/recipes-devtools/perl/files/CVE-2023-31484.patch deleted file mode 100644 index 9a9117c53a..0000000000 --- a/meta/recipes-devtools/perl/files/CVE-2023-31484.patch +++ /dev/null @@ -1,29 +0,0 @@ -From a625ec2cc3a0b6116c1f8b831d3480deb621c245 Mon Sep 17 00:00:00 2001 -From: Stig Palmquist -Date: Tue, 28 Feb 2023 11:54:06 +0100 -Subject: [PATCH] Add verify_SSL=>1 to HTTP::Tiny to verify https server - identity - -CVE: CVE-2023-31484 - -Upstream-Status: Backport [https://github.com/andk/cpanpm/commit/9c98370287f4e709924aee7c58ef21c85289a7f0] - -Signed-off-by: Soumya ---- - cpan/CPAN/lib/CPAN/HTTP/Client.pm | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/cpan/CPAN/lib/CPAN/HTTP/Client.pm b/cpan/CPAN/lib/CPAN/HTTP/Client.pm -index 4fc792c..a616fee 100644 ---- a/cpan/CPAN/lib/CPAN/HTTP/Client.pm -+++ b/cpan/CPAN/lib/CPAN/HTTP/Client.pm -@@ -32,6 +32,7 @@ sub mirror { - - my $want_proxy = $self->_want_proxy($uri); - my $http = HTTP::Tiny->new( -+ verify_SSL => 1, - $want_proxy ? (proxy => $self->{proxy}) : () - ); - --- -2.40.0 diff --git a/meta/recipes-devtools/perl/files/CVE-2023-31486-0001.patch b/meta/recipes-devtools/perl/files/CVE-2023-31486-0001.patch deleted file mode 100644 index 0531e1f099..0000000000 --- a/meta/recipes-devtools/perl/files/CVE-2023-31486-0001.patch +++ /dev/null @@ -1,217 +0,0 @@ -From 77f557ef84698efeb6eed04e4a9704eaf85b741d -From: Stig Palmquist -Date: Mon Jun 5 16:46:22 2023 +0200 -Subject: [PATCH] Change verify_SSL default to 1, add ENV var to enable - insecure default - -- Changes the `verify_SSL` default parameter from `0` to `1` - - Based on patch by Dominic Hargreaves: - https://salsa.debian.org/perl-team/interpreter/perl/-/commit/1490431e40e22052f75a0b3449f1f53cbd27ba92 - - CVE: CVE-2023-31486 - -- Add check for `$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT}` that - enables the previous insecure default behaviour if set to `1`. - - This provides a workaround for users who encounter problems with the - new `verify_SSL` default. - - Example to disable certificate checks: - ``` - $ PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1 ./script.pl - ``` - -- Updates to documentation: - - Describe changing the verify_SSL value - - Describe the escape-hatch environment variable - - Remove rationale for not enabling verify_SSL - - Add missing certificate search paths - - Replace "SSL" with "TLS/SSL" where appropriate - - Use "machine-in-the-middle" instead of "man-in-the-middle" - -Upstream-Status: Backport [https://github.com/chansen/p5-http-tiny/commit/77f557ef84698efeb6eed04e4a9704eaf85b741d] - -Signed-off-by: Soumya ---- - cpan/HTTP-Tiny/lib/HTTP/Tiny.pm | 86 ++++++++++++++++++++++----------- - 1 file changed, 57 insertions(+), 29 deletions(-) - -diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm -index 83ca06d..ebc34a1 100644 ---- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm -+++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm -@@ -40,10 +40,14 @@ sub _croak { require Carp; Carp::croak(@_) } - #pod * C — Request timeout in seconds (default is 60) If a socket open, - #pod read or write takes longer than the timeout, the request response status code - #pod will be 599. --#pod * C — A boolean that indicates whether to validate the SSL --#pod certificate of an C — connection (default is false) -+#pod * C — A boolean that indicates whether to validate the TLS/SSL -+#pod certificate of an C — connection (default is true). Changed from false -+#pod to true in version 0.083. - #pod * C — A hashref of C — options to pass through to - #pod L -+#pod * C<$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT}> - Changes the default -+#pod certificate verification behavior to not check server identity if set to 1. -+#pod Only effective if C is not set. Added in version 0.083. - #pod - #pod An accessor/mutator method exists for each attribute. - #pod -@@ -111,11 +115,17 @@ sub timeout { - sub new { - my($class, %args) = @_; - -+ # Support lower case verify_ssl argument, but only if verify_SSL is not -+ # true. -+ if ( exists $args{verify_ssl} ) { -+ $args{verify_SSL} ||= $args{verify_ssl}; -+ } -+ - my $self = { - max_redirect => 5, - timeout => defined $args{timeout} ? $args{timeout} : 60, - keep_alive => 1, -- verify_SSL => $args{verify_SSL} || $args{verify_ssl} || 0, # no verification by default -+ verify_SSL => defined $args{verify_SSL} ? $args{verify_SSL} : _verify_SSL_default(), - no_proxy => $ENV{no_proxy}, - }; - -@@ -134,6 +144,13 @@ sub new { - return $self; - } - -+sub _verify_SSL_default { -+ my ($self) = @_; -+ # Check if insecure default certificate verification behaviour has been -+ # changed by the user by setting PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1 -+ return (($ENV{PERL_HTTP_TINY_INSECURE_BY_DEFAULT} || '') eq '1') ? 0 : 1; -+} -+ - sub _set_proxies { - my ($self) = @_; - -@@ -1055,7 +1072,7 @@ sub new { - timeout => 60, - max_line_size => 16384, - max_header_lines => 64, -- verify_SSL => 0, -+ verify_SSL => HTTP::Tiny::_verify_SSL_default(), - SSL_options => {}, - %args - }, $class; -@@ -2043,11 +2060,11 @@ proxy - timeout - verify_SSL - --=head1 SSL SUPPORT -+=head1 TLS/SSL SUPPORT - - Direct C connections are supported only if L 1.56 or - greater and L 1.49 or greater are installed. An error will occur --if new enough versions of these modules are not installed or if the SSL -+if new enough versions of these modules are not installed or if the TLS - encryption fails. You can also use C utility function - that returns boolean to see if the required modules are installed. - -@@ -2055,7 +2072,7 @@ An C connection may be made via an C proxy that supports the CONNEC - command (i.e. RFC 2817). You may not proxy C via a proxy that itself - requires C to communicate. - --SSL provides two distinct capabilities: -+TLS/SSL provides two distinct capabilities: - - =over 4 - -@@ -2069,24 +2086,17 @@ Verification of server identity - - =back - --B. -- --Server identity verification is controversial and potentially tricky because it --depends on a (usually paid) third-party Certificate Authority (CA) trust model --to validate a certificate as legitimate. This discriminates against servers --with self-signed certificates or certificates signed by free, community-driven --CA's such as L. -+B. - --By default, HTTP::Tiny does not make any assumptions about your trust model, --threat level or risk tolerance. It just aims to give you an encrypted channel --when you need one. -+This was changed in version 0.083 due to security concerns. The previous default -+behavior can be enabled by setting C<$ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT}> -+to 1. - --Setting the C attribute to a true value will make HTTP::Tiny verify --that an SSL connection has a valid SSL certificate corresponding to the host --name of the connection and that the SSL certificate has been verified by a CA. --Assuming you trust the CA, this will protect against a L. If you are --concerned about security, you should enable this option. -+Verification is done by checking that that the TLS/SSL connection has a valid -+certificate corresponding to the host name of the connection and that the -+certificate has been verified by a CA. Assuming you trust the CA, this will -+protect against L. - - Certificate verification requires a file containing trusted CA certificates. - -@@ -2094,9 +2104,7 @@ If the environment variable C is present, HTTP::Tiny - will try to find a CA certificate file in that location. - - If the L module is installed, HTTP::Tiny will use the CA file --included with it as a source of trusted CA's. (This means you trust Mozilla, --the author of Mozilla::CA, the CPAN mirror where you got Mozilla::CA, the --toolchain used to install it, and your operating system security, right?) -+included with it as a source of trusted CA's. - - If that module is not available, then HTTP::Tiny will search several - system-specific default locations for a CA certificate file: -@@ -2115,13 +2123,33 @@ system-specific default locations for a CA certificate file: - - /etc/ssl/ca-bundle.pem - -+=item * -+ -+/etc/openssl/certs/ca-certificates.crt -+ -+=item * -+ -+/etc/ssl/cert.pem -+ -+=item * -+ -+/usr/local/share/certs/ca-root-nss.crt -+ -+=item * -+ -+/etc/pki/tls/cacert.pem -+ -+=item * -+ -+/etc/certs/ca-certificates.crt -+ - =back - - An error will be occur if C is true and no CA certificate file - is available. - --If you desire complete control over SSL connections, the C attribute --lets you provide a hash reference that will be passed through to -+If you desire complete control over TLS/SSL connections, the C -+attribute lets you provide a hash reference that will be passed through to - C, overriding any options set by HTTP::Tiny. For - example, to provide your own trusted CA file: - -@@ -2131,7 +2159,7 @@ example, to provide your own trusted CA file: - - The C attribute could also be used for such things as providing a - client certificate for authentication to a server or controlling the choice of --cipher used for the SSL connection. See L documentation for -+cipher used for the TLS/SSL connection. See L documentation for - details. - - =head1 PROXY SUPPORT --- -2.40.0 diff --git a/meta/recipes-devtools/perl/files/CVE-2023-31486-0002.patch b/meta/recipes-devtools/perl/files/CVE-2023-31486-0002.patch deleted file mode 100644 index 45452be389..0000000000 --- a/meta/recipes-devtools/perl/files/CVE-2023-31486-0002.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a22785783b17cbaa28afaee4a024d81a1903701d -From: Stig Palmquist -Date: Sun Jun 18 11:36:05 2023 +0200 -Subject: [PATCH] Fix incorrect env var name for verify_SSL default - -The variable to override the verify_SSL default differed slightly in the -documentation from what was checked for in the code. - -This commit makes the code use `PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT` -as documented, instead of `PERL_HTTP_TINY_INSECURE_BY_DEFAULT` which was -missing `SSL_` - -CVE: CVE-2023-31486 - -Upstream-Status: Backport [https://github.com/chansen/p5-http-tiny/commit/a22785783b17cbaa28afaee4a024d81a1903701d] - -Signed-off-by: Soumya ---- - cpan/HTTP-Tiny/lib/HTTP/Tiny.pm | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm -index ebc34a1..65ac8ff 100644 ---- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm -+++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm -@@ -148,7 +148,7 @@ sub _verify_SSL_default { - my ($self) = @_; - # Check if insecure default certificate verification behaviour has been - # changed by the user by setting PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT=1 -- return (($ENV{PERL_HTTP_TINY_INSECURE_BY_DEFAULT} || '') eq '1') ? 0 : 1; -+ return (($ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT} || '') eq '1') ? 0 : 1; - } - - sub _set_proxies { --- -2.40.0 diff --git a/meta/recipes-devtools/perl/files/perl-configpm-switch.patch b/meta/recipes-devtools/perl/files/perl-configpm-switch.patch index 7ca7c7d12f..0be1d5a93c 100644 --- a/meta/recipes-devtools/perl/files/perl-configpm-switch.patch +++ b/meta/recipes-devtools/perl/files/perl-configpm-switch.patch @@ -1,4 +1,4 @@ -From e789c1a0c9de5928a3b49f5b9d81b63636f5c7bb Mon Sep 17 00:00:00 2001 +From c25d460a2f00e9af25087d40447fe1a81c89710c Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Sun, 27 May 2007 21:04:11 +0000 Subject: [PATCH] perl: 5.8.7 -> 5.8.8 (from OE) @@ -20,38 +20,38 @@ Signed-off-by: Alexander Kanavin 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/configpm b/configpm -index 94a4778..99b20c9 100755 +index 07219d8..01a23fa 100755 --- a/configpm +++ b/configpm -@@ -687,7 +687,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); - } - +@@ -718,7 +718,7 @@ $config_txt .= uncomment <<'ENDOFEND'; + # 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 -@@ -845,7 +845,21 @@ $config_txt .= sprintf <<'ENDOFTIE', $fast_config; - 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"; - } +@@ -876,7 +876,21 @@ $config_txt .= sprintf uncomment <<'ENDOFTIE', $fast_config; + # 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"; + # } diff --git a/meta/recipes-devtools/perl/perl_5.36.1.bb b/meta/recipes-devtools/perl/perl_5.36.1.bb deleted file mode 100644 index 87768cc7f7..0000000000 --- a/meta/recipes-devtools/perl/perl_5.36.1.bb +++ /dev/null @@ -1,420 +0,0 @@ -SUMMARY = "Perl scripting language" -HOMEPAGE = "http://www.perl.org/" -DESCRIPTION = "Perl is a highly capable, feature-rich programming language" -SECTION = "devel" -LICENSE = "Artistic-1.0 | GPL-1.0-or-later" -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 \ - file://perl-rdepends.txt \ - file://0001-Somehow-this-module-breaks-through-the-perl-wrapper-.patch \ - file://errno_ver.diff \ - file://native-perlinc.patch \ - file://perl-dynloader.patch \ - file://0002-Constant-Fix-up-shebang.patch \ - file://determinism.patch \ - file://0001-cpan-Sys-Syslog-Makefile.PL-Fix-_PATH_LOG-for-determ.patch \ - file://CVE-2023-31484.patch \ - file://CVE-2023-31486-0001.patch \ - file://CVE-2023-31486-0002.patch \ - " -SRC_URI:append:class-native = " \ - file://perl-configpm-switch.patch \ -" -SRC_URI:append:class-target = " \ - file://encodefix.patch \ -" - -SRC_URI[perl.sha256sum] = "68203665d8ece02988fc77dc92fccbb297a83a4bb4b8d07558442f978da54cc1" - -B = "${WORKDIR}/perl-${PV}-build" - -inherit upstream-version-is-even update-alternatives - -DEPENDS += "perlcross-native zlib virtual/crypt" -# make 4.1 has race issues with the double-colon usage of MakeMaker, see #14096 -DEPENDS += "make-native" - -PERL_LIB_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}.0" - -PACKAGECONFIG ??= "gdbm" -PACKAGECONFIG[bdb] = ",-Ui_db,db" -PACKAGECONFIG[gdbm] = ",-Ui_gdbm,gdbm" - -# Don't generate comments in enc2xs output files. They are not reproducible -export ENC2XS_NO_COMMENTS = "1" - -CFLAGS += "-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" - -do_configure:prepend() { - rm -rf ${B} - cp -rfp ${S} ${B} - cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${B} - cd ${B} -} - -do_configure:class-target() { - ./configure --prefix=${prefix} --libdir=${libdir} \ - --target=${TARGET_SYS} \ - -Duseshrplib \ - -Dusethreads \ - -Dsoname=libperl.so.5 \ - -Dvendorprefix=${prefix} \ - -Dvendorlibdir=${libdir} \ - -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \ - -Dlibpth='${libdir} ${base_libdir}' \ - -Dglibpth='${libdir} ${base_libdir}' \ - -Alddlflags=' ${LDFLAGS}' \ - -Dd_gnulibc=define \ - ${PACKAGECONFIG_CONFARGS} - - #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 \ - -Dusethreads \ - -Dsoname=libperl.so.5 \ - -Dvendorprefix=${prefix} \ - -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \ - -Alddlflags=' ${LDFLAGS}' \ - ${PACKAGECONFIG_CONFARGS} - - # 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 \ - -Dusethreads \ - -Dsoname=libperl.so.5 \ - -Dvendorprefix=${prefix} \ - -Ui_xlocale \ - -Alddlflags=' ${LDFLAGS}' \ - ${PACKAGECONFIG_CONFARGS} - - # This prevents leakage of build paths into perl-native binaries, which - # causes non-deterministic troubles when those paths no longer exist or aren't accessible. - sed -i -e "s,${STAGING_LIBDIR},/completelyboguspath,g" config.h -} - -do_configure:append() { - if [ -n "$SOURCE_DATE_EPOCH" ]; then - PERL_BUILD_DATE="$(${PYTHON} -c "\ -from datetime import datetime, timezone; \ -print(datetime.fromtimestamp($SOURCE_DATE_EPOCH, timezone.utc).strftime('%a %b %d %H:%M:%S %Y')) \ - ")" - echo "#define PERL_BUILD_DATE \"$PERL_BUILD_DATE\"" >> config.h - fi -} - -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 - dir=$(echo ${D}/${libdir}/perl5/${PV}/*/CORE) - rm $dir/libperl.so - ln -sf ../../../../libperl.so.${PERL_LIB_VER} $dir/libperl.so - - # Try to catch Bug #13946 - if [ -e ${D}/${libdir}/perl5/${PV}/Storable.pm ]; then - bbfatal 'non-arch specific Storable.pm found! See https://bugzilla.yoctoproject.org/show_bug.cgi?id=13946' - fi -} - -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 - - # This contains host-specific information used for building miniperl (a helper executable built with host compiler) - # and therefore isn't reproducible. I believe the file isn't actually needed on target. - rm ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/xconfig.h -} - -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:${SDKPATHNATIVE}/${libdir_nativesdk}/perl5/site_perl/${PV}:${SDKPATHNATIVE}/${libdir_nativesdk}/perl5/vendor_perl/${PV}:${SDKPATHNATIVE}/${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}' - - # 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.perl \ - ${PKGD}${bindir}/h2ph.perl \ - ${PKGD}${bindir}/pod2man.perl \ - ${PKGD}${bindir}/pod2text.perl \ - ${PKGD}${bindir}/pod2usage.perl \ - ${PKGD}${bindir}/podchecker.perl \ - ${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_git.pl \ - ${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 -} - -inherit update-alternatives - -ALTERNATIVE_PRIORITY = "100" - -ALTERNATIVE:${PN}-misc = "corelist cpan enc2xs encguess h2ph h2xs instmodsh json_pp libnetcfg \ - piconv pl2pm pod2html pod2man pod2text pod2usage podchecker \ - prove ptar ptardiff ptargrep shasum splain streamzip xsubpp zipdetails" -ALTERNATIVE_LINK_NAME[corelist] = "${bindir}/corelist" -ALTERNATIVE_LINK_NAME[cpan] = "${bindir}/cpan" -ALTERNATIVE_LINK_NAME[enc2xs] = "${bindir}/enc2xs" -ALTERNATIVE_LINK_NAME[encguess] = "${bindir}/encguess" -ALTERNATIVE_LINK_NAME[h2ph] = "${bindir}/h2ph" -ALTERNATIVE_LINK_NAME[h2xs] = "${bindir}/h2xs" -ALTERNATIVE_LINK_NAME[instmodsh] = "${bindir}/instmodsh" -ALTERNATIVE_LINK_NAME[json_pp] = "${bindir}/json_pp" -ALTERNATIVE_LINK_NAME[libnetcfg] = "${bindir}/libnetcfg" -ALTERNATIVE_LINK_NAME[piconv] = "${bindir}/piconv" -ALTERNATIVE_LINK_NAME[pl2pm] = "${bindir}/pl2pm" -ALTERNATIVE_LINK_NAME[pod2html] = "${bindir}/pod2html" -ALTERNATIVE_LINK_NAME[pod2man] = "${bindir}/pod2man" -ALTERNATIVE_LINK_NAME[pod2text] = "${bindir}/pod2text" -ALTERNATIVE_LINK_NAME[pod2usage] = "${bindir}/pod2usage" -ALTERNATIVE_LINK_NAME[podchecker] = "${bindir}/podchecker" -ALTERNATIVE_LINK_NAME[prove] = "${bindir}/prove" -ALTERNATIVE_LINK_NAME[ptar] = "${bindir}/ptar" -ALTERNATIVE_LINK_NAME[ptardiff] = "${bindir}/ptardiff" -ALTERNATIVE_LINK_NAME[ptargrep] = "${bindir}/ptargrep" -ALTERNATIVE_LINK_NAME[shasum] = "${bindir}/shasum" -ALTERNATIVE_LINK_NAME[splain] = "${bindir}/splain" -ALTERNATIVE_LINK_NAME[streamzip] = "${bindir}/streamzip" -ALTERNATIVE_LINK_NAME[xsubpp] = "${bindir}/xsubpp" -ALTERNATIVE_LINK_NAME[zipdetails] = "${bindir}/zipdetails" - -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}/${TARGET_ARCH}-linux/Config.pm \ - ${libdir}/perl5/${PV}/*/Config_git.pl \ - ${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 \ - ${libdir}/perl5/${PV}/ExtUtils/MANIFEST.SKIP \ - ${libdir}/perl5/${PV}/ExtUtils/xsubpp \ - ${libdir}/perl5/${PV}/ExtUtils/typemap \ - " -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}/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" - -ALTERNATIVE_PRIORITY = "40" -ALTERNATIVE:${PN}-doc = "Thread.3" -ALTERNATIVE_LINK_NAME[Thread.3] = "${mandir}/man3/Thread.3" - -# 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 =+ "split_perl_packages" - -python split_perl_packages () { - libdir = d.expand('${libdir}/perl5/${PV}') - do_split_packages(d, libdir, r'.*/auto/([^.]*)/[^/]*\.(so|ld|ix|al)', '${PN}-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False) - do_split_packages(d, libdir, r'.*linux/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) - do_split_packages(d, libdir, r'Module/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) - do_split_packages(d, libdir, r'Module/([^\/]*)/.*', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) - 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) - 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) - - # 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() - # Filter empty lines and comments - if len(splitline) == 0 or splitline[0].startswith("#"): - continue - if bb.data.inherits_class('native', d): - module = splitline[0] + '-native' - depends = "perl-native" - else: - module = splitline[0].replace("RDEPENDS:perl", "RDEPENDS:${PN}") - depends = splitline[2].strip('"').replace("perl-module", "${PN}-module") - d.appendVar(d.expand(module), " " + depends) -} - -python() { - if d.getVar('CLASSOVERRIDE') == "class-target": - d.setVar("PACKAGES_DYNAMIC", "^${MLPREFIX}perl-module-.*(? ${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-scalar-util += "${PN}-module-list-util" -RDEPENDS:${PN}-module-file-temp += "${PN}-module-scalar-util" -RDEPENDS:${PN}-module-file-temp += "${PN}-module-file-spec" -RDEPENDS:${PN}-module-io-file += "${PN}-module-symbol" -RDEPENDS:${PN}-module-io-file += "${PN}-module-carp" -RDEPENDS:${PN}-module-math-bigint += "${PN}-module-math-bigint-calc" -RDEPENDS:${PN}-module-test-builder += "${PN}-module-list-util" -RDEPENDS:${PN}-module-test-builder += "${PN}-module-scalar-util" -RDEPENDS:${PN}-module-test-builder-formatter += "${PN}-module-test2-formatter-tap" -RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-fail" -RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-pass" -RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-v2" -RDEPENDS:${PN}-module-test2-formatter-tap += "${PN}-module-test2-formatter" -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*(\ */+= \"perl-module-/g;s/CPANPLUS::.*/cpanplus/g;s/CPAN::.*/cpan/g;s/::/-/g;s/ [^+\"].*//g;s/_/-/g;s/\.pl\"$/\"/;s/\"\?\$/\"/;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-text-unidecode|module-unicore|module-win32|objects\sload|syscall.ph|systeminfo.ph|%s' | \ - egrep -wv '=>|module-algorithm-diff|module-carp|module-c|module-l|module-encode-hanextra|module-extutils-makemaker-version-regex|module-file-spec|module-io-compress-lzma|module-io-uncompress-unxz|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 - cat ${WORKDIR}/perl-rdepends.inc ${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 -} - -SSTATE_HASHEQUIV_FILEMAP = " \ - populate_sysroot:*/lib*/perl5/*/*/Config_heavy.pl:${TMPDIR} \ - populate_sysroot:*/lib*/perl5/*/*/Config_heavy.pl:${COREBASE} \ - populate_sysroot:*/lib*/perl5/config.sh:${TMPDIR} \ - populate_sysroot:*/lib*/perl5/config.sh:${COREBASE} \ - " diff --git a/meta/recipes-devtools/perl/perl_5.38.0.bb b/meta/recipes-devtools/perl/perl_5.38.0.bb new file mode 100644 index 0000000000..2103a39dfa --- /dev/null +++ b/meta/recipes-devtools/perl/perl_5.38.0.bb @@ -0,0 +1,419 @@ +SUMMARY = "Perl scripting language" +HOMEPAGE = "http://www.perl.org/" +DESCRIPTION = "Perl is a highly capable, feature-rich programming language" +SECTION = "devel" +LICENSE = "Artistic-1.0 | GPL-1.0-or-later" +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 \ + file://perl-rdepends.txt \ + file://0001-Somehow-this-module-breaks-through-the-perl-wrapper-.patch \ + file://errno_ver.diff \ + file://native-perlinc.patch \ + file://perl-dynloader.patch \ + file://0002-Constant-Fix-up-shebang.patch \ + file://determinism.patch \ + file://0001-cpan-Sys-Syslog-Makefile.PL-Fix-_PATH_LOG-for-determ.patch \ + " +SRC_URI:append:class-native = " \ + file://perl-configpm-switch.patch \ +" +SRC_URI:append:class-target = " \ + file://encodefix.patch \ +" + +SRC_URI[perl.sha256sum] = "213ef58089d2f2c972ea353517dc60ec3656f050dcc027666e118b508423e517" + +B = "${WORKDIR}/perl-${PV}-build" + +inherit upstream-version-is-even update-alternatives + +DEPENDS += "perlcross-native zlib virtual/crypt" +# make 4.1 has race issues with the double-colon usage of MakeMaker, see #14096 +DEPENDS += "make-native" + +PERL_LIB_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}.0" + +PACKAGECONFIG ??= "gdbm" +PACKAGECONFIG[bdb] = ",-Ui_db,db" +PACKAGECONFIG[gdbm] = ",-Ui_gdbm,gdbm" + +# Don't generate comments in enc2xs output files. They are not reproducible +export ENC2XS_NO_COMMENTS = "1" + +CFLAGS += "-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + +do_configure:prepend() { + rm -rf ${B} + cp -rfp ${S} ${B} + cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${B} + cd ${B} +} + +do_configure:class-target() { + ./configure --prefix=${prefix} --libdir=${libdir} \ + --target=${TARGET_SYS} \ + -Duseshrplib \ + -Dusethreads \ + -Dsoname=libperl.so.5 \ + -Dvendorprefix=${prefix} \ + -Dvendorlibdir=${libdir} \ + -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \ + -Dlibpth='${libdir} ${base_libdir}' \ + -Dglibpth='${libdir} ${base_libdir}' \ + -Alddlflags=' ${LDFLAGS}' \ + -Dd_gnulibc=define \ + ${PACKAGECONFIG_CONFARGS} + + #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 \ + -Dusethreads \ + -Dsoname=libperl.so.5 \ + -Dvendorprefix=${prefix} \ + -Darchlibexp=${STAGING_LIBDIR}/perl5/${PV}/${TARGET_ARCH}-linux \ + -Alddlflags=' ${LDFLAGS}' \ + ${PACKAGECONFIG_CONFARGS} + + # 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 \ + -Dusethreads \ + -Dsoname=libperl.so.5 \ + -Dvendorprefix=${prefix} \ + -Ui_xlocale \ + -Alddlflags=' ${LDFLAGS}' \ + ${PACKAGECONFIG_CONFARGS} + + # This prevents leakage of build paths into perl-native binaries, which + # causes non-deterministic troubles when those paths no longer exist or aren't accessible. + sed -i -e "s,${STAGING_LIBDIR},/completelyboguspath,g" config.h +} + +do_configure:append() { + if [ -n "$SOURCE_DATE_EPOCH" ]; then + PERL_BUILD_DATE="$(${PYTHON} -c "\ +from datetime import datetime, timezone; \ +print(datetime.fromtimestamp($SOURCE_DATE_EPOCH, timezone.utc).strftime('%a %b %d %H:%M:%S %Y')) \ + ")" + echo "#define PERL_BUILD_DATE \"$PERL_BUILD_DATE\"" >> config.h + fi +} + +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 + dir=$(echo ${D}/${libdir}/perl5/${PV}/*/CORE) + rm $dir/libperl.so + ln -sf ../../../../libperl.so.${PERL_LIB_VER} $dir/libperl.so + + # Try to catch Bug #13946 + if [ -e ${D}/${libdir}/perl5/${PV}/Storable.pm ]; then + bbfatal 'non-arch specific Storable.pm found! See https://bugzilla.yoctoproject.org/show_bug.cgi?id=13946' + fi +} + +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 + + # xconfig.h contains references to build host architecture, and yet is included from various other places. + # To make it reproducible let's make it a copy of config.h patch that is specific to the target architecture. + # It is believed that the original header is the product of building miniperl (a helper executable built with host compiler). + cp ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/config.h ${D}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/xconfig.h +} + +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:${SDKPATHNATIVE}/${libdir_nativesdk}/perl5/site_perl/${PV}:${SDKPATHNATIVE}/${libdir_nativesdk}/perl5/vendor_perl/${PV}:${SDKPATHNATIVE}/${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}' + + # 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.perl \ + ${PKGD}${bindir}/h2ph.perl \ + ${PKGD}${bindir}/pod2man.perl \ + ${PKGD}${bindir}/pod2text.perl \ + ${PKGD}${bindir}/pod2usage.perl \ + ${PKGD}${bindir}/podchecker.perl \ + ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/config.h \ + ${PKGD}${libdir}/perl5/${PV}/${TARGET_ARCH}-linux/CORE/xconfig.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_git.pl \ + ${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 +} + +inherit update-alternatives + +ALTERNATIVE_PRIORITY = "100" + +ALTERNATIVE:${PN}-misc = "corelist cpan enc2xs encguess h2ph h2xs instmodsh json_pp libnetcfg \ + piconv pl2pm pod2html pod2man pod2text pod2usage podchecker \ + prove ptar ptardiff ptargrep shasum splain streamzip xsubpp zipdetails" +ALTERNATIVE_LINK_NAME[corelist] = "${bindir}/corelist" +ALTERNATIVE_LINK_NAME[cpan] = "${bindir}/cpan" +ALTERNATIVE_LINK_NAME[enc2xs] = "${bindir}/enc2xs" +ALTERNATIVE_LINK_NAME[encguess] = "${bindir}/encguess" +ALTERNATIVE_LINK_NAME[h2ph] = "${bindir}/h2ph" +ALTERNATIVE_LINK_NAME[h2xs] = "${bindir}/h2xs" +ALTERNATIVE_LINK_NAME[instmodsh] = "${bindir}/instmodsh" +ALTERNATIVE_LINK_NAME[json_pp] = "${bindir}/json_pp" +ALTERNATIVE_LINK_NAME[libnetcfg] = "${bindir}/libnetcfg" +ALTERNATIVE_LINK_NAME[piconv] = "${bindir}/piconv" +ALTERNATIVE_LINK_NAME[pl2pm] = "${bindir}/pl2pm" +ALTERNATIVE_LINK_NAME[pod2html] = "${bindir}/pod2html" +ALTERNATIVE_LINK_NAME[pod2man] = "${bindir}/pod2man" +ALTERNATIVE_LINK_NAME[pod2text] = "${bindir}/pod2text" +ALTERNATIVE_LINK_NAME[pod2usage] = "${bindir}/pod2usage" +ALTERNATIVE_LINK_NAME[podchecker] = "${bindir}/podchecker" +ALTERNATIVE_LINK_NAME[prove] = "${bindir}/prove" +ALTERNATIVE_LINK_NAME[ptar] = "${bindir}/ptar" +ALTERNATIVE_LINK_NAME[ptardiff] = "${bindir}/ptardiff" +ALTERNATIVE_LINK_NAME[ptargrep] = "${bindir}/ptargrep" +ALTERNATIVE_LINK_NAME[shasum] = "${bindir}/shasum" +ALTERNATIVE_LINK_NAME[splain] = "${bindir}/splain" +ALTERNATIVE_LINK_NAME[streamzip] = "${bindir}/streamzip" +ALTERNATIVE_LINK_NAME[xsubpp] = "${bindir}/xsubpp" +ALTERNATIVE_LINK_NAME[zipdetails] = "${bindir}/zipdetails" + +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}/${TARGET_ARCH}-linux/Config.pm \ + ${libdir}/perl5/${PV}/*/Config_git.pl \ + ${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 \ + ${libdir}/perl5/${PV}/ExtUtils/MANIFEST.SKIP \ + ${libdir}/perl5/${PV}/ExtUtils/xsubpp \ + ${libdir}/perl5/${PV}/ExtUtils/typemap \ + " +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}/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" + +ALTERNATIVE_PRIORITY = "40" +ALTERNATIVE:${PN}-doc = "Thread.3" +ALTERNATIVE_LINK_NAME[Thread.3] = "${mandir}/man3/Thread.3" + +# 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 =+ "split_perl_packages" + +python split_perl_packages () { + libdir = d.expand('${libdir}/perl5/${PV}') + do_split_packages(d, libdir, r'.*/auto/([^.]*)/[^/]*\.(so|ld|ix|al)', '${PN}-module-%s', 'perl module %s', recursive=True, match_path=True, prepend=False) + do_split_packages(d, libdir, r'.*linux/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) + do_split_packages(d, libdir, r'Module/([^\/]*)\.pm', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) + do_split_packages(d, libdir, r'Module/([^\/]*)/.*', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False) + 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) + 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) + + # 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() + # Filter empty lines and comments + if len(splitline) == 0 or splitline[0].startswith("#"): + continue + if bb.data.inherits_class('native', d): + module = splitline[0] + '-native' + depends = "perl-native" + else: + module = splitline[0].replace("RDEPENDS:perl", "RDEPENDS:${PN}") + depends = splitline[2].strip('"').replace("perl-module", "${PN}-module") + d.appendVar(d.expand(module), " " + depends) +} + +python() { + if d.getVar('CLASSOVERRIDE') == "class-target": + d.setVar("PACKAGES_DYNAMIC", "^${MLPREFIX}perl-module-.*(? ${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-scalar-util += "${PN}-module-list-util" +RDEPENDS:${PN}-module-file-temp += "${PN}-module-scalar-util" +RDEPENDS:${PN}-module-file-temp += "${PN}-module-file-spec" +RDEPENDS:${PN}-module-io-file += "${PN}-module-symbol" +RDEPENDS:${PN}-module-io-file += "${PN}-module-carp" +RDEPENDS:${PN}-module-math-bigint += "${PN}-module-math-bigint-calc" +RDEPENDS:${PN}-module-test-builder += "${PN}-module-list-util" +RDEPENDS:${PN}-module-test-builder += "${PN}-module-scalar-util" +RDEPENDS:${PN}-module-test-builder-formatter += "${PN}-module-test2-formatter-tap" +RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-fail" +RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-pass" +RDEPENDS:${PN}-module-test2-api += "${PN}-module-test2-event-v2" +RDEPENDS:${PN}-module-test2-formatter-tap += "${PN}-module-test2-formatter" +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*(\ */+= \"perl-module-/g;s/CPANPLUS::.*/cpanplus/g;s/CPAN::.*/cpan/g;s/::/-/g;s/ [^+\"].*//g;s/_/-/g;s/\.pl\"$/\"/;s/\"\?\$/\"/;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-text-unidecode|module-unicore|module-win32|objects\sload|syscall.ph|systeminfo.ph|%s' | \ + egrep -wv '=>|module-algorithm-diff|module-carp|module-c|module-l|module-encode-hanextra|module-extutils-makemaker-version-regex|module-file-spec|module-io-compress-lzma|module-io-uncompress-unxz|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 + cat ${WORKDIR}/perl-rdepends.inc ${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 +} + +SSTATE_HASHEQUIV_FILEMAP = " \ + populate_sysroot:*/lib*/perl5/*/*/Config_heavy.pl:${TMPDIR} \ + populate_sysroot:*/lib*/perl5/*/*/Config_heavy.pl:${COREBASE} \ + populate_sysroot:*/lib*/perl5/config.sh:${TMPDIR} \ + populate_sysroot:*/lib*/perl5/config.sh:${COREBASE} \ + " -- cgit v1.2.3-54-g00ecf