perl: fix build errors on macOSlilik-openwrt-22.03
@ -0,0 +1,29 @@ | |||
--- a/hints/darwin.sh | |||
+++ b/hints/darwin.sh | |||
@@ -301,7 +301,7 @@ case "$osvers" in # Note: osvers is the | |||
# We now use MACOSX_DEPLOYMENT_TARGET, if set, as an override by | |||
# capturing its value and adding it to the flags. | |||
case "$MACOSX_DEPLOYMENT_TARGET" in | |||
- 10.*) | |||
+ [1-9][0-9].*) | |||
add_macosx_version_min ccflags $MACOSX_DEPLOYMENT_TARGET | |||
add_macosx_version_min ldflags $MACOSX_DEPLOYMENT_TARGET | |||
;; | |||
@@ -313,7 +313,7 @@ case "$osvers" in # Note: osvers is the | |||
*** Unexpected MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET | |||
*** | |||
-*** Please either set it to 10.something, or to empty. | |||
+*** Please either set it to a valid macOS version number (e.g., 10.15) or to empty. | |||
EOM | |||
exit 1 | |||
@@ -327,7 +327,7 @@ EOM | |||
# "ProductVersion: 10.11" "10.11" | |||
prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'` | |||
case "$prodvers" in | |||
- 10.*) | |||
+ [1-9][0-9].*) | |||
add_macosx_version_min ccflags $prodvers | |||
add_macosx_version_min ldflags $prodvers | |||
;; |
@ -0,0 +1,85 @@ | |||
From 15f67d146cf1f32504e8a11de3faa2abc0f467cd Mon Sep 17 00:00:00 2001 | |||
From: Tony Cook <tony@develop-help.com> | |||
Date: Mon, 25 Mar 2019 16:48:40 +1100 | |||
Subject: [PATCH] (perl #133951) add Internals::getcwd | |||
--- | |||
MANIFEST | 1 + | |||
t/io/getcwd.t | 22 ++++++++++++++++++++++ | |||
universal.c | 22 ++++++++++++++++++++++ | |||
3 files changed, 45 insertions(+) | |||
create mode 100644 t/io/getcwd.t | |||
--- a/MANIFEST | |||
+++ b/MANIFEST | |||
@@ -5456,6 +5456,7 @@ t/io/errno.t See if $! is correctly se | |||
t/io/errnosig.t Test case for restoration $! when leaving signal handlers | |||
t/io/fflush.t See if auto-flush on fork/exec/system/qx works | |||
t/io/fs.t See if directory manipulations work | |||
+t/io/getcwd.t See if Internals::getcwd is sane | |||
t/io/inplace.t See if inplace editing works | |||
t/io/iofile.t See if we can load IO::File on demand | |||
t/io/iprefix.t See if inplace editing works with prefixes | |||
--- /dev/null | |||
+++ b/t/io/getcwd.t | |||
@@ -0,0 +1,22 @@ | |||
+#!./perl -w | |||
+ | |||
+BEGIN { | |||
+ chdir 't' if -d 't'; | |||
+ require "./test.pl"; | |||
+ set_up_inc('../lib'); | |||
+} | |||
+ | |||
+use Config; | |||
+ | |||
+$Config{d_getcwd} | |||
+ or plan skip_all => "no getcwd"; | |||
+ | |||
+my $cwd = Internals::getcwd(); | |||
+ok(!defined $cwd || $cwd ne "", | |||
+ "Internals::getcwd() returned a reasonable result"); | |||
+ | |||
+if (defined $cwd) { | |||
+ ok(-d $cwd, "check a success result is a directory"); | |||
+} | |||
+ | |||
+done_testing(); | |||
--- a/universal.c | |||
+++ b/universal.c | |||
@@ -986,6 +986,25 @@ XS(XS_re_regexp_pattern) | |||
NOT_REACHED; /* NOTREACHED */ | |||
} | |||
+#ifdef HAS_GETCWD | |||
+ | |||
+XS(XS_Internals_getcwd) | |||
+{ | |||
+ dXSARGS; | |||
+ SV *sv = sv_newmortal(); | |||
+ | |||
+ if (items != 0) | |||
+ croak_xs_usage(cv, ""); | |||
+ | |||
+ (void)getcwd_sv(sv); | |||
+ | |||
+ SvTAINTED_on(sv); | |||
+ PUSHs(sv); | |||
+ XSRETURN(1); | |||
+} | |||
+ | |||
+#endif | |||
+ | |||
#include "vutil.h" | |||
#include "vxs.inc" | |||
@@ -1020,6 +1039,9 @@ static const struct xsub_details details | |||
{"re::regnames", XS_re_regnames, ";$"}, | |||
{"re::regnames_count", XS_re_regnames_count, ""}, | |||
{"re::regexp_pattern", XS_re_regexp_pattern, "$"}, | |||
+#ifdef HAS_GETCWD | |||
+ {"Internals::getcwd", XS_Internals_getcwd, ""}, | |||
+#endif | |||
}; | |||
STATIC OP* |
@ -0,0 +1,40 @@ | |||
--- a/dist/PathTools/Cwd.pm | |||
+++ b/dist/PathTools/Cwd.pm | |||
@@ -659,6 +659,10 @@ if (exists $METHOD_MAP{$^O}) { | |||
} | |||
} | |||
+# built-in from 5.30 | |||
+*getcwd = \&Internals::getcwd | |||
+ if !defined &getcwd && defined &Internals::getcwd; | |||
+ | |||
# In case the XS version doesn't load. | |||
*abs_path = \&_perl_abs_path unless defined &abs_path; | |||
*getcwd = \&_perl_getcwd unless defined &getcwd; | |||
--- a/dist/PathTools/t/cwd.t | |||
+++ b/dist/PathTools/t/cwd.t | |||
@@ -10,6 +10,7 @@ chdir 't'; | |||
use Config; | |||
use File::Spec; | |||
use File::Path; | |||
+use Errno qw(EACCES); | |||
use lib File::Spec->catdir('t', 'lib'); | |||
use Test::More; | |||
@@ -208,7 +209,15 @@ SKIP: { | |||
like($abs_path, qr|$want$|i, "Cwd::abs_path produced $abs_path"); | |||
like($fast_abs_path, qr|$want$|i, "Cwd::fast_abs_path produced $fast_abs_path"); | |||
- like($pas, qr|$want$|i, "Cwd::_perl_abs_path produced $pas") if $EXTRA_ABSPATH_TESTS; | |||
+ if ($EXTRA_ABSPATH_TESTS) { | |||
+ # _perl_abs_path() can fail if some ancestor directory isn't readable | |||
+ if (defined $pas) { | |||
+ like($pas, qr|$want$|i, "Cwd::_perl_abs_path produced $pas"); | |||
+ } | |||
+ else { | |||
+ is($!+0, EACCES, "check we got the expected error on failure"); | |||
+ } | |||
+ } | |||
rmtree($test_dirs[0], 0, 0); | |||
1 while unlink $file; |