dev-lang/perl: Sync with Gentoo

It's from Gentoo commit 2d25fad95cbaa525c8945d8e582c749d49524f49.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-01-12 07:11:15 +00:00 committed by Krzesimir Nowak
parent b20331e801
commit a73990b8da
11 changed files with 1141 additions and 195 deletions

View File

@ -6,4 +6,5 @@ DIST perl-5.42.0-patches-1.tar.xz 17108 BLAKE2B 0ac95f8c2665a087215dc896c3e00ccf
DIST perl-5.42.0.tar.xz 14400988 BLAKE2B 51c31bfd924e6fb4fca5e149986575cb9b455a40ae2a3e03935423612b34491c8382866ca2f3b1ea9cb6ed415f0c570c817612265335bff2603be721c145da61 SHA512 b10f74d1245a879ae51d3ad93ad519a148df126ec865715474c801548ccfc3f542ef3bbb1f59568cea2ec77302d428dc772aba605357d7faf13eb6a351917275
DIST perl-cross-1.6.1.tar.gz 124122 BLAKE2B b1b78b30f2cf8c5ba12e3df6177b7d102033c8eaceeea9f12a1aeb2bfdf97edda83842e32de797b7ffa3ef6bc66dfba6ccbbacc25367b6f7bc2d137ce58aca93 SHA512 35a4f7966f1f94ef0b6bfe7a82e8a50e0daf6e5e0c1ed99c7c4767aa4f0708db05e8cc01a883257f970703991f617a189609cd57eec63767e2e73de3d6155bdf
DIST perl-cross-1.6.2.tar.gz 123761 BLAKE2B c3c51d5a86940914c3a037d1cace49c6def531cdc380771f968461a3552c0200c8a802f4ff74ddb5fcd494ab1e1b582a4c1c5214be4faae8712fc506b19ca04f SHA512 51b45bf972304634d706d09e27d457636e43f9f27f739004eca529b21245ba78612dcb08b54225fc7ca19511983642c37915939ea8aa1c1a4560093474d9e76b
DIST perl-cross-1.6.3.tar.gz 121133 BLAKE2B 2362a53928230e13c607dd481e5614f80b210f7a5127cac05baa3daf69a263410d05eb50855f063b1bd7d4e3693d01369fdb512fb713c854beda2eece71844d1 SHA512 eb8aa2d57121ef288e253f9443bd4f53ad8b23152096265a0f8211ca4f2a61fdf3fdd03ca1e7d1e1c4a8a408421c7254cfaf12d1f81333aa4a0bf53d74cfa223
DIST perl-cross-1.6.tar.gz 121973 BLAKE2B b3a17d92dd7621a3bc253a6c4e56eccd3adec2c2b52e606c956a08f48d786a16a3ac5beb056a732ba3df92227f210193b0f516fd9d73cac362a04ec52efab029 SHA512 980af804513ec126e40eb9d8200ca54ba805bbb13b38d20a45daaf8d98d6b257e2eebc1ecad56cd47f60e235fa1141f6df9518d748db4f18d5219180750ca615

View File

@ -0,0 +1,83 @@
From 7dbc795b44eb54d41e1c6b30d8796525d65d52b5 Mon Sep 17 00:00:00 2001
Message-ID: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
From: Lukas Mai <lukasmai.403@gmail.com>
Date: Fri, 11 Jul 2025 09:07:00 +0200
Subject: [PATCH 1/4] newFOROP: fix crash when optimizing 2-var for over
builtin::indexed
OP_ENTERSUB isn't necessarily a LISTOP, apparently, so we can't just
grab its op_last. Instead, copy/paste logic from elsewhere in op.c to
find the cvop.
Also, avoid crashing on "fake" pad entries that represent lexical subs
from outer scopes by climbing up the scope chain until we reach a real
pad entry.
Fixes #23405.
(cherry picked from commit 96673a4bb36a973a9a4c5cd0e5727a799789a32c)
Signed-off-by: Sam James <sam@gentoo.org>
---
op.c | 14 +++++++++++---
t/op/for-many.t | 13 +++++++++++++
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/op.c b/op.c
index f616532c49..3c316ea8b4 100644
--- a/op.c
+++ b/op.c
@@ -9665,7 +9665,7 @@ S_op_is_cv_xsub(pTHX_ OP *o, XSUBADDR_t xsub)
}
case OP_PADCV:
- cv = (CV *)PAD_SVl(o->op_targ);
+ cv = find_lexical_cv(o->op_targ);
assert(cv && SvTYPE(cv) == SVt_PVCV);
break;
@@ -9683,10 +9683,18 @@ S_op_is_cv_xsub(pTHX_ OP *o, XSUBADDR_t xsub)
static bool
S_op_is_call_to_cv_xsub(pTHX_ OP *o, XSUBADDR_t xsub)
{
- if(o->op_type != OP_ENTERSUB)
+ if (o->op_type != OP_ENTERSUB)
return false;
- OP *cvop = cLISTOPx(cUNOPo->op_first)->op_last;
+ /* entersub may be a UNOP, not a LISTOP, so we can't just use op_last */
+ OP *aop = cUNOPo->op_first;
+ if (!OpHAS_SIBLING(aop)) {
+ aop = cUNOPx(aop)->op_first;
+ }
+ aop = OpSIBLING(aop);
+ OP *cvop;
+ for (cvop = aop; OpHAS_SIBLING(cvop); cvop = OpSIBLING(cvop)) ;
+
return op_is_cv_xsub(cvop, xsub);
}
diff --git a/t/op/for-many.t b/t/op/for-many.t
index 2f6790aee7..035d1da07e 100644
--- a/t/op/for-many.t
+++ b/t/op/for-many.t
@@ -498,4 +498,17 @@ is($continue, 'xx', 'continue reached twice');
is("@have", "Pointy end Up Flamey end Down", 'for my ($one, $two)');
}
+# GH #23405 - segfaults when compiling 2-var for loops
+{
+ my $dummy = sub {};
+ for my ($x, $y) (main->$dummy) {}
+ pass '2-var for does not crash on method calls';
+
+ my sub dummy {}
+ sub {
+ for my ($x, $y) (dummy) {}
+ }->();
+ pass '2-var for does not crash on lexical sub calls';
+}
+
done_testing();
--
2.52.0

View File

