push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
commit 385e8759c3ff1e7f7f996bd4ea391074d61d48c1
Author: Karl Williamson <khw@cpan.org>
AuthorDate: 2024-12-18 18:25:29 -0700
Commit: Steve Hay <steve.m.hay@googlemail.com>
CommitDate: 2025-03-30 11:59:51 +0100
CVE-2024-56406: Heap-buffer-overflow with tr//
This was due to underallocating needed space. If the translation forces
something to become UTF-8 that is initially bytes, that UTF-8 could
now require two bytes where previously a single one would do.
(cherry picked from commit f93109c8a6950aafbd7488d98e112552033a3686)
diff --git a/op.c b/op.c
index 3fc23eca49a..aeee88e0335 100644
--- a/op.c
+++ b/op.c
@@ -6649,6 +6649,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
* same time. But otherwise one crosses before the other */
if (t_cp < 256 && r_cp_end > 255 && r_cp != t_cp) {
can_force_utf8 = TRUE;
+ max_expansion = MAX(2, max_expansion);
}
}

View File

@@ -0,0 +1,408 @@
From 918bfff86ca8d6d4e4ec5b30994451e0bd74aba9 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Fri, 23 May 2025 15:40:41 +0200
Subject: [PATCH] CVE-2025-40909: Clone dirhandles without fchdir
This uses fdopendir and dup to dirhandles. This means it won't change
working directory during thread cloning, which prevents race conditions
that can happen if a third thread is active at the same time.
---
Configure | 6 ++
Cross/config.sh-arm-linux | 1 +
Cross/config.sh-arm-linux-n770 | 1 +
Porting/Glossary | 5 ++
Porting/config.sh | 1 +
config_h.SH | 6 ++
configure.com | 1 +
plan9/config_sh.sample | 1 +
sv.c | 91 +----------------------------
t/op/threads-dirh.t | 104 +--------------------------------
win32/config.gc | 1 +
win32/config.vc | 1 +
12 files changed, 28 insertions(+), 191 deletions(-)
diff --git a/Configure b/Configure
index 44c12ced4014..7a13249caa96 100755
--- a/Configure
+++ b/Configure
@@ -478,6 +478,7 @@ d_fd_set=''
d_fds_bits=''
d_fdclose=''
d_fdim=''
+d_fdopendir=''
d_fegetround=''
d_ffs=''
d_ffsl=''
@@ -13344,6 +13345,10 @@ esac
set i_fcntl
eval $setvar
+: see if fdopendir exists
+set fdopendir d_fdopendir
+eval $inlibc
+
: see if fork exists
set fork d_fork
eval $inlibc
@@ -25052,6 +25057,7 @@ d_flockproto='$d_flockproto'
d_fma='$d_fma'
d_fmax='$d_fmax'
d_fmin='$d_fmin'
+d_fdopendir='$d_fdopendir'
d_fork='$d_fork'
d_fp_class='$d_fp_class'
d_fp_classify='$d_fp_classify'
diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux
index bfa0b00d5f0f..9e056539198b 100644
--- a/Cross/config.sh-arm-linux
+++ b/Cross/config.sh-arm-linux
@@ -212,6 +212,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir=undef
d_fds_bits='undef'
d_fegetround='define'
d_ffs='undef'
diff --git a/Cross/config.sh-arm-linux-n770 b/Cross/config.sh-arm-linux-n770
index 47ad5c37e3fd..365e4c4f9671 100644
--- a/Cross/config.sh-arm-linux-n770
+++ b/Cross/config.sh-arm-linux-n770
@@ -211,6 +211,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir=undef
d_fds_bits='undef'
d_fegetround='define'
d_ffs='undef'
diff --git a/Porting/Glossary b/Porting/Glossary
index bb505c653b0b..8b2965ca99c6 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -947,6 +947,11 @@ d_fmin (d_fmin.U):
This variable conditionally defines the HAS_FMIN symbol, which
indicates to the C program that the fmin() routine is available.
+d_fdopendir (d_fdopendir.U):
+ This variable conditionally defines the HAS_FORK symbol, which
+ indicates that the fdopen routine is available to open a
+ directory descriptor.
+
d_fork (d_fork.U):
This variable conditionally defines the HAS_FORK symbol, which
indicates to the C program that the fork() routine is available.
diff --git a/Porting/config.sh b/Porting/config.sh
index a921f7e1c79a..6231ea0f31ea 100644
--- a/Porting/config.sh
+++ b/Porting/config.sh
@@ -223,6 +223,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='define'
+d_fdopendir='define'
d_fds_bits='define'
d_fegetround='define'
d_ffs='define'
diff --git a/config_h.SH b/config_h.SH
index da0f2dbcd7b7..5a0f81cf2011 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -142,6 +142,12 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#$d_fcntl HAS_FCNTL /**/
+/* HAS_FDOPENDIR:
+ * This symbol, if defined, indicates that the fdopen routine is
+ * available to open a directory descriptor.
+ */
+#$d_fdopendir HAS_FDOPENDIR /**/
+
/* HAS_FGETPOS:
* This symbol, if defined, indicates that the fgetpos routine is
* available to get the file position indicator, similar to ftell().
diff --git a/configure.com b/configure.com
index 99527c180bfc..7c38711bb85d 100644
--- a/configure.com
+++ b/configure.com
@@ -6010,6 +6010,7 @@ $ WC "d_fd_set='" + d_fd_set + "'"
$ WC "d_fd_macros='define'"
$ WC "d_fdclose='undef'"
$ WC "d_fdim='" + d_fdim + "'"
+$ WC "d_fdopendir='undef'"
$ WC "d_fds_bits='define'"
$ WC "d_fegetround='undef'"
$ WC "d_ffs='undef'"
diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample
index 636acbdf6db3..246bad954424 100644
--- a/plan9/config_sh.sample
+++ b/plan9/config_sh.sample
@@ -212,6 +212,7 @@ d_fd_macros='undef'
d_fd_set='undef'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir=undef
d_fds_bits='undef'
d_fegetround='undef'
d_ffs='undef'
diff --git a/sv.c b/sv.c
index ae6d09dea28a..8a005b2d165b 100644
--- a/sv.c
+++ b/sv.c
@@ -14096,15 +14096,6 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
{
DIR *ret;
-#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
- DIR *pwd;
- const Direntry_t *dirent;
- char smallbuf[256]; /* XXX MAXPATHLEN, surely? */
- char *name = NULL;
- STRLEN len = 0;
- long pos;
-#endif
-
PERL_UNUSED_CONTEXT;
PERL_ARGS_ASSERT_DIRP_DUP;
@@ -14116,89 +14107,13 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
if (ret)
return ret;
-#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
+#ifdef HAS_FDOPENDIR
PERL_UNUSED_ARG(param);
- /* create anew */
-
- /* open the current directory (so we can switch back) */
- if (!(pwd = PerlDir_open("."))) return (DIR *)NULL;
-
- /* chdir to our dir handle and open the present working directory */
- if (fchdir(my_dirfd(dp)) < 0 || !(ret = PerlDir_open("."))) {
- PerlDir_close(pwd);
- return (DIR *)NULL;
- }
- /* Now we should have two dir handles pointing to the same dir. */
-
- /* Be nice to the calling code and chdir back to where we were. */
- /* XXX If this fails, then what? */
- PERL_UNUSED_RESULT(fchdir(my_dirfd(pwd)));
+ ret = fdopendir(dup(my_dirfd(dp)));
- /* We have no need of the pwd handle any more. */
- PerlDir_close(pwd);
-
-#ifdef DIRNAMLEN
-# define d_namlen(d) (d)->d_namlen
-#else
-# define d_namlen(d) strlen((d)->d_name)
-#endif
- /* Iterate once through dp, to get the file name at the current posi-
- tion. Then step back. */
- pos = PerlDir_tell(dp);
- if ((dirent = PerlDir_read(dp))) {
- len = d_namlen(dirent);
- if (len > sizeof(dirent->d_name) && sizeof(dirent->d_name) > PTRSIZE) {
- /* If the len is somehow magically longer than the
- * maximum length of the directory entry, even though
- * we could fit it in a buffer, we could not copy it
- * from the dirent. Bail out. */
- PerlDir_close(ret);
- return (DIR*)NULL;
- }
- if (len <= sizeof smallbuf) name = smallbuf;
- else Newx(name, len, char);
- Move(dirent->d_name, name, len, char);
- }
- PerlDir_seek(dp, pos);
-
- /* Iterate through the new dir handle, till we find a file with the
- right name. */
- if (!dirent) /* just before the end */
- for(;;) {
- pos = PerlDir_tell(ret);
- if (PerlDir_read(ret)) continue; /* not there yet */
- PerlDir_seek(ret, pos); /* step back */
- break;
- }
- else {
- const long pos0 = PerlDir_tell(ret);
- for(;;) {
- pos = PerlDir_tell(ret);
- if ((dirent = PerlDir_read(ret))) {
- if (len == (STRLEN)d_namlen(dirent)
- && memEQ(name, dirent->d_name, len)) {
- /* found it */
- PerlDir_seek(ret, pos); /* step back */
- break;
- }
- /* else we are not there yet; keep iterating */
- }
- else { /* This is not meant to happen. The best we can do is
- reset the iterator to the beginning. */
- PerlDir_seek(ret, pos0);
- break;
- }
- }
- }
-#undef d_namlen
-
- if (name && name != smallbuf)
- Safefree(name);
-#endif
-
-#ifdef WIN32
+#elif defined(WIN32)
ret = win32_dirp_dup(dp, param);
#endif
diff --git a/t/op/threads-dirh.t b/t/op/threads-dirh.t
index bb4bcfc14184..14c399ca19cd 100644
--- a/t/op/threads-dirh.t
+++ b/t/op/threads-dirh.t
@@ -13,16 +13,12 @@ BEGIN {
skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
skip_all("runs out of memory on some EBCDIC") if $ENV{PERL_SKIP_BIG_MEM_TESTS};
- plan(6);
+ plan(1);
}
use strict;
use warnings;
use threads;
-use threads::shared;
-use File::Path;
-use File::Spec::Functions qw 'updir catdir';
-use Cwd 'getcwd';
# Basic sanity check: make sure this does not crash
fresh_perl_is <<'# this is no comment', 'ok', {}, 'crash when duping dirh';
@@ -31,101 +27,3 @@ fresh_perl_is <<'# this is no comment', 'ok', {}, 'crash when duping dirh';
async{}->join for 1..2;
print "ok";
# this is no comment
-
-my $dir;
-SKIP: {
- skip "telldir or seekdir not defined on this platform", 5
- if !$Config::Config{d_telldir} || !$Config::Config{d_seekdir};
- my $skip = sub {
- chdir($dir);
- chdir updir;
- skip $_[0], 5
- };
-
- if(!$Config::Config{d_fchdir} && $^O ne "MSWin32") {
- $::TODO = 'dir handle cloning currently requires fchdir on non-Windows platforms';
- }
-
- my @w :shared; # warnings accumulator
- local $SIG{__WARN__} = sub { push @w, $_[0] };
-
- $dir = catdir getcwd(), "thrext$$" . int rand() * 100000;
-
- rmtree($dir) if -d $dir;
- mkdir($dir);
-
- # Create a dir structure like this:
- # $dir
- # |
- # `- toberead
- # |
- # +---- thrit
- # |
- # +---- rile
- # |
- # `---- zor
-
- chdir($dir);
- mkdir 'toberead';
- chdir 'toberead';
- {open my $fh, ">thrit" or &$skip("Cannot create file thrit")}
- {open my $fh, ">rile" or &$skip("Cannot create file rile")}
- {open my $fh, ">zor" or &$skip("Cannot create file zor")}
- chdir updir;
-
- # Then test that dir iterators are cloned correctly.
-
- opendir my $toberead, 'toberead';
- my $start_pos = telldir $toberead;
- my @first_2 = (scalar readdir $toberead, scalar readdir $toberead);
- my @from_thread = @{; async { [readdir $toberead ] } ->join };
- my @from_main = readdir $toberead;
- is join('-', sort @from_thread), join('-', sort @from_main),
- 'dir iterator is copied from one thread to another';
- like
- join('-', "", sort(@first_2, @from_thread), ""),
- qr/(?<!-rile)-rile-thrit-zor-(?!zor-)/i,
- 'cloned iterator iterates exactly once over everything not already seen';
-
- seekdir $toberead, $start_pos;
- readdir $toberead for 1 .. @first_2+@from_thread;
- {
- local $::TODO; # This always passes when dir handles are not cloned.
- is
- async { readdir $toberead // 'undef' } ->join, 'undef',
- 'cloned dir iterator that points to the end of the directory'
- ;
- }
-
- # Make sure the cloning code can handle file names longer than 255 chars
- SKIP: {
- chdir 'toberead';
- open my $fh,
- ">floccipaucinihilopilification-"
- . "pneumonoultramicroscopicsilicovolcanoconiosis-"
- . "lopadotemachoselachogaleokranioleipsanodrimypotrimmatosilphiokarabo"
- . "melitokatakechymenokichlepikossyphophattoperisteralektryonoptokephal"
- . "liokinklopeleiolagoiosiraiobaphetraganopterygon"
- or
- chdir updir,
- skip("OS does not support long file names (and I mean *long*)", 1);
- chdir updir;
- opendir my $dirh, "toberead";
- my $test_name
- = "dir iterators can be cloned when the next fn > 255 chars";
- while() {
- my $pos = telldir $dirh;
- my $fn = readdir($dirh);
- if(!defined $fn) { fail($test_name); last SKIP; }
- if($fn =~ 'lagoio') {
- seekdir $dirh, $pos;
- last;
- }
- }
- is length async { scalar readdir $dirh } ->join, 258, $test_name;
- }
-
- is scalar @w, 0, 'no warnings during all that' or diag @w;
- chdir updir;
-}
-rmtree($dir);
diff --git a/win32/config.gc b/win32/config.gc
index f8776188c09c..34aa8de6ed75 100644
--- a/win32/config.gc
+++ b/win32/config.gc
@@ -199,6 +199,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir='undef'
d_fds_bits='define'
d_fegetround='undef'
d_ffs='undef'
diff --git a/win32/config.vc b/win32/config.vc
index 619979e22b53..536085fe94e0 100644
--- a/win32/config.vc
+++ b/win32/config.vc
@@ -199,6 +199,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir='undef'
d_fds_bits='define'
d_fegetround='undef'
d_ffs='undef'

View File

@@ -0,0 +1,11 @@
--- a/hints/darwin.sh 2013-05-08 11:13:45.000000000 -0600
+++ b/hints/darwin.sh 2013-05-08 11:15:04.000000000 -0600
@@ -129,7 +129,7 @@
# Avoid Apple's cpp precompiler, better for extensions
if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
- cppflags="${cppflags} -no-cpp-precomp"
+ #cppflags="${cppflags} -no-cpp-precomp"
# This is necessary because perl's build system doesn't
# apply cppflags to cc compile lines as it should.

View File

@@ -0,0 +1,21 @@
From f702c387e6940fab3801d7562a668b974a2b3a8f Mon Sep 17 00:00:00 2001
From: Audrey Dutcher <audrey@rhelmot.io>
Date: Fri, 30 May 2025 12:29:54 -0700
Subject: [PATCH] add d_fdopendir configuration
---
cnf/configure_func.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/cnf/configure_func.sh b/cnf/configure_func.sh
index 4c13e4c..b24fe03 100644
--- a/cnf/configure_func.sh
+++ b/cnf/configure_func.sh
@@ -83,6 +83,7 @@ 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_fdclose 'fdclose' "NULL,NULL" 'stdio.h'
+checkfunc d_fdopendir 'fdopendir' "0" 'dirent.h'
checkfunc d_ffs 'ffs' "0" 'strings.h'
checkfunc d_ffsl 'ffsl' "0" 'strings.h'
checkfunc d_fgetpos 'fgetpos' "NULL, 0" 'stdio.h'

View File

@@ -0,0 +1,250 @@
From: =?UTF-8?q?Christian=20K=C3=B6gler?= <ck3d@gmx.de>
Date: Mon, 10 Apr 2023 22:12:24 +0200
Subject: [PATCH] miniperl compatible modules
CPAN::Meta
ExtUtils::MakeMaker
JSON::PP
Data::Dumper
Updated for perl v5.38.0 by stig@stig.io
---
diff --git a/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm b/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm
index b0e83b0d2d..dab4907704 100644
--- a/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm
+++ b/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm
@@ -86,21 +86,7 @@ sub new {
# from version::vpp
sub _find_magic_vstring {
my $value = shift;
- my $tvalue = '';
- require B;
- my $sv = B::svref_2object(\$value);
- my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef;
- while ( $magic ) {
- if ( $magic->TYPE eq 'V' ) {
- $tvalue = $magic->PTR;
- $tvalue =~ s/^v?(.+)$/v$1/;
- last;
- }
- else {
- $magic = $magic->MOREMAGIC;
- }
- }
- return $tvalue;
+ return version::->parse($value)->stringify;
}
# safe if given an unblessed reference
diff --git a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
index 746abd63bc..c55d7cd2d0 100644
--- a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
+++ b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
@@ -1,6 +1,7 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::YAML; # git description: v1.68-2-gcc5324e
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
@@ -650,27 +651,29 @@ sub _dump_string {
join '', map { "$_\n" } @lines;
}
-sub _has_internal_string_value {
+# taken from cpan/JSON-PP/lib/JSON/PP.pm
+sub _looks_like_number {
my $value = shift;
- my $b_obj = B::svref_2object(\$value); # for round trip problem
- return $b_obj->FLAGS & B::SVf_POK();
+ no warnings 'numeric';
+ # if the utf8 flag is on, it almost certainly started as a string
+ return if utf8::is_utf8($value);
+ # detect numbers
+ # string & "" -> ""
+ # number & "" -> 0 (with warning)
+ # nan and inf can detect as numbers, so check with * 0
+ return unless length((my $dummy = "") & $value);
+ return unless 0 + $value eq $value;
+ return 1 if $value * 0 == 0;
+ return -1; # inf/nan
}
sub _dump_scalar {
my $string = $_[1];
my $is_key = $_[2];
- # Check this before checking length or it winds up looking like a string!
- my $has_string_flag = _has_internal_string_value($string);
return '~' unless defined $string;
return "''" unless length $string;
- if (Scalar::Util::looks_like_number($string)) {
- # keys and values that have been used as strings get quoted
- if ( $is_key || $has_string_flag ) {
- return qq['$string'];
- }
- else {
- return $string;
- }
+ if (_looks_like_number($string)) {
+ return qq['$string'];
}
if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) {
$string =~ s/\\/\\\\/g;
@@ -800,9 +803,6 @@ sub errstr {
# Helper functions. Possibly not needed.
-# Use to detect nv or iv
-use B;
-
# XXX-INGY Is flock CPAN::Meta::YAML's responsibility?
# Some platforms can't flock :-(
# XXX-XDG I think it is. When reading and writing files, we ought
@@ -822,35 +822,8 @@ sub _can_flock {
}
}
-
-# XXX-INGY Is this core in 5.8.1? Can we remove this?
-# XXX-XDG Scalar::Util 1.18 didn't land until 5.8.8, so we need this
-#####################################################################
-# Use Scalar::Util if possible, otherwise emulate it
-
-use Scalar::Util ();
BEGIN {
- local $@;
- if ( eval { Scalar::Util->VERSION(1.18); } ) {
- *refaddr = *Scalar::Util::refaddr;
- }
- else {
- eval <<'END_PERL';
-# Scalar::Util failed to load or too old
-sub refaddr {
- my $pkg = ref($_[0]) or return undef;
- if ( !! UNIVERSAL::can($_[0], 'can') ) {
- bless $_[0], 'Scalar::Util::Fake';
- } else {
- $pkg = undef;
- }
- "$_[0]" =~ /0x(\w+)/;
- my $i = do { no warnings 'portable'; hex $1 };
- bless $_[0], $pkg if defined $pkg;
- $i;
-}
-END_PERL
- }
+ *refaddr = *builtin::refaddr;
}
delete $CPAN::Meta::YAML::{refaddr};
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
index 3604eae402..991f69d275 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
@@ -1,12 +1,13 @@
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::Merge;
our $VERSION = '2.150010';
use Carp qw/croak/;
-use Scalar::Util qw/blessed/;
+use builtin qw/blessed/;
use CPAN::Meta::Converter 2.141170;
sub _is_identical {
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
index d4e93fd8a5..809da68d02 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
@@ -1,6 +1,7 @@
use 5.006;
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::Prereqs;
our $VERSION = '2.150010';
@@ -14,7 +15,6 @@ our $VERSION = '2.150010';
#pod =cut
use Carp qw(confess);
-use Scalar::Util qw(blessed);
use CPAN::Meta::Requirements 2.121;
#pod =method new
@@ -168,7 +168,12 @@ sub types_in {
sub with_merged_prereqs {
my ($self, $other) = @_;
- my @other = blessed($other) ? $other : @$other;
+ eval 'require Scalar::Util';
+ my @other = unless($@){
+ Scalar::Util::blessed($other) ? $other : @$other;
+ }else{
+ builtin::blessed($other) ? $other : @$other;
+ }
my @prereq_objs = ($self, @other);
diff --git a/cpan/JSON-PP/lib/JSON/PP.pm b/cpan/JSON-PP/lib/JSON/PP.pm
index fc8fcbc8f0..cda7b90c65 100644
--- a/cpan/JSON-PP/lib/JSON/PP.pm
+++ b/cpan/JSON-PP/lib/JSON/PP.pm
@@ -4,6 +4,7 @@ package JSON::PP;
use 5.008;
use strict;
+no warnings 'experimental::builtin';
use Exporter ();
BEGIN { our @ISA = ('Exporter') }
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index bb6d3caedb..0c2fde4743 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -11,6 +11,7 @@ package Data::Dumper;
use strict;
use warnings;
+no warnings 'experimental::builtin';
#$| = 1;
@@ -125,8 +126,7 @@ sub new {
# Packed numeric addresses take less memory. Plus pack is faster than sprintf
sub format_refaddr {
- require Scalar::Util;
- pack "J", Scalar::Util::refaddr(shift);
+ pack "J", builtin::refaddr(shift);
};
#
@@ -282,9 +282,8 @@ sub _dump {
warn "WARNING(Freezer method call failed): $@" if $@;
}
- require Scalar::Util;
- my $realpack = Scalar::Util::blessed($val);
- my $realtype = $realpack ? Scalar::Util::reftype($val) : ref $val;
+ my $realpack = builtin::blessed($val);
+ my $realtype = $realpack ? builtin::reftype($val) : ref $val;
$id = format_refaddr($val);
# Note: By this point $name is always defined and of non-zero length.
@@ -576,7 +575,7 @@ sub _dump {
# here generates a different result. So there are actually "three" different
# implementations of Data::Dumper (kind of sort of) but we only test two.
elsif (!defined &_vstring
- and ref $ref eq 'VSTRING' || eval{Scalar::Util::isvstring($val)}) {
+ and ref $ref eq 'VSTRING') {
$out .= sprintf "v%vd", $val;
}
# \d here would treat "1\x{660}" as a safe decimal number

View File

@@ -0,0 +1,224 @@
From: =?UTF-8?q?Christian=20K=C3=B6gler?= <ck3d@gmx.de>
Date: Mon, 10 Apr 2023 22:12:24 +0200
Subject: [PATCH] miniperl compatible modules
CPAN::Meta
ExtUtils::MakeMaker
JSON::PP
Data::Dumper
Updated for perl v5.40.0 by marcus@means.no
---
# safe if given an unblessed reference
diff --git a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
index 746abd63bc..c55d7cd2d0 100644
--- a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
+++ b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
@@ -1,6 +1,7 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::YAML; # git description: v1.68-2-gcc5324e
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
@@ -650,27 +651,29 @@ sub _dump_string {
join '', map { "$_\n" } @lines;
}
-sub _has_internal_string_value {
+# taken from cpan/JSON-PP/lib/JSON/PP.pm
+sub _looks_like_number {
my $value = shift;
- my $b_obj = B::svref_2object(\$value); # for round trip problem
- return $b_obj->FLAGS & B::SVf_POK();
+ no warnings 'numeric';
+ # if the utf8 flag is on, it almost certainly started as a string
+ return if utf8::is_utf8($value);
+ # detect numbers
+ # string & "" -> ""
+ # number & "" -> 0 (with warning)
+ # nan and inf can detect as numbers, so check with * 0
+ return unless length((my $dummy = "") & $value);
+ return unless 0 + $value eq $value;
+ return 1 if $value * 0 == 0;
+ return -1; # inf/nan
}
sub _dump_scalar {
my $string = $_[1];
my $is_key = $_[2];
- # Check this before checking length or it winds up looking like a string!
- my $has_string_flag = _has_internal_string_value($string);
return '~' unless defined $string;
return "''" unless length $string;
- if (Scalar::Util::looks_like_number($string)) {
- # keys and values that have been used as strings get quoted
- if ( $is_key || $has_string_flag ) {
- return qq['$string'];
- }
- else {
- return $string;
- }
+ if (_looks_like_number($string)) {
+ return qq['$string'];
}
if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) {
$string =~ s/\\/\\\\/g;
@@ -800,9 +803,6 @@ sub errstr {
# Helper functions. Possibly not needed.
-# Use to detect nv or iv
-use B;
-
# XXX-INGY Is flock CPAN::Meta::YAML's responsibility?
# Some platforms can't flock :-(
# XXX-XDG I think it is. When reading and writing files, we ought
@@ -822,35 +822,8 @@ sub _can_flock {
}
}
-
-# XXX-INGY Is this core in 5.8.1? Can we remove this?
-# XXX-XDG Scalar::Util 1.18 didn't land until 5.8.8, so we need this
-#####################################################################
-# Use Scalar::Util if possible, otherwise emulate it
-
-use Scalar::Util ();
BEGIN {
- local $@;
- if ( eval { Scalar::Util->VERSION(1.18); } ) {
- *refaddr = *Scalar::Util::refaddr;
- }
- else {
- eval <<'END_PERL';
-# Scalar::Util failed to load or too old
-sub refaddr {
- my $pkg = ref($_[0]) or return undef;
- if ( !! UNIVERSAL::can($_[0], 'can') ) {
- bless $_[0], 'Scalar::Util::Fake';
- } else {
- $pkg = undef;
- }
- "$_[0]" =~ /0x(\w+)/;
- my $i = do { no warnings 'portable'; hex $1 };
- bless $_[0], $pkg if defined $pkg;
- $i;
-}
-END_PERL
- }
+ *refaddr = *builtin::refaddr;
}
delete $CPAN::Meta::YAML::{refaddr};
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
index 3604eae402..991f69d275 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
@@ -1,12 +1,13 @@
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::Merge;
our $VERSION = '2.150010';
use Carp qw/croak/;
-use Scalar::Util qw/blessed/;
+use builtin qw/blessed/;
use CPAN::Meta::Converter 2.141170;
sub _is_identical {
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
index d4e93fd8a5..809da68d02 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
@@ -1,6 +1,7 @@
use 5.006;
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::Prereqs;
our $VERSION = '2.150010';
@@ -14,7 +15,6 @@ our $VERSION = '2.150010';
#pod =cut
use Carp qw(confess);
-use Scalar::Util qw(blessed);
use CPAN::Meta::Requirements 2.121;
#pod =method new
@@ -168,7 +168,12 @@ sub types_in {
sub with_merged_prereqs {
my ($self, $other) = @_;
- my @other = blessed($other) ? $other : @$other;
+ eval 'require Scalar::Util';
+ my @other = unless($@){
+ Scalar::Util::blessed($other) ? $other : @$other;
+ }else{
+ builtin::blessed($other) ? $other : @$other;
+ }
my @prereq_objs = ($self, @other);
diff --git a/cpan/JSON-PP/lib/JSON/PP.pm b/cpan/JSON-PP/lib/JSON/PP.pm
index fc8fcbc8f0..cda7b90c65 100644
--- a/cpan/JSON-PP/lib/JSON/PP.pm
+++ b/cpan/JSON-PP/lib/JSON/PP.pm
@@ -4,6 +4,7 @@ package JSON::PP;
use 5.008;
use strict;
+no warnings 'experimental::builtin';
use Exporter ();
BEGIN { our @ISA = ('Exporter') }
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index bb6d3caedb..0c2fde4743 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -11,6 +11,7 @@ package Data::Dumper;
use strict;
use warnings;
+no warnings 'experimental::builtin';
#$| = 1;
@@ -125,8 +126,7 @@ sub new {
# Packed numeric addresses take less memory. Plus pack is faster than sprintf
sub format_refaddr {
- require Scalar::Util;
- pack "J", Scalar::Util::refaddr(shift);
+ pack "J", builtin::refaddr(shift);
};
#
@@ -282,9 +282,8 @@ sub _dump {
warn "WARNING(Freezer method call failed): $@" if $@;
}
- require Scalar::Util;
- my $realpack = Scalar::Util::blessed($val);
- my $realtype = $realpack ? Scalar::Util::reftype($val) : ref $val;
+ my $realpack = builtin::blessed($val);
+ my $realtype = $realpack ? builtin::reftype($val) : ref $val;
$id = format_refaddr($val);
# Note: By this point $name is always defined and of non-zero length.
@@ -576,7 +575,7 @@ sub _dump {
# here generates a different result. So there are actually "three" different
# implementations of Data::Dumper (kind of sort of) but we only test two.
elsif (!defined &_vstring
- and ref $ref eq 'VSTRING' || eval{Scalar::Util::isvstring($val)}) {
+ and ref $ref eq 'VSTRING') {
$out .= sprintf "v%vd", $val;
}
# \d here would treat "1\x{660}" as a safe decimal number

View File

@@ -0,0 +1,90 @@
{ callPackage }:
let
# Common passthru for all perl interpreters.
# copied from lua
passthruFun =
{
overrides,
perlOnBuildForBuild,
perlOnBuildForHost,
perlOnBuildForTarget,
perlOnHostForHost,
perlOnTargetForTarget,
perlAttr ? null,
self, # is perlOnHostForTarget
}:
let
perlPackages =
callPackage
# Function that when called
# - imports perl-packages.nix
# - adds spliced package sets to the package set
(
{
stdenv,
pkgs,
perl,
callPackage,
makeScopeWithSplicing',
}:
let
perlPackagesFun = callPackage ../../../top-level/perl-packages.nix {
# allow 'perlPackages.override { pkgs = pkgs // { imagemagick = imagemagickBig; }; }' like in python3Packages
# most perl packages aren't called with callPackage so it's not possible to override their arguments individually
# the conditional is because the // above won't be applied to __splicedPackages and hopefully no one is doing that when cross-compiling
pkgs = if stdenv.buildPlatform != stdenv.hostPlatform then pkgs.__splicedPackages else pkgs;
inherit stdenv;
perl = self;
};
otherSplices = {
selfBuildBuild = perlOnBuildForBuild.pkgs;
selfBuildHost = perlOnBuildForHost.pkgs;
selfBuildTarget = perlOnBuildForTarget.pkgs;
selfHostHost = perlOnHostForHost.pkgs;
selfTargetTarget = perlOnTargetForTarget.pkgs or { };
};
in
makeScopeWithSplicing' {
inherit otherSplices;
f = perlPackagesFun;
}
)
{
perl = self;
};
in
rec {
buildEnv = callPackage ./wrapper.nix {
perl = self;
inherit (pkgs) requiredPerlModules;
};
withPackages = f: buildEnv.override { extraLibs = f pkgs; };
pkgs = perlPackages // (overrides pkgs);
interpreter = "${self}/bin/perl";
libPrefix = "lib/perl5/site_perl";
perlOnBuild = perlOnBuildForHost.override {
inherit overrides;
self = perlOnBuild;
};
};
in
rec {
# Maint version
perl538 = callPackage ./interpreter.nix {
self = perl538;
version = "5.38.2";
sha256 = "sha256-oKMVNEUet7g8fWWUpJdUOlTUiLyQygD140diV39AZV4=";
inherit passthruFun;
};
# Maint version
perl540 = callPackage ./interpreter.nix {
self = perl540;
version = "5.40.0";
sha256 = "sha256-x0A0jzVzljJ6l5XT6DI7r9D+ilx4NfwcuroMyN/nFh8=";
inherit passthruFun;
};
}

View File

@@ -0,0 +1,57 @@
From bd0ab509f890a6638bd5033ef58526f8c74f7e4b Mon Sep 17 00:00:00 2001
From: Andrei Horodniceanu <a.horodniceanu@proton.me>
Date: Wed, 4 Sep 2024 12:46:44 +0300
Subject: [PATCH] locale.c: Fix compilation on platforms with only a C locale
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
---
AUTHORS | 1 +
locale.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/AUTHORS b/AUTHORS
index b2e0bf2043a9..b196b93bda13 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -103,6 +103,7 @@ Andreas König <a.koenig@mind.de>
Andreas Marienborg <andreas.marienborg@gmail.com>
Andreas Schwab <schwab@suse.de>
Andreas Voegele <andreas@andreasvoegele.com>
+Andrei Horodniceanu <a.horodniceanu@proton.me>
Andrei Yelistratov <andrew@sundale.net>
Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
Andrew Bettison <andrewb@zip.com.au>
diff --git a/locale.c b/locale.c
index 168b94914318..d764b4b3c11e 100644
--- a/locale.c
+++ b/locale.c
@@ -8963,6 +8963,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
* categories into our internal indices. */
if (map_LC_ALL_position_to_index[0] == LC_ALL_INDEX_) {
+# ifdef PERL_LC_ALL_CATEGORY_POSITIONS_INIT
/* Use this array, initialized by a config.h constant */
int lc_all_category_positions[] = PERL_LC_ALL_CATEGORY_POSITIONS_INIT;
STATIC_ASSERT_STMT( C_ARRAY_LENGTH(lc_all_category_positions)
@@ -8975,6 +8976,21 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
map_LC_ALL_position_to_index[i] =
get_category_index(lc_all_category_positions[i]);
}
+# else
+ /* It is possible for both PERL_LC_ALL_USES_NAME_VALUE_PAIRS and
+ * PERL_LC_ALL_CATEGORY_POSITIONS_INIT not to be defined, e.g. on
+ * systems with only a C locale during ./Configure. Assume that this
+ * can only happen as part of some sort of bootstrapping so allow
+ * compilation to succeed by ignoring correctness.
+ */
+ for (unsigned int i = 0;
+ i < C_ARRAY_LENGTH(map_LC_ALL_position_to_index);
+ i++)
+ {
+ map_LC_ALL_position_to_index[i] = 0;
+ }
+# endif
+
}
LOCALE_UNLOCK;

View File

@@ -0,0 +1,355 @@
{
stdenv,
fetchurl,
fetchFromGitHub,
buildPackages,
lib,
self,
version,
sha256,
pkgsBuildBuild,
pkgsBuildHost,
pkgsBuildTarget,
pkgsHostHost,
pkgsTargetTarget,
zlib,
config,
passthruFun,
perlAttr ? "perl${lib.versions.major version}${lib.versions.minor version}",
enableThreading ? true,
coreutils,
makeWrapper,
enableCrypt ? true,
libxcrypt ? null,
overrides ? config.perlPackageOverrides or (p: { }), # TODO: (self: super: {}) like in python
}@inputs:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
assert (enableCrypt -> (libxcrypt != null));
let
crossCompiling = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform);
libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
libcInc = lib.getDev libc;
libcLib = lib.getLib libc;
in
stdenv.mkDerivation (
rec {
inherit version;
pname = "perl";
src = fetchurl {
url = "mirror://cpan/src/5.0/perl-${version}.tar.gz";
inherit sha256;
};
strictDeps = true;
# TODO: Add a "dev" output containing the header files.
outputs = [
"out"
"man"
"devdoc"
]
++ lib.optional crossCompiling "mini";
setOutputFlags = false;
# On FreeBSD, if Perl is built with threads support, having
# libxcrypt available will result in a build failure, because
# perl.h will get conflicting definitions of struct crypt_data
# from libc's unistd.h and libxcrypt's crypt.h.
#
# FreeBSD Ports has the same issue building the perl port if
# the libxcrypt port has been installed.
#
# Without libxcrypt, Perl will still find FreeBSD's crypt functions.
propagatedBuildInputs = lib.optional (enableCrypt && !stdenv.hostPlatform.isFreeBSD) libxcrypt;
disallowedReferences = [ stdenv.cc ];
patches = [
./CVE-2024-56406.patch
./CVE-2025-40909.patch
]
# Do not look in /usr etc. for dependencies.
++ lib.optional ((lib.versions.majorMinor version) == "5.38") ./no-sys-dirs-5.38.0.patch
++ lib.optional ((lib.versions.majorMinor version) == "5.40") ./no-sys-dirs-5.40.0.patch
# Fix compilation on platforms with only a C locale: https://github.com/Perl/perl5/pull/22569
++ lib.optional (version == "5.40.0") ./fix-build-with-only-C-locale-5.40.0.patch
++ lib.optional stdenv.hostPlatform.isSunOS ./ld-shared.patch
++ lib.optionals stdenv.hostPlatform.isDarwin [
./cpp-precomp.patch
./sw_vers.patch
]
# fixes build failure due to missing d_fdopendir/HAS_FDOPENDIR configure option
# https://github.com/arsv/perl-cross/pull/159
++ lib.optional (crossCompiling && (lib.versionAtLeast version "5.40.0")) ./cross-fdopendir.patch
++ lib.optional (crossCompiling && (lib.versionAtLeast version "5.40.0")) ./cross540.patch
++ lib.optional (crossCompiling && (lib.versionOlder version "5.40.0")) ./cross.patch;
# This is not done for native builds because pwd may need to come from
# bootstrap tools when building bootstrap perl.
postPatch =
(
if crossCompiling then
''
substituteInPlace dist/PathTools/Cwd.pm \
--replace "/bin/pwd" '${coreutils}/bin/pwd'
substituteInPlace cnf/configure_tool.sh --replace "cc -E -P" "cc -E"
''
else
''
substituteInPlace dist/PathTools/Cwd.pm \
--replace "/bin/pwd" "$(type -P pwd)"
''
)
+
# Perl's build system uses the src variable, and its value may end up in
# the output in some cases (when cross-compiling)
''
unset src
'';
# Build a thread-safe Perl with a dynamic libperl.so. We need the
# "installstyle" option to ensure that modules are put under
# $out/lib/perl5 - this is the general default, but because $out
# contains the string "perl", Configure would select $out/lib.
# Miniperl needs -lm. perl needs -lrt.
configureFlags =
(
if crossCompiling then
[
"-Dlibpth=\"\""
"-Dglibpth=\"\""
"-Ddefault_inc_excludes_dot"
# https://github.com/arsv/perl-cross/issues/158
"-Dd_gnulibc=define"
]
else
(
[
"-de"
"-Dprefix=${placeholder "out"}"
"-Dman1dir=${placeholder "out"}/share/man/man1"
"-Dman3dir=${placeholder "out"}/share/man/man3"
]
++ (
if (stdenv.cc.targetPrefix != "") then
[
"-Dcc=${stdenv.cc.targetPrefix}cc"
"-Dnm=${stdenv.cc.targetPrefix}nm"
"-Dar=${stdenv.cc.targetPrefix}ar"
]
else
[
"-Dcc=cc"
"-Duseshrplib"
]
)
)
)
++ [
"-Uinstallusrbinperl"
"-Dinstallstyle=lib/perl5"
"-Dlocincpth=${libcInc}/include"
"-Dloclibpth=${libcLib}/lib"
]
++ lib.optional stdenv.hostPlatform.isStatic "-Uusedl"
++ lib.optionals ((builtins.match ''5\.[0-9]*[13579]\..+'' version) != null) [
"-Dusedevel"
"-Uversiononly"
]
++ lib.optional stdenv.hostPlatform.isSunOS "-Dcc=gcc"
++ lib.optional enableThreading "-Dusethreads"
++ lib.optional (!enableCrypt) "-A clear:d_crypt_r"
++ lib.optionals (stdenv.hostPlatform.isFreeBSD && crossCompiling && enableCrypt) [
# https://github.com/Perl/perl5/issues/22295
# configure cannot figure out that we have crypt automatically, but we really do
"-Dd_crypt"
];
configureScript = lib.optionalString (!crossCompiling) "${stdenv.shell} ./Configure";
# !canExecute cross uses miniperl which doesn't have this
postConfigure = lib.optionalString (!crossCompiling && stdenv.cc.targetPrefix != "") ''
substituteInPlace Makefile \
--replace-fail "AR = ar" "AR = ${stdenv.cc.targetPrefix}ar"
'';
dontAddStaticConfigureFlags = true;
dontAddPrefix = !crossCompiling;
enableParallelBuilding = false;
# perl includes the build date, the uname of the build system and the
# username of the build user in some files.
# We override these to make it build deterministically.
# other distro solutions
# https://github.com/bmwiedemann/openSUSE/blob/master/packages/p/perl/perl-reproducible.patch
# https://github.com/archlinux/svntogit-packages/blob/packages/perl/trunk/config.over
# https://salsa.debian.org/perl-team/interpreter/perl/blob/debian-5.26/debian/config.over
# A ticket has been opened upstream to possibly clean some of this up: https://rt.perl.org/Public/Bug/Display.html?id=133452
preConfigure = ''
cat > config.over <<EOF
${lib.optionalString (
stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu
) ''osvers="gnulinux"''}
myuname="nixpkgs"
myhostname="nixpkgs"
cf_by="nixpkgs"
cf_time="$(date -d "@$SOURCE_DATE_EPOCH")"
EOF
# Compress::Raw::Zlib should use our zlib package instead of the one
# included with the distribution
cat > ./cpan/Compress-Raw-Zlib/config.in <<EOF
BUILD_ZLIB = False
INCLUDE = ${zlib.dev}/include
LIB = ${zlib.out}/lib
OLD_ZLIB = False
GZIP_OS_CODE = AUTO_DETECT
USE_ZLIB_NG = False
''
+ lib.optionalString (lib.versionAtLeast version "5.40.0") ''
ZLIB_INCLUDE = ${zlib.dev}/include
ZLIB_LIB = ${zlib.out}/lib
''
+ ''
EOF
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
''
+ lib.optionalString (!enableThreading) ''
# We need to do this because the bootstrap doesn't have a static libpthread
sed -i 's,\(libswanted.*\)pthread,\1,g' Configure
'';
# Default perl does not support --host= & co.
configurePlatforms = [ ];
setupHook = ./setup-hook.sh;
# copied from python
passthru =
let
# When we override the interpreter we also need to override the spliced versions of the interpreter
inputs' = lib.filterAttrs (n: v: !lib.isDerivation v && n != "passthruFun") inputs;
override =
attr:
let
perl = attr.override (inputs' // { self = perl; });
in
perl;
in
passthruFun rec {
inherit self perlAttr;
inherit overrides;
perlOnBuildForBuild = override pkgsBuildBuild.${perlAttr};
perlOnBuildForHost = override pkgsBuildHost.${perlAttr};
perlOnBuildForTarget = override pkgsBuildTarget.${perlAttr};
perlOnHostForHost = override pkgsHostHost.${perlAttr};
perlOnTargetForTarget =
if lib.hasAttr perlAttr pkgsTargetTarget then (override pkgsTargetTarget.${perlAttr}) else { };
};
doCheck = false; # some tests fail, expensive
# TODO: it seems like absolute paths to some coreutils is required.
postInstall = ''
# Remove dependency between "out" and "man" outputs.
rm "$out"/lib/perl5/*/*/.packlist
# Remove dependencies on glibc and gcc
sed "/ *libpth =>/c libpth => ' '," \
-i "$out"/lib/perl5/*/*/Config.pm
# TODO: removing those paths would be cleaner than overwriting with nonsense.
substituteInPlace "$out"/lib/perl5/*/*/Config_heavy.pl \
--replace "${libcInc}" /no-such-path \
--replace "${if stdenv.hasCC then stdenv.cc else "/no-such-path"}" /no-such-path \
--replace "${
if stdenv.hasCC && stdenv.cc.cc != null then stdenv.cc.cc else "/no-such-path"
}" /no-such-path \
--replace "${
if stdenv.hasCC && stdenv.cc.fallback_sdk or null != null then
stdenv.cc.fallback_sdk
else
"/no-such-path"
}" /no-such-path \
--replace "$man" /no-such-path
''
+ lib.optionalString crossCompiling ''
mkdir -p $mini/lib/perl5/cross_perl/${version}
for dir in cnf/{stub,cpan}; do
cp -r $dir/* $mini/lib/perl5/cross_perl/${version}
done
mkdir -p $mini/bin
install -m755 miniperl $mini/bin/perl
export runtimeArch="$(ls $out/lib/perl5/site_perl/${version})"
# wrapProgram should use a runtime-native SHELL by default, but
# it actually uses a buildtime-native one. If we ever fix that,
# we'll need to fix this to use a buildtime-native one.
#
# Adding the arch-specific directory is morally incorrect, as
# miniperl can't load the native modules there. However, it can
# (and sometimes needs to) load and run some of the pure perl
# code there, so we add it anyway. When needed, stubs can be put
# into $mini/lib/perl5/cross_perl/${version}.
wrapProgram $mini/bin/perl --prefix PERL5LIB : \
"$mini/lib/perl5/cross_perl/${version}:$out/lib/perl5/${version}:$out/lib/perl5/${version}/$runtimeArch"
''; # */
meta = {
homepage = "https://www.perl.org/";
description = "Standard implementation of the Perl 5 programming language";
license = lib.licenses.artistic1;
maintainers = [ ];
teams = [ lib.teams.perl ];
platforms = lib.platforms.all;
priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl`
mainProgram = "perl";
};
}
// lib.optionalAttrs crossCompiling rec {
crossVersion = "1.6.2";
perl-cross-src = fetchFromGitHub {
name = "perl-cross-${crossVersion}";
owner = "arsv";
repo = "perl-cross";
rev = crossVersion;
hash = "sha256-mG9ny+eXGBL4K/rXqEUPSbar+4Mq4IaQrGRFIHIyAAw=";
};
# Patches are above!!!
depsBuildBuild = [
buildPackages.stdenv.cc
makeWrapper
];
postUnpack = ''
unpackFile ${perl-cross-src}
chmod -R u+w ${perl-cross-src.name}
cp -R ${perl-cross-src.name}/* perl-${version}/
'';
configurePlatforms = [
"build"
"host"
"target"
];
# TODO merge setup hooks
setupHook = ./setup-hook-cross.sh;
}
)

View File

@@ -0,0 +1,24 @@
$NetBSD: patch-hints_solaris__2.sh,v 1.2 2015/10/27 09:10:44 jperkin Exp $
Redo PR pkg/44999.
--- perl-5.20.2/hints/solaris_2.sh.orig 2015-05-13 20:19:29.000000000 +0000
+++ perl-5.20.2/hints/solaris_2.sh
@@ -585,7 +585,7 @@ EOM
fi
fi
case "${cc:-cc} -v 2>/dev/null" in
- *gcc*)
+ *gcc*|clang*)
echo 'int main() { return 0; }' > try.c
case "`${cc:-cc} $ccflags -mcpu=v9 -m64 -S try.c 2>&1 | grep 'm64 is not supported by this configuration'`" in
*"m64 is not supported"*)
@@ -622,7 +622,7 @@ EOM
# use that with Solaris 11 and later, but keep
# the old behavior for older Solaris versions.
case "$osvers" in
- 2.?|2.10) lddlflags="$lddlflags -G -m64" ;;
+ 2.?|2.10) lddlflags="$lddlflags -shared -m64" ;;
*) lddlflags="$lddlflags -shared -m64" ;;
esac
;;

View File

@@ -0,0 +1,256 @@
diff --git a/Configure b/Configure
index e261cb9548..3bbbc4b9df 100755
--- a/Configure
+++ b/Configure
@@ -108,15 +108,7 @@ if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; th
fi
: Proper PATH setting
-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
-paths="$paths /sbin /usr/sbin /usr/libexec"
-paths="$paths /system/gnu_library/bin"
+paths=''
for p in $paths
do
@@ -1455,8 +1447,7 @@ groupstype=''
i_whoami=''
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
+locincpth=""
:
: no include file wanted by default
inclwanted=''
@@ -1470,17 +1461,12 @@ DEBUGGING=''
archobjs=''
libnames=''
: change the next line if compiling for Xenix/286 on Xenix/386
-xlibpth='/usr/lib/386 /lib/386'
+xlibpth=''
: Possible local library directories to search.
-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
+loclibpth=""
: general looking path for locating libraries
-glibpth="/lib /usr/lib $xlibpth"
-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
-test -f /shlib/libc.so && glibpth="/shlib $glibpth"
-test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
+glibpth=""
: Private path used by Configure to find libraries. Its value
: is prepended to libpth. This variable takes care of special
@@ -1515,8 +1501,6 @@ libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
: We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
-glibpth="/usr/shlib $glibpth"
: Do not use vfork unless overridden by a hint file.
usevfork=false
@@ -2581,7 +2565,6 @@ uname
zip
"
pth=`echo $PATH | sed -e "s/$p_/ /g"`
-pth="$pth $sysroot/lib $sysroot/usr/lib"
for file in $loclist; do
eval xxx=\$$file
case "$xxx" in
@@ -5023,7 +5006,7 @@ esac
: Set private lib path
case "$plibpth" in
'') if ./mips; then
- plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
+ plibpth="$incpath/usr/lib"
fi;;
esac
case "$libpth" in
@@ -8860,13 +8843,8 @@ esac
echo " "
case "$sysman" in
'')
- syspath='/usr/share/man/man1 /usr/man/man1'
- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
- syspath="$syspath /usr/man/u_man/man1"
- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
- sysman=`./loc . /usr/man/man1 $syspath`
+ syspath=''
+ sysman=''
;;
esac
if $test -d "$sysman"; then
@@ -21500,9 +21478,10 @@ $rm_try tryp
case "$full_ar" in
'') full_ar=$ar ;;
esac
+full_ar=ar
: Store the full pathname to the sed program for use in the C program
-full_sed=$sed
+full_sed=sed
: see what type gids are declared as in the kernel
echo " "
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index ae647d5f06..9a05d66592 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -135,12 +135,7 @@ sub get_files {
if ($dep =~ /(\S+errno\.h)/) {
push(@file, $1);
}
- } elsif ($^O eq 'linux' &&
- $Config{gccversion} ne '' &&
- $Config{gccversion} !~ /intel/i &&
- # might be using, say, Intel's icc
- $linux_errno_h
- ) {
+ } elsif (0) {
push(@file, $linux_errno_h);
} elsif ($^O eq 'haiku') {
# hidden in a special place
diff --git a/hints/freebsd.sh b/hints/freebsd.sh
index 4d26835e99..c6d365d84d 100644
--- a/hints/freebsd.sh
+++ b/hints/freebsd.sh
@@ -127,21 +127,21 @@ case "$osvers" in
objformat=`/usr/bin/objformat`
if [ x$objformat = xaout ]; then
if [ -e /usr/lib/aout ]; then
- libpth="/usr/lib/aout /usr/local/lib /usr/lib"
- glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
+ libpth=""
+ glibpth=""
fi
lddlflags='-Bshareable'
else
- libpth="/usr/lib /usr/local/lib"
- glibpth="/usr/lib /usr/local/lib"
+ libpth=""
+ glibpth=""
ldflags="-Wl,-E "
lddlflags="-shared "
fi
cccdlflags='-DPIC -fPIC'
;;
*)
- libpth="/usr/lib /usr/local/lib"
- glibpth="/usr/lib /usr/local/lib"
+ libpth=""
+ glibpth=""
ldflags="-Wl,-E "
lddlflags="-shared "
cccdlflags='-DPIC -fPIC'
diff --git a/hints/linux.sh b/hints/linux.sh
index e1508c7509..5a187c583a 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -150,28 +150,6 @@ case "$optimize" in
;;
esac
-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
-# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
-# where to look. We don't want gcc's own libraries, however, so we
-# filter those out.
-# This could be conditional on Ubuntu, but other distributions may
-# follow suit, and this scheme seems to work even on rather old gcc's.
-# This unconditionally uses gcc because even if the user is using another
-# compiler, we still need to find the math library and friends, and I don't
-# know how other compilers will cope with that situation.
-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
-# we don't want its libraries. So we try to prefer the system gcc
-# Still, as an escape hatch, allow Configure command line overrides to
-# plibpth to bypass this check.
-if [ -x /usr/bin/gcc ] ; then
- gcc=/usr/bin/gcc
-# clang also provides -print-search-dirs
-elif ${cc:-cc} --version 2>/dev/null | grep -q '^clang ' ; then
- gcc=${cc:-cc}
-else
- gcc=gcc
-fi
-
case "$plibpth" in
'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
@@ -208,32 +186,6 @@ case "$usequadmath" in
;;
esac
-case "$libc" in
-'')
-# If you have glibc, then report the version for ./myconfig bug reporting.
-# (Configure doesn't need to know the specific version since it just uses
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
- for p in $plibpth
- do
- for trylib in libc.so.6 libc.so
- do
- if $test -e $p/$trylib; then
- libc=`ls -l $p/$trylib | awk '{print $NF}'`
- if $test "X$libc" != X; then
- break
- fi
- fi
- done
- if $test "X$libc" != X; then
- break
- fi
- done
- ;;
-esac
-
if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
@@ -311,33 +263,6 @@ sparc*)
;;
esac
-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
-# true libraries. The scripts cause binding against static
-# version of -lgdbm which is a bad idea. So if we have 'nm'
-# make sure it can read the file
-# NI-S 2003/08/07
-case "$nm" in
- '') ;;
- *)
- for p in $plibpth
- do
- if $test -r $p/libndbm.so; then
- if $nm $p/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- _libndbm_real=1
- break
- fi
- fi
- done
- if $test "X$_libndbm_real" = X; then
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
- ;;
-esac
-
# Linux on Synology.
if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
# Tested on Synology DS213 and DS413

View File

@@ -0,0 +1,237 @@
diff --git a/Configure b/Configure
index 4da7088bff..1a86e0a77d 100755
--- a/Configure
+++ b/Configure
@@ -108,15 +108,7 @@ if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; th
fi
: Proper PATH setting
-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
-paths="$paths /sbin /usr/sbin /usr/libexec"
-paths="$paths /system/gnu_library/bin"
+paths=''
for p in $paths
do
@@ -1459,8 +1451,7 @@ groupstype=''
i_whoami=''
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
+locincpth=""
:
: no include file wanted by default
inclwanted=''
@@ -1474,19 +1465,12 @@ DEBUGGING=''
archobjs=''
libnames=''
: change the next line if compiling for Xenix/286 on Xenix/386
-xlibpth='/usr/lib/386 /lib/386'
+xlibpth=''
: Possible local library directories to search.
-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
+loclibpth=""
: general looking path for locating libraries
-glibpth="/lib /usr/lib $xlibpth"
-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
-test -f /shlib/libc.so && glibpth="/shlib $glibpth"
-test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
-
-: Private path used by Configure to find libraries. Its value
+glibpth=""
: is prepended to libpth. This variable takes care of special
: machines, like the mips. Usually, it should be empty.
plibpth=''
@@ -1519,8 +1503,6 @@ libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
: We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
-glibpth="/usr/shlib $glibpth"
: Do not use vfork unless overridden by a hint file.
usevfork=false
@@ -2585,7 +2567,6 @@ uname
zip
"
pth=`echo $PATH | sed -e "s/$p_/ /g"`
-pth="$pth $sysroot/lib $sysroot/usr/lib"
for file in $loclist; do
eval xxx=\$$file
case "$xxx" in
@@ -5032,7 +5013,7 @@ esac
: Set private lib path
case "$plibpth" in
'') if ./mips; then
- plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
+ plibpth="$incpath/usr/lib"
fi;;
esac
case "$libpth" in
@@ -8869,13 +8850,8 @@ esac
echo " "
case "$sysman" in
'')
- syspath='/usr/share/man/man1 /usr/man/man1'
- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
- syspath="$syspath /usr/man/u_man/man1"
- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
- sysman=`./loc . /usr/man/man1 $syspath`
+ syspath=''
+ sysman=''
;;
esac
if $test -d "$sysman"; then
@@ -21740,9 +21716,10 @@ $rm_try tryp
case "$full_ar" in
'') full_ar=$ar ;;
esac
+full_ar=ar
: Store the full pathname to the sed program for use in the C program
-full_sed=$sed
+full_sed=sed
: see what type gids are declared as in the kernel
echo " "
diff --git a/hints/freebsd.sh b/hints/freebsd.sh
index 70bb90ee95..6580219c17 100644
--- a/hints/freebsd.sh
+++ b/hints/freebsd.sh
@@ -127,21 +127,21 @@ case "$osvers" in
objformat=`/usr/bin/objformat`
if [ x$objformat = xaout ]; then
if [ -e /usr/lib/aout ]; then
- libpth="/usr/lib/aout /usr/local/lib /usr/lib"
- glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
+ libpth=""
+ glibpth=""
fi
lddlflags='-Bshareable'
else
- libpth="/usr/lib /usr/local/lib"
- glibpth="/usr/lib /usr/local/lib"
+ libpth=""
+ glibpth=""
ldflags="-Wl,-E "
lddlflags="-shared "
fi
cccdlflags='-DPIC -fPIC'
;;
*)
- libpth="/usr/lib /usr/local/lib"
- glibpth="/usr/lib /usr/local/lib"
+ libpth=""
+ glibpth=""
ldflags="-Wl,-E "
lddlflags="-shared "
cccdlflags='-DPIC -fPIC'
diff --git a/hints/linux.sh b/hints/linux.sh
index 83ba0c5c97..d7b6ce04fe 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -176,27 +176,6 @@ case "$optimize" in
;;
esac
-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
-# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
-# where to look. We don't want gcc's own libraries, however, so we
-# filter those out.
-# This could be conditional on Ubuntu, but other distributions may
-# follow suit, and this scheme seems to work even on rather old gcc's.
-# This unconditionally uses gcc because even if the user is using another
-# compiler, we still need to find the math library and friends, and I don't
-# know how other compilers will cope with that situation.
-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
-# we don't want its libraries. So we try to prefer the system gcc
-# Still, as an escape hatch, allow Configure command line overrides to
-# plibpth to bypass this check.
-if [ -x /usr/bin/gcc ] ; then
- gcc=/usr/bin/gcc
-# clang also provides -print-search-dirs
-elif ${cc:-cc} --version 2>/dev/null | grep -q -e '^clang version' -e ' clang version'; then
- gcc=${cc:-cc}
-else
- gcc=gcc
-fi
case "$plibpth" in
'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
@@ -234,31 +213,6 @@ case "$usequadmath" in
;;
esac
-case "$libc" in
-'')
-# If you have glibc, then report the version for ./myconfig bug reporting.
-# (Configure doesn't need to know the specific version since it just uses
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
- for p in $plibpth
- do
- for trylib in libc.so.6 libc.so
- do
- if $test -e $p/$trylib; then
- libc=`ls -l $p/$trylib | awk '{print $NF}'`
- if $test "X$libc" != X; then
- break
- fi
- fi
- done
- if $test "X$libc" != X; then
- break
- fi
- done
- ;;
-esac
if ${sh:-/bin/sh} -c exit; then
echo ''
@@ -337,32 +291,6 @@ sparc*)
;;
esac
-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
-# true libraries. The scripts cause binding against static
-# version of -lgdbm which is a bad idea. So if we have 'nm'
-# make sure it can read the file
-# NI-S 2003/08/07
-case "$nm" in
- '') ;;
- *)
- for p in $plibpth
- do
- if $test -r $p/libndbm.so; then
- if $nm $p/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- _libndbm_real=1
- break
- fi
- fi
- done
- if $test "X$_libndbm_real" = X; then
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
- ;;
-esac
# Linux on Synology.
if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then

View File

@@ -0,0 +1,12 @@
addPerlLibPath () {
addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@
addToSearchPath PERL5LIB $1/lib/perl5/site_perl/cross_perl/@version@
# Adding the arch-specific directory is morally incorrect, as
# miniperl can't load the native modules there. However, it can
# (and sometimes needs to) load and run some of the pure perl
# code there, so we add it anyway. When needed, stubs can be put
# into $1/lib/perl5/site_perl/cross_perl/@version@
addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@/@runtimeArch@
}
addEnvHooks "$hostOffset" addPerlLibPath

View File

@@ -0,0 +1,5 @@
addPerlLibPath () {
addToSearchPath PERL5LIB $1/lib/perl5/site_perl
}
addEnvHooks "$hostOffset" addPerlLibPath

View File

@@ -0,0 +1,13 @@
diff --git a/hints/darwin.sh b/hints/darwin.sh
index afadf53..80b7533 100644
--- a/hints/darwin.sh
+++ b/hints/darwin.sh
@@ -329,7 +329,7 @@ EOM
# sw_vers output what we want
# "ProductVersion: 10.10.5" "10.10"
# "ProductVersion: 10.11" "10.11"
- prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'`
+ prodvers="${MACOSX_DEPLOYMENT_TARGET:-10.12}"
case "$prodvers" in
10.*)
add_macosx_version_min ccflags $prodvers

View File

@@ -0,0 +1,67 @@
{
lib,
perl,
buildEnv,
makeBinaryWrapper,
stdenv,
extraLibs ? [ ],
extraOutputsToInstall ? [ ],
postBuild ? "",
ignoreCollisions ? false,
requiredPerlModules,
}:
# Create a perl executable that knows about additional packages.
let
env =
let
paths = requiredPerlModules (extraLibs ++ [ perl ]);
in
buildEnv {
name = "${perl.name}-env";
inherit paths;
inherit ignoreCollisions;
extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall;
# TODO: remove stdenv.cc as soon as it is added to propagatedNativeBuildInputs of makeBinaryWrapper
nativeBuildInputs = [
makeBinaryWrapper
stdenv.cc
];
# we create wrapper for the binaries in the different packages
postBuild = ''
if [ -L "$out/bin" ]; then
unlink "$out/bin"
fi
mkdir -p "$out/bin"
# take every binary from perl packages and put them into the env
for path in ${lib.concatStringsSep " " paths}; do
if [ -d "$path/bin" ]; then
cd "$path/bin"
for prg in *; do
if [ -f "$prg" ]; then
rm -f "$out/bin/$prg"
if [ -x "$prg" ]; then
makeWrapper "$path/bin/$prg" "$out/bin/$prg" --suffix PERL5LIB ':' "$out/${perl.libPrefix}"
fi
fi
done
fi
done
''
+ postBuild;
meta = perl.meta // {
outputsToInstall = [ "out" ];
}; # remove "man" from meta.outputsToInstall. pkgs.buildEnv produces no "man", it puts everything to "out"
passthru = perl.passthru // {
interpreter = "${env}/bin/perl";
inherit perl;
};
};
in
env