@ -0,0 +1,87 @@
From 7ec9aea1c525aee1e1a638f943c4374945ea5b17 Mon Sep 17 00:00:00 2001
Message-ID: <7ec9aea1c525aee1e1a638f943c4374945ea5b17.1763833678.git.sam@gentoo.org>
In-Reply-To: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
References: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
From: Lukas Mai <lukasmai.403@gmail.com>
Date: Wed, 30 Jul 2025 23:09:54 +0200
Subject: [PATCH 2/4] class.c: gracefully handle reader/writer after 'strict'
error
Fixes #23511.
(cherry picked from commit 4e22a3d0e5f933b38e3fa1b98c904fe224001b63)
---
MANIFEST | 1 +
class.c | 6 ++++--
t/class/gh23511.t | 23 +++++++++++++++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)
create mode 100644 t/class/gh23511.t
diff --git a/MANIFEST b/MANIFEST
index f530320dcc..d8c7b04816 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5997,6 +5997,7 @@ t/class/construct.t See if class constructors work
t/class/destruct.t See if class destruction works
t/class/field.t See if class field declarations work
t/class/gh22169.t Test defining a class that previously failed to define
+t/class/gh23511.t Test defining a reader after a strict 'vars' violation
t/class/inherit.t See if class inheritance works
t/class/method.t See if class method declarations work
t/class/phasers.t See if class phaser blocks work
diff --git a/class.c b/class.c
index d6d801928d..a91656d469 100644
--- a/class.c
+++ b/class.c
@@ -1140,7 +1140,8 @@ apply_field_attribute_reader(pTHX_ PADNAME *pn, SV *value)
OP *nameop = newSVOP(OP_CONST, 0, value);
CV *cv = newATTRSUB(floor_ix, nameop, NULL, NULL, ops);
- CvIsMETHOD_on(cv);
+ if (cv)
+ CvIsMETHOD_on(cv);
}
/* If '@_' is called "snail", then elements of it can be called "slugs"; i.e.
@@ -1238,7 +1239,8 @@ apply_field_attribute_writer(pTHX_ PADNAME *pn, SV *value)
OP *nameop = newSVOP(OP_CONST, 0, value);
CV *cv = newATTRSUB(floor_ix, nameop, NULL, NULL, ops);
- CvIsMETHOD_on(cv);
+ if (cv)
+ CvIsMETHOD_on(cv);
}
static struct {
diff --git a/t/class/gh23511.t b/t/class/gh23511.t
new file mode 100644
index 0000000000..ae66269003
--- /dev/null
+++ b/t/class/gh23511.t
@@ -0,0 +1,23 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ require './test.pl';
+ set_up_inc('../lib');
+}
+
+use v5.36;
+use feature 'class';
+no warnings 'experimental::class';
+
+# this used to segfault: GH #23511
+eval <<'CLASS';
+class MyTest {
+ $id = 6;
+ field $f1 :reader;
+ field $f2 :writer;
+}
+CLASS
+like $@, qr/^Global symbol "\$id" requires explicit package name /, "we get the expected 'undeclared variable' error";
+
+done_testing;
--
2.52.0

View File

@ -0,0 +1,52 @@
From 0e0b91d4881226a5532f166662a27ba58f4f718b Mon Sep 17 00:00:00 2001
Message-ID: <0e0b91d4881226a5532f166662a27ba58f4f718b.1763833678.git.sam@gentoo.org>
In-Reply-To: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
References: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
From: Yitzchak Scott-Thoennes <sthoenna@gmail.com>
Date: Fri, 31 Oct 2025 05:05:33 -0600
Subject: [PATCH 3/4] 'use 5.41' affects current line source::encoding
Previously it didn't take effect until subsequent lines
Fixes #23881
(cherry picked from commit 5d62050d173f59a343236c6259b5c821d58268d2)
---
lib/source/source_encoding.t | 7 ++++++-
op.c | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/source/source_encoding.t b/lib/source/source_encoding.t
index a08489637e..a11b1ca45b 100644
--- a/lib/source/source_encoding.t
+++ b/lib/source/source_encoding.t
@@ -44,8 +44,13 @@ if (fresh_perl_like(<<~'EOT',
EOT
"",
{ }, "source encoding can be turned off");
+ fresh_perl_like(<<~'EOT',
+ use v5.41.0; my $var = "¶";
+ EOT
+ qr/Use of non-ASCII character 0x[[:xdigit:]]{2} illegal/,
+ { }, ">= 'use statement affects rest of current line'");
}
-else { # Above test depends on the previous one; if that failed, use this
+else { # Above tests depend on the previous one; if that failed, use this
# alternate one
fresh_perl_is(<<~'EOT',
use source::encoding 'ascii';
diff --git a/op.c b/op.c
index 3c316ea8b4..f51eeb3945 100644
--- a/op.c
+++ b/op.c
@@ -8341,6 +8341,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
else {
PL_hints &= ~HINT_ASCII_ENCODING;
}
+ notify_parser_that_encoding_changed();
PL_prevailing_version = shortver;
}
--
2.52.0

View File

@ -0,0 +1,33 @@
From 8c90537ed9c2dcac79bac7b3f9b457f1ad3abfa3 Mon Sep 17 00:00:00 2001
Message-ID: <8c90537ed9c2dcac79bac7b3f9b457f1ad3abfa3.1763833678.git.sam@gentoo.org>
In-Reply-To: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
References: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
From: Karl Williamson <khw@cpan.org>
Date: Thu, 9 Oct 2025 17:27:31 -0600
Subject: [PATCH 4/4] Turn off POSIX 2008 locales on AIX
Fixes #23825
From the discussion in that ticket, it appears that the problem is the
OS.
(cherry picked from commit 1f9d9f8d5ef1241dab5c762f1d6569567377cf87)
---
hints/aix.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hints/aix.sh b/hints/aix.sh
index 279365c85b..3e54e450fb 100644
--- a/hints/aix.sh
+++ b/hints/aix.sh
@@ -700,4 +700,7 @@ case "$osvers" in
;;
esac
+# GH #23825
+d_duplocale='undef'
+
# EOF
--
2.52.0

View File

@ -1,191 +0,0 @@
https://github.com/arsv/perl-cross/pull/165
From add39339ed09334e6809b48b3f8474c01a7ea1a1 Mon Sep 17 00:00:00 2001
From: Pavlo Kleymonov <pkleymonov@blackberry.com>
Date: Fri, 5 Sep 2025 17:03:23 +0200
Subject: [PATCH] patches for perl-5.42.0
---
cnf/configure_func.sh | 1 +
cnf/diffs/perl5-5.42.0/constant.patch | 1 +
cnf/diffs/perl5-5.42.0/dynaloader.patch | 1 +
cnf/diffs/perl5-5.42.0/findext.patch | 1 +
cnf/diffs/perl5-5.42.0/installscripts.patch | 1 +
cnf/diffs/perl5-5.42.0/liblist.patch | 70 +++++++++++++++++++++
cnf/diffs/perl5-5.42.0/makemaker.patch | 1 +
cnf/diffs/perl5-5.42.0/posix-makefile.patch | 1 +
cnf/diffs/perl5-5.42.0/test-checkcase.patch | 1 +
cnf/diffs/perl5-5.42.0/test-makemaker.patch | 1 +
cnf/diffs/perl5-5.42.0/xconfig.patch | 1 +
11 files changed, 80 insertions(+)
create mode 120000 cnf/diffs/perl5-5.42.0/constant.patch
create mode 120000 cnf/diffs/perl5-5.42.0/dynaloader.patch
create mode 120000 cnf/diffs/perl5-5.42.0/findext.patch
create mode 120000 cnf/diffs/perl5-5.42.0/installscripts.patch
create mode 100644 cnf/diffs/perl5-5.42.0/liblist.patch
create mode 120000 cnf/diffs/perl5-5.42.0/makemaker.patch
create mode 120000 cnf/diffs/perl5-5.42.0/posix-makefile.patch
create mode 120000 cnf/diffs/perl5-5.42.0/test-checkcase.patch
create mode 120000 cnf/diffs/perl5-5.42.0/test-makemaker.patch
create mode 120000 cnf/diffs/perl5-5.42.0/xconfig.patch
diff --git a/cnf/configure_func.sh b/cnf/configure_func.sh
index 4c13e4c..20f9cdf 100644
--- a/cnf/configure_func.sh
+++ b/cnf/configure_func.sh
@@ -82,6 +82,7 @@ checkfunc d_fchmod 'fchmod' "0,0" 'unistd.h sys/stat.h'
checkfunc d_fchmodat 'fchmodat' "0,NULL,0,0" 'unistd.h sys/stat.h'
checkfunc d_fchown 'fchown' "0,0,0" 'unistd.h'
checkfunc d_fcntl 'fcntl' "0,0" 'unistd.h fcntl.h'
+checkfunc d_fdopendir 'fdopendir' "0" 'dirent.h sys/types.h'
checkfunc d_fdclose 'fdclose' "NULL,NULL" 'stdio.h'
checkfunc d_ffs 'ffs' "0" 'strings.h'
checkfunc d_ffsl 'ffsl' "0" 'strings.h'
diff --git a/cnf/diffs/perl5-5.42.0/constant.patch b/cnf/diffs/perl5-5.42.0/constant.patch
new file mode 120000
index 0000000..065e198
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/constant.patch
@@ -0,0 +1 @@
+../perl5-5.22.3/constant.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/dynaloader.patch b/cnf/diffs/perl5-5.42.0/dynaloader.patch
new file mode 120000
index 0000000..ffb73eb
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/dynaloader.patch
@@ -0,0 +1 @@
+../perl5-5.22.3/dynaloader.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/findext.patch b/cnf/diffs/perl5-5.42.0/findext.patch
new file mode 120000
index 0000000..9efbe5b
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/findext.patch
@@ -0,0 +1 @@
+../perl5-5.22.3/findext.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/installscripts.patch b/cnf/diffs/perl5-5.42.0/installscripts.patch
new file mode 120000
index 0000000..1c05e0f
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/installscripts.patch
@@ -0,0 +1 @@
+../perl5-5.36.0/installscripts.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/liblist.patch b/cnf/diffs/perl5-5.42.0/liblist.patch
new file mode 100644
index 0000000..1dae0bb
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/liblist.patch
@@ -0,0 +1,70 @@
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+index fbdc79aea2..976fd268aa 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+@@ -20,9 +20,10 @@ use File::Basename;
+ use File::Spec;
+
+ sub ext {
+- if ( $^O eq 'VMS' ) { goto &_vms_ext; }
+- elsif ( $^O eq 'MSWin32' ) { goto &_win32_ext; }
+- else { goto &_unix_os2_ext; }
++ if ( $Config{usemmldlt} ){ goto &_ld_ext; }
++ elsif ( $^O eq 'VMS' ) { goto &_vms_ext; }
++ elsif ( $^O eq 'MSWin32' ) { goto &_win32_ext; }
++ else { goto &_unix_os2_ext; }
+ }
+
+ sub _space_dirs_split {
+@@ -643,4 +644,51 @@ sub _vms_ext {
+ wantarray ? ( $lib, '', $ldlib, '', ( $give_libs ? \@flibs : () ) ) : $lib;
+ }
+
++# A direct test for -l validity.
++# Because guessing real file names for -llib options when dealing
++# with a cross compiler is generally a BAD IDEA^tm.
++sub _ld_ext {
++ my($self,$potential_libs, $verbose, $give_libs) = @_;
++ $verbose ||= 0;
++
++ if ($^O =~ 'os2' and $Config{perllibs}) {
++ # Dynamic libraries are not transitive, so we may need including
++ # the libraries linked against perl.dll again.
++
++ $potential_libs .= " " if $potential_libs;
++ $potential_libs .= $Config{perllibs};
++ }
++ return ("", "", "", "", ($give_libs ? [] : ())) unless $potential_libs;
++ warn "Potential libraries are '$potential_libs':\n" if $verbose;
++
++ my($ld) = $Config{ld};
++ my($ldflags) = $Config{ldflags};
++ my($libs) = defined $Config{perllibs} ? $Config{perllibs} : $Config{libs};
++
++ my $try = 'try_mm.c';
++ my $tryx = 'try_mm.x';
++ open(TRY, '>', $try) || die "Can't create MakeMaker test file $try: $!\n";
++ print TRY "int main(void) { return 0; }\n";
++ close(TRY);
++
++ my $testlibs = '';
++ my @testlibs = ();
++ foreach my $thislib (split ' ', $potential_libs) {
++ $testlibs = join(' ', @testlibs);
++ if($thislib =~ /^-L/) {
++ push(@testlibs, $thislib);
++ next
++ };
++ my $cmd = "$ld $ldflags -o $tryx $try $testlibs $thislib >/dev/null 2>&1";
++ my $ret = system($cmd);
++ warn "Warning (mostly harmless): " . "No library found for $thislib\n" if $ret;
++ next if $ret;
++ push @testlibs, $thislib;
++ }
++ unlink($try);
++ unlink($tryx);
++
++ return (join(' ', @testlibs), '', join(' ', @testlibs), '');
++}
++
+ 1;
diff --git a/cnf/diffs/perl5-5.42.0/makemaker.patch b/cnf/diffs/perl5-5.42.0/makemaker.patch
new file mode 120000
index 0000000..d7bd609
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/makemaker.patch
@@ -0,0 +1 @@
+../perl5-5.38.0/makemaker.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/posix-makefile.patch b/cnf/diffs/perl5-5.42.0/posix-makefile.patch
new file mode 120000
index 0000000..29463b7
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/posix-makefile.patch
@@ -0,0 +1 @@
+../perl5-5.22.3/posix-makefile.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/test-checkcase.patch b/cnf/diffs/perl5-5.42.0/test-checkcase.patch
new file mode 120000
index 0000000..36c5186
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/test-checkcase.patch
@@ -0,0 +1 @@
+../perl5-5.22.3/test-checkcase.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/test-makemaker.patch b/cnf/diffs/perl5-5.42.0/test-makemaker.patch
new file mode 120000
index 0000000..4e970ff
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/test-makemaker.patch
@@ -0,0 +1 @@
+../perl5-5.34.0/test-makemaker.patch
\ No newline at end of file
diff --git a/cnf/diffs/perl5-5.42.0/xconfig.patch b/cnf/diffs/perl5-5.42.0/xconfig.patch
new file mode 120000
index 0000000..1c22c96
--- /dev/null
+++ b/cnf/diffs/perl5-5.42.0/xconfig.patch
@@ -0,0 +1 @@
+../perl5-5.41.3/xconfig.patch
\ No newline at end of file

View File

@ -55,7 +55,7 @@ LICENSE="|| ( Artistic GPL-1+ )"
SLOT="0/${SUBSLOT}"
if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos ~x64-solaris"
fi
IUSE="berkdb perl_features_debug doc gdbm perl_features_ithreads minimal perl_features_quadmath"

View File

@ -55,7 +55,7 @@ LICENSE="|| ( Artistic GPL-1+ )"
SLOT="0/${SUBSLOT}"
if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris"
fi
IUSE="berkdb perl_features_debug doc gdbm perl_features_ithreads minimal perl_features_quadmath"

View File

@ -55,7 +55,7 @@ LICENSE="|| ( Artistic GPL-1+ )"
SLOT="0/${SUBSLOT}"
if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos ~x64-solaris"
fi
IUSE="berkdb perl_features_debug doc gdbm perl_features_ithreads minimal perl_features_quadmath"

View File

@ -0,0 +1,881 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit alternatives flag-o-matic toolchain-funcs multilib multiprocessing
PATCH_VER=1
CROSS_VER=1.6.3
PATCH_BASE="perl-5.42.0-patches-${PATCH_VER}"
PATCH_DEV=dilfridge
DIST_AUTHOR=BOOK
# Greatest first, don't include yourself
# Devel point-releases are not ABI-intercompatible, but stable point releases are
# BIN_OLDVERSEN contains only C-ABI-intercompatible versions
PERL_BIN_OLDVERSEN=""
if [[ "${PV##*.}" == "9999" ]]; then
DIST_VERSION=5.42.0
else
DIST_VERSION="${PV/_rc/-RC}"
fi
SHORT_PV="${DIST_VERSION%.*}"
# Even numbered major versions are ABI intercompatible
# Odd numbered major versions are not
if [[ $(( ${SHORT_PV#*.} % 2 )) == 1 ]]; then
SUBSLOT="${DIST_VERSION%-RC*}"
else
SUBSLOT="${DIST_VERSION%.*}"
fi
# Used only in tar paths
MY_P="perl-${DIST_VERSION}"
# Used in library paths
MY_PV="${DIST_VERSION%-RC*}"
DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
HOMEPAGE="https://www.perl.org/"
SRC_URI="
mirror://cpan/src/5.0/${MY_P}.tar.xz
mirror://cpan/authors/id/${DIST_AUTHOR:0:1}/${DIST_AUTHOR:0:2}/${DIST_AUTHOR}/${MY_P}.tar.xz
https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${PATCH_BASE}.tar.xz
https://github.com/arsv/perl-cross/releases/download/${CROSS_VER}/perl-cross-${CROSS_VER}.tar.gz
"
S="${WORKDIR}/${MY_P}"
LICENSE="|| ( Artistic GPL-1+ )"
SLOT="0/${SUBSLOT}"
if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos ~x64-solaris"
fi
IUSE="berkdb perl_features_debug doc gdbm perl_features_ithreads minimal perl_features_quadmath"
RDEPEND="
berkdb? ( sys-libs/db:= )
gdbm? ( >=sys-libs/gdbm-1.8.3:= )
app-arch/bzip2
>=virtual/zlib-1.2.12:=
virtual/libcrypt:=
"
DEPEND="${RDEPEND}"
BDEPEND="${RDEPEND}"
PDEPEND="
!minimal? (
>=app-admin/perl-cleaner-2.31
>=virtual/perl-CPAN-2.290.0
>=virtual/perl-Encode-3.120.0
>=virtual/perl-File-Temp-0.230.400-r2
>=virtual/perl-Data-Dumper-2.154.0
>=virtual/perl-Math-BigInt-1.999.842
virtual/perl-Test-Harness
)
"
# bug 390719, bug 523624
# virtual/perl-Test-Harness is here for the bundled ExtUtils::MakeMaker
dual_scripts() {
src_remove_dual perl-core/Archive-Tar 3.40.0 ptar ptardiff ptargrep
src_remove_dual perl-core/CPAN 2.380.0 cpan
src_remove_dual perl-core/Digest-SHA 6.40.0 shasum
src_remove_dual perl-core/Encode 3.210.0 enc2xs piconv
src_remove_dual perl-core/ExtUtils-MakeMaker 7.760.0 instmodsh
src_remove_dual perl-core/ExtUtils-ParseXS 3.570.0 xsubpp
src_remove_dual perl-core/IO-Compress 2.213.0 zipdetails
src_remove_dual perl-core/JSON-PP 4.160.0 json_pp
src_remove_dual perl-core/Module-CoreList 5.202.507.20 corelist
src_remove_dual perl-core/Pod-Checker 1.770.0 podchecker
src_remove_dual perl-core/Pod-Perldoc 3.280.100 perldoc
src_remove_dual perl-core/Pod-Usage 2.50.0 pod2usage
src_remove_dual perl-core/Test-Harness 3.500.0 prove
src_remove_dual perl-core/podlators 6.0.2 pod2man pod2text
src_remove_dual_man perl-core/podlators 6.0.2 /usr/share/man/man1/perlpodstyle.1
}
check_rebuild() {
# Fresh install
if [[ -z ${REPLACING_VERSIONS} ]]; then
return 0
fi
# Major Upgrade
local v
for v in ${REPLACING_VERSIONS}; do
[[ ${v%.*} == "${SHORT_PV}" ]] && continue
echo ""
ewarn "UPDATE THE PERL MODULES:"
ewarn "After updating dev-lang/perl to a new major version the installed Perl modules"
ewarn "have to be re-installed. In most cases, this is done automatically"
ewarn "by the package manager."
ewarn
ewarn "ONLY if you encounter problems, call perl-cleaner to clean up any old files"
ewarn "and trigger any remaining rebuilds portage may have missed."
ewarn "Use: perl-cleaner --all"
return 0
done
# Reinstall w/ USE Change
if
( use perl_features_ithreads && ( has_version '<dev-lang/perl-5.38.2-r3[-ithreads]' || has_version '>=dev-lang/perl-5.38.2-r3[-perl_features_ithreads]' ) ) || \
( ! use perl_features_ithreads && ( has_version '<dev-lang/perl-5.38.2-r3[ithreads]' || has_version '>=dev-lang/perl-5.38.2-r3[perl_features_ithreads]' ) ) || \
( use perl_features_quadmath && ( has_version '<dev-lang/perl-5.38.2-r3[-quadmath]' || has_version '>=dev-lang/perl-5.38.2-r3[-perl_features_quadmath]' ) ) || \
( ! use perl_features_quadmath && ( has_version '<dev-lang/perl-5.38.2-r3[quadmath]' || has_version '>=dev-lang/perl-5.38.2-r3[perl_features_quadmath]' ) ) || \
( use perl_features_debug && ( has_version '<dev-lang/perl-5.38.2-r3[-debug]' || has_version '>=dev-lang/perl-5.38.2-r3[-perl_features_debug]' ) ) || \
( ! use perl_features_debug && ( has_version '<dev-lang/perl-5.38.2-r3[debug]' || has_version '>=dev-lang/perl-5.38.2-r3[perl_features_debug]' ) ) ; then
echo ""
ewarn "TOGGLED PERL FEATURES WARNING:"
ewarn "You changed one of the PERL_FEATURES flags ithreads, quadmath, or debug."
ewarn "You must rebuild all perl-modules installed. Mostly this should be done automatically"
ewarn "via the flag changes of the packages. If the rebuild fails, use perl-cleaner."
ewarn "Use: perl-cleaner --modules ; perl-cleaner --force --libperl"
ewarn
ewarn "NOTE: Previous to perl-5.38.2-r3, these flags were useflags for dev-lang/perl."
ewarn "If you just upgraded and do not intend to change anything, carry the same settings over"
ewarn "into a global PERL_FEATURES variable set in make.conf. E.g., "
ewarn "dev-lang/perl[ithreads,quadmath] becomes PERL_FEATURES=\"ithreads quadmath\""
fi
}
pkg_pretend() {
if \
( use perl_features_ithreads && has_version '<dev-lang/perl-5.38.2-r3[-ithreads]' ) || \
( ! use perl_features_ithreads && has_version '<dev-lang/perl-5.38.2-r3[ithreads]' ) || \
( use perl_features_quadmath && has_version '<dev-lang/perl-5.38.2-r3[-quadmath]' ) || \
( ! use perl_features_quadmath && has_version '<dev-lang/perl-5.38.2-r3[quadmath]' ) || \
( use perl_features_debug && has_version '<dev-lang/perl-5.38.2-r3[-debug]' ) || \
( ! use perl_features_debug && has_version '<dev-lang/perl-5.38.2-r3[debug]' ) ; \
then
echo ""
ewarn "As of dev-lang/perl-5.38.2-r3, the useflags debug, ithreads, quadmath move into"
ewarn "a use-expand variable PERL_FEATURES, which should be set globally in make.conf."
ewarn "It appears that you have not set this variable properly yet."
ewarn ""
ewarn "Giving you a chance to abort and read the corresponding news item now..."
for n in 10 9 8 7 6 5 4 3 2 1 ; do
echo -n "${n} "
sleep 2
done;
echo "continuing."
fi
}
pkg_setup() {
case ${CHOST} in
*-darwin*) osname="darwin" ;;
*-solaris*) osname="solaris" ;;
*) osname="linux" ;;
esac
myarch="${CHOST%%-*}-${osname}"
if use perl_features_debug ; then
myarch+="-debug"
fi
if use perl_features_quadmath ; then
myarch+="-quadmath"
fi
if use perl_features_ithreads ; then
mythreading="-multi"
myarch+="-thread"
fi
PRIV_BASE="/usr/$(get_libdir)/perl5"
SITE_BASE="/usr/local/$(get_libdir)/perl5"
VENDOR_BASE="/usr/$(get_libdir)/perl5/vendor_perl"
LIBPERL="libperl$(get_libname ${MY_PV} )"
PRIV_LIB="${PRIV_BASE}/${SUBSLOT}"
ARCH_LIB="${PRIV_BASE}/${SUBSLOT}/${myarch}${mythreading}"
SITE_LIB="${SITE_BASE}/${SUBSLOT}"
SITE_ARCH="${SITE_BASE}/${SUBSLOT}/${myarch}${mythreading}"
VENDOR_LIB="${VENDOR_BASE}/${SUBSLOT}"
VENDOR_ARCH="${VENDOR_BASE}/${SUBSLOT}/${myarch}${mythreading}"
dual_scripts
}
src_remove_dual_file() {
local i pkg ver
pkg="$1"
ver="$2"
shift 2
case "${EBUILD_PHASE:-none}" in
postinst|postrm)
for i in "$@" ; do
alternatives_auto_makesym "${i}" "${i}-[0-9]*"
done
;;
setup)
for i in "$@" ; do
if [[ -f ${EROOT}${i} && ! -h ${EROOT}${i} ]] ; then
has_version ${pkg} && ewarn "You must reinstall ${pkg} !"
break
fi
done
;;
install)
for i in "$@" ; do
if ! [[ -f "${ED}"${i} ]] ; then
ewarn "${i} does not exist!"
continue
fi
mv "${ED}"${i}{,-${ver}-${P}} || die
done
;;
esac
}
src_remove_dual_man() {
local i pkg ver ff
pkg="$1"
ver="$2"
shift 2
case "${EBUILD_PHASE:-none}" in
postinst|postrm)
for i in "$@" ; do
ff=`echo "${EROOT}${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}}"*`
ff=${ff##*${i#${i%.[0-9]}}}
alternatives_auto_makesym "${i}${ff}" "${i%.[0-9]}-[0-9]*"
done
;;
install)
for i in "$@" ; do
if ! [[ -f "${ED}"${i} ]] ; then
ewarn "${i} does not exist!"
continue
fi
mv "${ED}"${i} "${ED}"${i%.[0-9]}-${ver}-${P}${i#${i%.[0-9]}} || die
done
;;
esac
}
src_remove_dual() {
local i pkg ver
pkg="$1"
ver="$2"
shift 2
for i in "$@" ; do
src_remove_dual_file "${pkg}" "${ver}" "/usr/bin/${i}"
src_remove_dual_man "${pkg}" "${ver}" "/usr/share/man/man1/${i}.1"
done
}
src_prepare_perlcross() {
cp -a ../perl-cross-${CROSS_VER}/* . || die
# bug 794463, needs further analysis what is exactly wrong here
eapply "${FILESDIR}/perl-5.34.0-crossfit.patch"
# bug 604072
MAKEOPTS+=" -j1"
export MAKEOPTS
}
src_prepare_dynamic() {
ln -s ${LIBPERL} libperl$(get_libname ${SHORT_PV}) || die
ln -s ${LIBPERL} libperl$(get_libname ) || die
}
# Copy a patch into the patch series
# add_patch SRC_PATH DEST_NAME ['description'] ['bug'] ['bug']
# - description is optional, but recommended
# - all arguments after descriptions are bug URLs
add_patch() {
local patchdir="${WORKDIR}/patches"
local infodir="${WORKDIR}/patch-info"
local src_name dest_name desc
src_name="$1"
dest_name="$2"
desc="$3"
shift; shift; shift;
einfo "Adding ${dest_name} to patch bundle"
cp "${src_name}" "${patchdir}/${dest_name}" || die "Couldn't copy ${src_name} to ${dest_name}"
if [[ -n "${desc}" ]]; then
printf "%s" "${desc}" > "${infodir}/${dest_name}.desc" || die "Couldn't write ${dest_name}.desc"
fi
if [[ $# -gt 0 ]]; then
# Note: when $@ is more than one element, this emits a
# line for each element
printf "%s\n" "$@" > "${infodir}/${dest_name}.bugs" || die "Couldn't write ${dest_name}.bugs"
fi
}
# Remove a patch using a glob expr
# eg:
# rm_patch *-darwin-Use-CC*
#
rm_patch() {
local patchdir="${WORKDIR}/patches"
local expr="$1"
local patch="$( cd "${patchdir}"; echo $expr )"
einfo "Removing $patch ($expr) from patch bundle"
if [[ -e "${patchdir}/${patch}" ]]; then
rm -f "${patchdir}/${patch}" || die "Can't remove ${patch} ( $expr )"
else
ewarn "No ${expr} found in ${patchdir} to remove"
fi
}
# Yes, this is a reasonable amount of code for something seemingly simple
# but this is far easier to debug when things go wrong, and things went wrong
# multiple times while I was getting the exact number of slashes right, which
# requires circumnavigating both bash and sed escape mechanisms.
c_escape_string() {
local slash dquote
slash='\'
dquote='"'
re_slash="${slash}${slash}"
re_dquote="${slash}${dquote}"
# Convert \ to \\,
# " to \"
echo "$1" |\
sed "s|${re_slash}|${re_slash}${re_slash}|g" |\
sed "s|${re_dquote}|${re_slash}${re_dquote}|g"
}
c_escape_file() {
c_escape_string "$(cat "$1")"
}
apply_patchdir() {
local patchdir="${WORKDIR}/patches"
local infodir="${WORKDIR}/patch-info"
local patchoutput="patchlevel-gentoo.h"
# Inject Patch-Level info into description for patchlevel.h patch
# to show in -V
local patch_expr="*List-packaged-patches*"
local patch="$( cd "${patchdir}"; echo $patch_expr )";
einfo "Injecting patch-level info into ${patch}.desc ( $patch_expr )"
if [[ -e "${patchdir}/${patch}" ]]; then
printf "List packaged patches for %s(%s) in patchlevel.h" "${PF}" "${PATCH_BASE}"\
>"${infodir}/${patch}.desc" || die "Can't rewrite ${patch}.desc"
else
eerror "No $patch_expr found in ${patchdir}"
fi
# Compute patch list to apply
# different name other than PATCHES to stop default
# reapplying it
# Single depth is currently only supported, as artifacts can reside
# from the old layout being multiple-directories, as well as it grossly
# simplifying the patchlevel_gentoo.h generation.
local PERL_PATCHES=($(
find "${patchdir}" -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |\
grep -E '[.](diff|patch)$' |\
sort -n
))
for patch in "${PERL_PATCHES[@]}"; do
eapply "${WORKDIR}"/patches/${patch}
done
einfo "Generating $patchoutput"
# This code creates a header file, each iteration
# creates one-or-more-lines for each entry found in PERL_PATCHES
# and STDOUT is redirected to the .h file
for patch in "${PERL_PATCHES[@]}"; do
local desc_f="${infodir}/${patch}.desc"
local bugs_f="${infodir}/${patch}.bugs"
printf ',"%s"\n' "${patch}"
if [[ ! -e "${desc_f}" ]]; then
ewarn "No description provided for ${patch} (expected: ${desc_f} )"
else
local desc="$(c_escape_file "${desc_f}")"
printf ',"- %s"\n' "${desc}"
fi
if [[ -e "${bugs_f}" ]]; then
while read -d $'\n' -r line; do
local esc_line="$(c_escape_string "${line}")"
printf ',"- Bug: %s"\n' "${esc_line}"
done <"${bugs_f}"
fi
done > "${S}/${patchoutput}"
printf "%s\n" "${patchoutput}" >> "${S}/MANIFEST"
}
src_prepare() {
local patchdir="${WORKDIR}/patches"
# mv -v "${WORKDIR}/perl-patchset-${PATCH_BASE}/patches" "${WORKDIR}/patches" || die
# mv -v "${WORKDIR}/perl-patchset-${PATCH_BASE}/patch-info" "${WORKDIR}/patch-info" || die
# Prepare Patch dir with additional patches / remove unwanted patches
# Inject bug/desc entries for perl -V
# Old example:
# add_patch "${FILESDIR}/${PN}-5.26.2-hppa.patch" "100-5.26.2-hppa.patch"\
# "Fix broken miniperl on hppa"\
# "https://bugs.debian.org/869122" "https://bugs.gentoo.org/634162"
# Backports from 5.42.0-votes.xml as of 2025-11-22
add_patch "${FILESDIR}/5.42.0/0001-newFOROP-fix-crash-when-optimizing-2-var-for-over-bu.patch" \
"100-newFOROP-fix-crash-when-optimizing-2-var-for-over-bu.patch" \
"Fix for keyword segfaulting when iterating over multiple values at a time" \
"https://bugs.gentoo.org/964379" "https://github.com/Perl/perl5/issues/23405"
add_patch "${FILESDIR}/5.42.0/0002-class.c-gracefully-handle-reader-writer-after-strict.patch" \
"101-class.c-gracefully-handle-reader-writer-after-strict.patch" \
"Gracefully handle reader definition after strict error" \
"https://github.com/Perl/perl5/issues/23511"
add_patch "${FILESDIR}/5.42.0/0003-use-5.41-affects-current-line-source-encoding.patch" \
"102-use-5.41-affects-current-line-source-encoding.patch" \
"5.41 use affects current line source::encoding" \
"https://github.com/Perl/perl5/issues/23881"
add_patch "${FILESDIR}/5.42.0/0004-Turn-off-POSIX-2008-locales-on-AIX.patch" \
"103-Turn-off-POSIX-2008-locales-on-AIX.patch" \
"Turn off POSIX 2008 locales on AIX" \
"https://github.com/Perl/perl5/issues/23825"
if [[ ${CHOST} == *-solaris* ]] ; then
# do NOT mess with nsl, on Solaris this is always necessary,
# when -lsocket is used e.g. to get h_errno
rm_patch "*-nsl-and-cl*"
fi
apply_patchdir
tc-is-cross-compiler && src_prepare_perlcross
tc-is-static-only || src_prepare_dynamic
if use gdbm; then
sed -i "s:INC => .*:INC => \"-I${ESYSROOT}/usr/include/gdbm\":g" \
ext/NDBM_File/Makefile.PL || die
fi
# Use errno.h from prefix rather than from host system, bug #645804
if use prefix && [[ -e "${EPREFIX}"/usr/include/errno.h ]] ; then
sed -i "/my..sysroot/s:'':'${EPREFIX}':" ext/Errno/Errno_pm.PL || die
fi
if [[ ${CHOST} == *-solaris* ]] ; then
# set a soname, fix linking against just built libperl
sed -i -e 's/netbsd\*/netbsd*|solaris*/' Makefile.SH || die
fi
if [[ ${CHOST} == *-darwin* ]] ; then
# fix install_name (soname) not to reference $D
sed -i -e '/install_name `pwd/s/`pwd`/\\$(shrpdir)/' Makefile.SH || die
# fix environ linkage absence (only a real issue on Darwin9)
if [[ ${CHOST##*-darwin} -le 9 ]] ; then
sed -i -e '/^PLDLFLAGS =/s/=/= -include crt_externs.h -Denviron="(*_NSGetEnviron())"/' \
Makefile.SH || die
fi
fi
default
}
myconf() {
# the myconf array is declared in src_configure
myconf=( "${myconf[@]}" "$@" )
}
# Outputs a list of versions which have been seen in any of the
# primary perl @INC prefix paths, such as:
# /usr/lib64/perl5/<NUMBER>
# /usr/local/lib64/perl5/<NUMBER>
# /usr/lib64/perl5/vendor_perl/<NUMBER>
#
# All values of NUMBER must be like "5.x.y" or like "5.x"
#
find_candidate_inc_versions() {
local regex='.*/5[.][0-9]+\([.][0-9]+\|\)$'
local dirs=(
"${EROOT}${PRIV_BASE}"
"${EROOT}${SITE_BASE}"
"${EROOT}${VENDOR_BASE}"
)
for dir in "${dirs[@]}"; do
if [[ ! -e "${dir}" ]]; then
continue
fi
# Without access to readdir() on these dirs, find will not be able
# to reveal any @INC directories inside them, and will subsequently prune
# them from the built perl's @INC support, breaking our compatiblity options
# entirely.
if [[ ! -r "${dir}" || ! -x "${dir}" ]]; then
eerror "Bad permissions on ${dir}, this will probably break things"
eerror "Ensure ${dir} is +rx for at least uid=$EUID"
eerror "Recommended permission is +rx for all"
eerror "> chmod o+rx ${dir}"
fi
done
einfo "Scanning for old @INC dirs matching '$regex' in: ${dirs[*]}"
find "${dirs[@]}" -maxdepth 1 -mindepth 1 -type d -regex "${regex}" -printf "%f " 2>/dev/null
}
# Sort versions passed versiony-ly, remove self-version if present
# dedup. Takes each version as an argument
sanitize_inc_versions() {
local vexclude="${SUBSLOT}"
einfo "Normalizing/Sorting candidate list: $*"
einfo " to remove '${vexclude}'"
# Note, general numeric sort has to be used
# for the last component, or unique will convert
# 5.30.0 + 5.30 into just 5.30
printf "%s\n" "$@" |\
grep -vxF "${vexclude}" |\
sort -u -nr -t'.' -k1,1rn -k2,2rn -k3,3rg
}
versions_to_inclist() {
local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
for v; do
has "${v}" ${oldv} && echo -n "${v}/${myarch}${mythreading}/ ";
echo -n "${v}/ ";
done
}
versions_to_gentoolibdirs() {
local oldv="${DIST_VERSION%-RC} ${PERL_BIN_OLDVERSEN}"
local root
local v
for v; do
for root in "${PRIV_BASE}" "${VENDOR_BASE}" "${SITE_BASE}"; do
local fullpath="${EROOT}${root}/${v}"
if [[ -e "${fullpath}" ]]; then
has "${v}" ${oldv} && printf "%s:" "${fullpath}/${myarch}${mythreading}";
printf "%s:" "${fullpath}"
fi
done
done
}
src_configure() {
declare -a myconf
export LC_ALL="C"
[[ ${COLUMNS:-1} -ge 1 ]] || unset COLUMNS # bug #394091
# Perl has problems compiling with -Os in your flags with glibc
replace-flags "-Os" "-O2"
# xlocale.h is going away in glibc-2.26, so it's counterproductive
# if we use it and include it in CORE/perl.h ... Perl builds just
# fine with glibc and locale.h only.
# However, the darwin prefix people have no locale.h ...
use elibc_glibc && myconf -Ui_xlocale
# Perl relies on -fwrapv semantics
filter-flags -ftrapv
# This flag makes compiling crash in interesting ways
filter-flags "-malign-double"
# On musl we dont want to use largefile *64 types, since 1) normal
# types are 64bit / largefile anyway and 2) the *64 types are going
# away in 1.2.4... bug #911233
use elibc_musl && myconf -Ud_off64_t
use sparc && myconf -Ud_longdbl
# This urgently needs debugging - on m68k, miniperl crashes during
# build otherwise..
use m68k && append-ldflags -Wl,-z,norelro
export BUILD_BZIP2=0
export BZIP2_INCLUDE=${ESYSROOT}/usr/include
export BZIP2_LIB=${ESYSROOT}/usr/$(get_libdir)
export BUILD_ZLIB=False
export ZLIB_INCLUDE=${ESYSROOT}/usr/include
export ZLIB_LIB=${ESYSROOT}/usr/$(get_libdir)
# allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
myndbm='U'
mygdbm='U'
mydb='U'
if use gdbm ; then
mygdbm='D'
if use berkdb ; then
myndbm='D'
fi
fi
if use berkdb ; then
mydb='D'
has_version '=sys-libs/db-1*' && myndbm='D'
fi
myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
if use alpha && [[ "$(tc-getCC)" = "ccc" ]] ; then
ewarn "Perl will not be built with berkdb support, use gcc if you need it..."
myconf -Ui_db -Ui_ndbm
fi
use perl_features_ithreads && myconf -Dusethreads
use perl_features_quadmath && myconf -Dusequadmath
if use perl_features_debug ; then
append-cflags "-g"
myconf -DDEBUGGING
elif [[ ${CFLAGS} == *-g* ]] ; then
myconf -DDEBUGGING=-g
else
myconf -DDEBUGGING=none
fi
# modifying 'optimize' prevents cross configure script from appending required flags
if tc-is-cross-compiler; then
append-cflags "-fwrapv"
tc-export_build_env
# Needed for the CHOST build too (bug #932385)
export CFLAGS="${CFLAGS} -D_GNU_SOURCE"
# bug #913171
export \
HOSTCC=$(tc-getBUILD_CC) \
HOSTCFLAGS="${CFLAGS_FOR_BUILD} -D_GNU_SOURCE" \
HOSTLDFLAGS="${LDFLAGS_FOR_BUILD}"
fi
# bug #877659, bug #821577
append-cflags -fno-strict-aliasing
# Autodiscover all old version directories, some of them will even be newer
# if you downgrade
if [[ -z ${PERL_OLDVERSEN} ]]; then
PERL_OLDVERSEN="$( find_candidate_inc_versions )"
fi
# Fixup versions, removing self match, fixing order and dupes
PERL_OLDVERSEN="$( sanitize_inc_versions ${PERL_OLDVERSEN} )"
# Experts who want a "Pure" install can set PERL_OLDVERSEN to an empty string
if [[ -n "${PERL_OLDVERSEN// }" ]]; then
local inclist="$( versions_to_inclist ${PERL_OLDVERSEN} )"
einfo "This version of perl may partially support modules previously"
einfo "installed in any of the following paths:"
for incpath in ${inclist}; do
[[ -e "${EROOT}${VENDOR_BASE}/${incpath}" ]] && einfo " ${EROOT}${VENDOR_BASE}/${incpath}"
[[ -e "${EROOT}${PRIV_BASE}/${incpath}" ]] && einfo " ${EROOT}${PRIV_BASE}/${incpath}"
[[ -e "${EROOT}${SITE_BASE}/${incpath}" ]] && einfo " ${EROOT}${SITE_BASE}/${incpath}"
done
einfo "This is a temporary measure and you should aim to cleanup these paths"
einfo "via world updates and perl-cleaner"
# myconf -Dinc_version_list="${inclist}"
myconf -Dgentoolibdirs="$( versions_to_gentoolibdirs ${PERL_OLDVERSEN} )"
fi
[[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
# Make sure we can do the final link #523730, need to set deployment
# target to override hardcoded 10.3 which breaks on modern OSX
[[ ${CHOST} == *-darwin* ]] && \
myconf "-Dld=env MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} $(tc-getCC)"
# Older macOS with non-Apple GCC chokes on inline in system headers
# using c89 mode as injected by cflags.SH, in addition, we override
# cflags, so we loose PERL_DARWIN which enables compat code that
# apparently on more recent macOS releases is no longer necessary
[[ ${CHOST} == *-darwin* && ${CHOST##*darwin} -le 9 ]] && tc-is-gcc && \
append-cflags -Dinline=__inline__ -DPERL_DARWIN
# Prefix: the host system needs not to follow Gentoo multilib stuff, and in
# Prefix itself we don't do multilib either, so make sure perl can find
# something compatible.
if use prefix ; then
# Set a hook to check for each detected library whether it actually works.
export libscheck="
( echo 'int main(){}' > '${T}'/conftest.c &&
$(tc-getCC) -o '${T}'/conftest '${T}'/conftest.c -l\$thislib >/dev/null 2>/dev/null
) || xxx=/dev/null"
# Use all host paths that might contain useful stuff, the hook above will filter out bad choices.
local paths="/lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib"
myconf "-Dlibpth=${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir) ${paths}"
elif [[ $(get_libdir) != "lib" ]] ; then
# We need to use " and not ', as the written config.sh use ' ...
myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
fi
# don't try building ODBM, bug #354453
disabled_extensions="ODBM_File"
if ! use gdbm ; then
# workaround for bug #157774: don't try building GDBM related stuff with USE="-gdbm"
disabled_extensions="${disabled_extensions} GDBM_File NDBM_File"
fi
myconf -Dnoextensions="${disabled_extensions}"
[[ "${PV##*.}" == "9999" ]] && myconf -Dusedevel -Uversiononly
[[ -n "${EXTRA_ECONF}" ]] && ewarn During Perl build, EXTRA_ECONF=${EXTRA_ECONF}
# allow fiddling via EXTRA_ECONF, bug 558070
eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
myconf \
-Duseshrplib \
-Darchname="${myarch}" \
-Dar="$(tc-getAR)" \
-Dcc="$(tc-getCC)" \
-Dcpp="$(tc-getCPP)" \
-Dld="$(tc-getCC)" \
-Dnm="$(tc-getNM)" \
-Dranlib="$(tc-getRANLIB)" \
-Accflags="${CFLAGS} -DNO_PERL_RAND_SEED" \
-Doptimize="${CFLAGS}" \
-Dldflags="${LDFLAGS}" \
-Dprefix="${EPREFIX}"'/usr' \
-Dsiteprefix="${EPREFIX}"'/usr/local' \
-Dvendorprefix="${EPREFIX}"'/usr' \
-Dscriptdir="${EPREFIX}"'/usr/bin' \
-Dprivlib="${EPREFIX}${PRIV_LIB}" \
-Darchlib="${EPREFIX}${ARCH_LIB}" \
-Dsitelib="${EPREFIX}${SITE_LIB}" \
-Dsitearch="${EPREFIX}${SITE_ARCH}" \
-Dvendorlib="${EPREFIX}${VENDOR_LIB}" \
-Dvendorarch="${EPREFIX}${VENDOR_ARCH}" \
-Dman1dir="${EPREFIX}"/usr/share/man/man1 \
-Dman3dir="${EPREFIX}"/usr/share/man/man3 \
-Dsiteman1dir="${EPREFIX}"/usr/local/man/man1 \
-Dsiteman3dir="${EPREFIX}"/usr/local/man/man3 \
-Dvendorman1dir="${EPREFIX}"/usr/share/man/man1 \
-Dvendorman3dir="${EPREFIX}"/usr/share/man/man3 \
-Dman1ext='1' \
-Dman3ext='3pm' \
-Dlibperl="${LIBPERL}" \
-Dlocincpth="${EPREFIX}"'/usr/include ' \
-Dglibpth="${EPREFIX}/$(get_libdir) ${EPREFIX}/usr/$(get_libdir)"' ' \
-Duselargefiles \
-Duse64bitint \
-Dd_semctl_semun \
-Dcf_by='Gentoo' \
-Dmyhostname='localhost' \
-Dperladmin='root@localhost' \
-Ud_csh \
-Dsh="${BROOT}"/bin/sh \
-Dtargetsh="${EPREFIX}"/bin/sh \
-Uusenm \
"${EXTRA_ECONF[@]}"
if tc-is-cross-compiler; then
./configure \
--target="${CHOST}" \
--build="${CBUILD}" \
-Dinstallprefix='' \
-Dinstallusrbinperl='undef' \
-Dusevendorprefix='define' \
"${myconf[@]}" \
|| die "Unable to configure"
else
sh Configure \
-des \
-Dinstallprefix="${EPREFIX}"'/usr' \
-Dinstallusrbinperl='n' \
"${myconf[@]}" \
|| die "Unable to configure"
fi
}
src_test() {
export NO_GENTOO_NETWORK_TESTS=1;
export GENTOO_ASSUME_SANDBOXED="${GENTOO_ASSUME_SANDBOXED:-1}"
export GENTOO_NO_PORTING_TESTS="${GENTOO_NO_PORTING_TESTS:-1}"
if [[ ${EUID} == 0 ]] ; then
ewarn "Test fails with a sandbox error (#328793) if run as root. Skipping tests..."
return 0
fi
TEST_JOBS="$(makeopts_jobs)" make test_harness || die "test failed"
}
src_install() {
local i
local coredir="${ARCH_LIB}/CORE"
emake DESTDIR="${D}" install
rm -f "${ED}/usr/bin/perl${MY_PV}"
ln -s perl "${ED}"/usr/bin/perl${MY_PV} || die
if ! tc-is-static-only ; then
dolib.so "${ED}"${coredir}/${LIBPERL}
rm -f "${ED}"${coredir}/${LIBPERL}
ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname ${SHORT_PV}) || die
ln -sf ${LIBPERL} "${ED}"/usr/$(get_libdir)/libperl$(get_libname) || die
ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/${LIBPERL} || die
ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname ${SHORT_PV}) || die
ln -sf ../../../../${LIBPERL} "${ED}"${coredir}/libperl$(get_libname) || die
fi
rm -rf "${ED}"/usr/share/man/man3 || die "Unable to remove module man pages"
# This removes ${D} from Config.pm
for i in $(find "${D}" -iname "Config.pm" ) ; do
einfo "Removing ${D} from ${i}..."
sed -i -e "s:${D}::" "${i}" || die "Sed failed"
done
dodoc Changes* README AUTHORS
if use doc ; then
# HTML Documentation
# We expect errors, warnings, and such with the following.
dodir /usr/share/doc/${PF}/html
LD_LIBRARY_PATH=. ./perl installhtml \
--podroot='.' \
--podpath='lib:ext:pod:vms' \
--recurse \
--htmldir="${ED}/usr/share/doc/${PF}/html"
fi
[[ -d ${ED}/usr/local ]] && rm -r "${ED}"/usr/local
dual_scripts
}
pkg_preinst() {
check_rebuild
}
pkg_postinst() {
dual_scripts
if [[ -z "${ROOT}" ]] ; then
local INC DIR file
INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${SHORT_PV}'|etc|local|perl$/; print "$line\n" }')
einfo "Removing old .ph files"
for DIR in ${INC} ; do
if [[ -d "${DIR}" ]] ; then
for file in $(find "${DIR}" -name "*.ph" -type f ) ; do
rm -f "${file}"
einfo "<< ${file}"
done
fi
done
# Silently remove the now empty dirs
for DIR in ${INC} ; do
if [[ -d "${DIR}" ]] ; then
find "${DIR}" -depth -type d -print0 | xargs -0 -r rmdir &> /dev/null
fi
done
fi
}
pkg_postrm() {
dual_scripts
}

View File

@ -55,7 +55,7 @@ LICENSE="|| ( Artistic GPL-1+ )"
SLOT="0/${SUBSLOT}"
if [[ "${PV##*.}" != "9999" ]] && [[ "${PV/rc//}" == "${PV}" ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris"
fi
IUSE="berkdb perl_features_debug doc gdbm perl_features_ithreads minimal perl_features_quadmath"