summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/debian/configure-regen.diff32
-rw-r--r--debian/patches/debian/cpan-missing-site-dirs.diff60
-rw-r--r--debian/patches/debian/cpan_definstalldirs.diff34
-rw-r--r--debian/patches/debian/db_file_ver.diff31
-rw-r--r--debian/patches/debian/deprecate-with-apt.diff47
-rw-r--r--debian/patches/debian/disable-stack-check.diff62
-rw-r--r--debian/patches/debian/doc_info.diff33
-rw-r--r--debian/patches/debian/enc2xs_inc.diff67
-rw-r--r--debian/patches/debian/errno_ver.diff41
-rw-r--r--debian/patches/debian/extutils_set_libperl_path.diff23
-rw-r--r--debian/patches/debian/fakeroot.diff39
-rw-r--r--debian/patches/debian/find_html2text.diff33
-rw-r--r--debian/patches/debian/hppa_op_optimize_workaround.diff32
-rw-r--r--debian/patches/debian/hppa_opmini_optimize_workaround.diff26
-rw-r--r--debian/patches/debian/hurd-softupdates.diff24
-rw-r--r--debian/patches/debian/installman-utf8.diff26
-rw-r--r--debian/patches/debian/instmodsh_doc.diff25
-rw-r--r--debian/patches/debian/kfreebsd-softupdates.diff27
-rw-r--r--debian/patches/debian/ld_run_path.diff21
-rw-r--r--debian/patches/debian/libnet_config_path.diff35
-rw-r--r--debian/patches/debian/libperl_embed_doc.diff23
-rw-r--r--debian/patches/debian/makemaker-manext.diff29
-rw-r--r--debian/patches/debian/makemaker-pasthru.diff28
-rw-r--r--debian/patches/debian/mod_paths.diff98
-rw-r--r--debian/patches/debian/no_packlist_perllocal.diff90
-rw-r--r--debian/patches/debian/patchlevel.diff27
-rw-r--r--debian/patches/debian/perl5db-x-terminal-emulator.patch26
-rw-r--r--debian/patches/debian/perlbug-editor.diff22
-rw-r--r--debian/patches/debian/perldoc-pager.diff26
-rw-r--r--debian/patches/debian/perlivp.diff36
-rw-r--r--debian/patches/debian/prune_libs.diff42
-rw-r--r--debian/patches/debian/sh4_op_optimize_workaround.diff29
-rw-r--r--debian/patches/debian/squelch-locale-warnings.diff51
-rw-r--r--debian/patches/debian/writable_site_dirs.diff33
-rw-r--r--debian/patches/fixes/autodie-scope.diff97
-rw-r--r--debian/patches/fixes/cpan_web_link.diff24
-rw-r--r--debian/patches/fixes/document_makemaker_ccflags.diff28
-rw-r--r--debian/patches/fixes/eumm-usrmerge.diff122
-rw-r--r--debian/patches/fixes/getopt-long-4.diff28
-rw-r--r--debian/patches/fixes/gid-parsing.diff35
-rw-r--r--debian/patches/fixes/math_complex_doc_angle_units.diff26
-rw-r--r--debian/patches/fixes/math_complex_doc_great_circle.diff23
-rw-r--r--debian/patches/fixes/math_complex_doc_see_also.diff23
-rw-r--r--debian/patches/fixes/memoize-pod.diff32
-rw-r--r--debian/patches/fixes/memoize_storable_nstore.diff108
-rw-r--r--debian/patches/fixes/respect_umask.diff150
-rw-r--r--debian/patches/series46
47 files changed, 2020 insertions, 0 deletions
diff --git a/debian/patches/debian/configure-regen.diff b/debian/patches/debian/configure-regen.diff
new file mode 100644
index 0000000..b910221
--- /dev/null
+++ b/debian/patches/debian/configure-regen.diff
@@ -0,0 +1,32 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 14 Oct 2017 17:47:09 +0300
+Subject: Regenerate Configure et al. after probe unit changes
+
+Bug-Debian: https://bugs.debian.org/762638
+---
+ Configure | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/Configure b/Configure
+index 684a9c0..c83ca50 100755
+--- a/Configure
++++ b/Configure
+@@ -1487,8 +1487,7 @@ archname=''
+ usereentrant='undef'
+ : List of libraries we want.
+ : If anyone needs extra -lxxx, put those in a hint file.
+-libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
+-libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
++libswanted='gdbm gdbm_compat db dl m c crypt'
+ : 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 ! !'`
+@@ -23840,7 +23839,7 @@ sunos*X4*)
+ ;;
+ *) case "$usedl" in
+ $define|true|[yY]*)
+- set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
++ set X `echo " $libs " | sed -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldb @ @'`
+ shift
+ perllibs="$*"
+ ;;
diff --git a/debian/patches/debian/cpan-missing-site-dirs.diff b/debian/patches/debian/cpan-missing-site-dirs.diff
new file mode 100644
index 0000000..ec024c6
--- /dev/null
+++ b/debian/patches/debian/cpan-missing-site-dirs.diff
@@ -0,0 +1,60 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Tue, 16 Oct 2012 23:07:56 +0300
+Subject: Fix CPAN::FirstTime defaults with nonexisting site dirs if a parent
+ is writable
+
+The site directories do not exist on a typical Debian system. The build
+systems will create them when necessary, so there's no need for a prompt
+suggesting local::lib if the first existing parent directory is writable.
+
+Also, writability of the core directories is not interesting as we
+explicitly tell CPAN not to touch those with INSTALLDIRS=site.
+
+Bug-Debian: http://bugs.debian.org/688842
+---
+ cpan/CPAN/lib/CPAN/FirstTime.pm | 31 +++++++++++++++++++++++++++----
+ 1 file changed, 27 insertions(+), 4 deletions(-)
+
+diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm
+index cdf1dc2..bdb7899 100644
+--- a/cpan/CPAN/lib/CPAN/FirstTime.pm
++++ b/cpan/CPAN/lib/CPAN/FirstTime.pm
+@@ -2067,11 +2067,34 @@ sub _print_urllist {
+ };
+ }
+
++# Debian modification: return true if this directory
++# or the first existing one upwards is writable
++sub _can_write_to_this_or_parent {
++ my ($dir) = @_;
++ my @parts = File::Spec->splitdir($dir);
++ while (@parts) {
++ my $cur = File::Spec->catdir(@parts);
++ return 1 if -w $cur;
++ return 0 if -e _;
++ pop @parts;
++ }
++ return 0;
++}
++
++# Debian specific modification: the site directories don't necessarily
++# exist on the system, but the build systems create them when necessary,
++# so return true if the first existing directory upwards is writable
++#
++# Furthermore, on Debian, only test the site directories
++# (installsite*, expanded to /usr/local/{share,lib}/perl),
++# not the core ones
++# (install*lib, expanded to /usr/{share,lib}/perl).
++# We pass INSTALLDIRS=site by default to keep CPAN from touching
++# the core directories.
++
+ sub _can_write_to_libdirs {
+- return -w $Config{installprivlib}
+- && -w $Config{installarchlib}
+- && -w $Config{installsitelib}
+- && -w $Config{installsitearch}
++ return _can_write_to_this_or_parent($Config{installsitelib})
++ && _can_write_to_this_or_parent($Config{installsitearch})
+ }
+
+ sub _using_installbase {
diff --git a/debian/patches/debian/cpan_definstalldirs.diff b/debian/patches/debian/cpan_definstalldirs.diff
new file mode 100644
index 0000000..d6ce61a
--- /dev/null
+++ b/debian/patches/debian/cpan_definstalldirs.diff
@@ -0,0 +1,34 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Provide a sensible INSTALLDIRS default for modules installed from
+ CPAN.
+
+Some modules which are included in core set INSTALLDIRS => 'perl'
+explicitly in Makefile.PL or Build.PL. This makes sense for the normal @INC
+ordering, but not ours.
+---
+ cpan/CPAN/lib/CPAN/FirstTime.pm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm
+index 49fa8ab..cdf1dc2 100644
+--- a/cpan/CPAN/lib/CPAN/FirstTime.pm
++++ b/cpan/CPAN/lib/CPAN/FirstTime.pm
+@@ -1033,7 +1033,7 @@ sub init {
+ my_prompt_loop(prefer_installer => 'MB', $matcher, 'MB|EUMM|RAND');
+
+ if (!$matcher or 'makepl_arg make_arg' =~ /$matcher/) {
+- my_dflt_prompt(makepl_arg => "", $matcher);
++ my_dflt_prompt(makepl_arg => "INSTALLDIRS=site", $matcher);
+ my_dflt_prompt(make_arg => "", $matcher);
+ if ( $CPAN::Config->{makepl_arg} =~ /LIBS=|INC=/ ) {
+ $CPAN::Frontend->mywarn(
+@@ -1065,7 +1065,7 @@ sub init {
+ my_dflt_prompt(make_install_arg => $CPAN::Config->{make_arg} || "",
+ $matcher);
+
+- my_dflt_prompt(mbuildpl_arg => "", $matcher);
++ my_dflt_prompt(mbuildpl_arg => "--installdirs site", $matcher);
+ my_dflt_prompt(mbuild_arg => "", $matcher);
+
+ if (exists $CPAN::HandleConfig::keys{mbuild_install_build_command}
diff --git a/debian/patches/debian/db_file_ver.diff b/debian/patches/debian/db_file_ver.diff
new file mode 100644
index 0000000..4a1fd6c
--- /dev/null
+++ b/debian/patches/debian/db_file_ver.diff
@@ -0,0 +1,31 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 16 Dec 2005 01:32:14 +1100
+Subject: Remove overly restrictive DB_File version check.
+
+Bug-Debian: http://bugs.debian.org/340047
+
+Package dependencies ensure the correct library is linked at run-time.
+---
+ cpan/DB_File/version.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/cpan/DB_File/version.c b/cpan/DB_File/version.c
+index e01f6f6..544e6ee 100644
+--- a/cpan/DB_File/version.c
++++ b/cpan/DB_File/version.c
+@@ -48,6 +48,7 @@ __getBerkeleyDBInfo()
+
+ (void)db_version(&Major, &Minor, &Patch) ;
+
++#ifndef DEBIAN
+ /* Check that the versions of db.h and libdb.a are the same */
+ if (Major != DB_VERSION_MAJOR || Minor != DB_VERSION_MINOR )
+ /* || Patch != DB_VERSION_PATCH) */
+@@ -55,6 +56,7 @@ __getBerkeleyDBInfo()
+ croak("\nDB_File was build with libdb version %d.%d.%d,\nbut you are attempting to run it with libdb version %d.%d.%d\n",
+ DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
+ Major, Minor, Patch) ;
++#endif /* DEBIAN */
+
+ /* check that libdb is recent enough -- we need 2.3.4 or greater */
+ if (Major == 2 && (Minor < 3 || (Minor == 3 && Patch < 4)))
diff --git a/debian/patches/debian/deprecate-with-apt.diff b/debian/patches/debian/deprecate-with-apt.diff
new file mode 100644
index 0000000..4867d55
--- /dev/null
+++ b/debian/patches/debian/deprecate-with-apt.diff
@@ -0,0 +1,47 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Mon, 17 May 2010 13:23:07 +0300
+Subject: Point users to Debian packages of deprecated core modules
+
+Bug-Debian: http://bugs.debian.org/747628
+---
+ lib/deprecate.pm | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/lib/deprecate.pm b/lib/deprecate.pm
+index 995322c..057632d 100644
+--- a/lib/deprecate.pm
++++ b/lib/deprecate.pm
+@@ -7,6 +7,16 @@ our $VERSION = 0.04;
+ our %Config;
+ unless (%Config) { require Config; *Config = \%Config::Config; }
+
++# Debian-specific change: recommend the separate Debian packages of
++# deprecated modules where available
++
++our %DEBIAN_PACKAGES = (
++ 'B::Debug' => 'libb-debug-perl',
++ 'Locale::Codes' => 'liblocale-codes-perl',
++ 'Locale::Country' => 'liblocale-codes-perl',
++ 'Locale::Language' => 'liblocale-codes-perl',
++);
++
+ # This isn't a public API. It's internal to code maintained by the perl-porters
+ # If you would like it to be a public API, please send a patch with
+ # documentation and tests. Until then, it may change without warning.
+@@ -58,9 +68,15 @@ EOM
+ if (defined $callers_bitmask
+ && (vec($callers_bitmask, $warnings::Offsets{deprecated}, 1)
+ || vec($callers_bitmask, $warnings::Offsets{all}, 1))) {
+- warn <<"EOM";
++ if (my $deb = $DEBIAN_PACKAGES{$package}) {
++ warn <<"EOM";
++$package will be removed from the Perl core distribution in the next major release. Please install the separate $deb package. It is being used at $call_file, line $call_line.
++EOM
++ } else {
++ warn <<"EOM";
+ $package will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at $call_file, line $call_line.
+ EOM
++ }
+ }
+ }
+ }
diff --git a/debian/patches/debian/disable-stack-check.diff b/debian/patches/debian/disable-stack-check.diff
new file mode 100644
index 0000000..c5bd2f7
--- /dev/null
+++ b/debian/patches/debian/disable-stack-check.diff
@@ -0,0 +1,62 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Mon, 16 Jul 2018 10:12:37 +0300
+Subject: Disable debugperl stack extension checks for binary compatibility
+ with perl
+
+When an XS module is built without -DDEBUGGING but the interpreter is,
+the debugging stack high-water mark checking on the interpreter side
+doesn't work properly. This makes /usr/bin/debugperl less useful than
+it could be as it can no longer use many XS module packages.
+
+Patch the check away for now. We hope upstream will provide a Configure
+option for this in the future.
+
+Bug: https://rt.perl.org/Ticket/Display.html?id=133327
+Bug-Debian: https://bugs.debian.org/902779
+---
+ dump.c | 3 +++
+ pp_hot.c | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/dump.c b/dump.c
+index 9de1941..cf78366 100644
+--- a/dump.c
++++ b/dump.c
+@@ -2501,6 +2501,8 @@ Perl_runops_debug(pTHX)
+ ++PL_op_exec_cnt[PL_op->op_type];
+ #endif
+ #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY
++/* disabled on Debian due to https://bugs.debian.org/902779 */
++#ifndef DEBIAN
+ if (PL_curstackinfo->si_stack_hwm < PL_stack_sp - PL_stack_base)
+ Perl_croak_nocontext(
+ "panic: previous op failed to extend arg stack: "
+@@ -2508,6 +2510,7 @@ Perl_runops_debug(pTHX)
+ PL_stack_base, PL_stack_sp,
+ PL_stack_base + PL_curstackinfo->si_stack_hwm);
+ PL_curstackinfo->si_stack_hwm = PL_stack_sp - PL_stack_base;
++#endif
+ #endif
+ if (PL_debug) {
+ ENTER;
+diff --git a/pp_hot.c b/pp_hot.c
+index 7d5ffc0..7d15ca6 100644
+--- a/pp_hot.c
++++ b/pp_hot.c
+@@ -5237,6 +5237,8 @@ PP(pp_entersub)
+ CvXSUB(cv)(aTHX_ cv);
+
+ #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY
++/* disabled on Debian due to https://bugs.debian.org/902779 */
++#ifndef DEBIAN
+ /* This duplicates the check done in runops_debug(), but provides more
+ * information in the common case of the fault being with an XSUB.
+ *
+@@ -5250,6 +5252,7 @@ PP(pp_entersub)
+ HvNAME(GvSTASH(CvGV(cv))), GvNAME(CvGV(cv)), CvFILE(cv),
+ PL_stack_base, PL_stack_sp,
+ PL_stack_base + PL_curstackinfo->si_stack_hwm);
++#endif
+ #endif
+ /* Enforce some sanity in scalar context. */
+ if (is_scalar) {
diff --git a/debian/patches/debian/doc_info.diff b/debian/patches/debian/doc_info.diff
new file mode 100644
index 0000000..c003ffb
--- /dev/null
+++ b/debian/patches/debian/doc_info.diff
@@ -0,0 +1,33 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Replace generic man(1) instructions with Debian-specific
+ information.
+
+Indicate that the user needs to install the perl-doc package.
+---
+ pod/perl.pod | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/pod/perl.pod b/pod/perl.pod
+index 3f3fbe4..403e1aa 100644
+--- a/pod/perl.pod
++++ b/pod/perl.pod
+@@ -299,8 +299,16 @@ aux h2ph h2xs perlbug pl2pm pod2html pod2man splain xsubpp
+
+ =for buildtoc __END__
+
+-On a Unix-like system, these documentation files will usually also be
+-available as manpages for use with the F<man> program.
++On Debian systems, you need to install the B<perl-doc> package which
++contains the majority of the standard Perl documentation and the
++F<perldoc> program.
++
++Extensive additional documentation for Perl modules is available, both
++those distributed with Perl and third-party modules which are packaged
++or locally installed.
++
++You should be able to view Perl's documentation with your man(1)
++program or perldoc(1).
+
+ Some documentation is not available as man pages, so if a
+ cross-reference is not found by man, try it with L<perldoc>. Perldoc can
diff --git a/debian/patches/debian/enc2xs_inc.diff b/debian/patches/debian/enc2xs_inc.diff
new file mode 100644
index 0000000..0b2fc42
--- /dev/null
+++ b/debian/patches/debian/enc2xs_inc.diff
@@ -0,0 +1,67 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Tweak enc2xs to follow symlinks and ignore missing @INC directories.
+
+Bug-Debian: http://bugs.debian.org/290336
+
+- ignore missing directories,
+- follow symlinks (/usr/share/perl/5.8 -> 5.8.4).
+- filter "." out when running "enc2xs -C", it's unnecessary and causes
+ issues with follow => 1 (see #603686 and [rt.cpan.org #64585])
+---
+ cpan/Encode/bin/enc2xs | 8 ++++----
+ t/porting/customized.t | 3 +++
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/cpan/Encode/bin/enc2xs b/cpan/Encode/bin/enc2xs
+index 619b64b..050c863 100644
+--- a/cpan/Encode/bin/enc2xs
++++ b/cpan/Encode/bin/enc2xs
+@@ -1013,11 +1013,11 @@ use vars qw(
+ sub find_e2x{
+ eval { require File::Find; };
+ my (@inc, %e2x_dir);
+- for my $inc (@INC){
++ for my $inc (grep -d, @INC){
+ push @inc, $inc unless $inc eq '.'; #skip current dir
+ }
+ File::Find::find(
+- sub {
++ { wanted => sub {
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks)
+ = lstat($_) or return;
+@@ -1027,7 +1027,7 @@ sub find_e2x{
+ $e2x_dir{$File::Find::dir} ||= $mtime;
+ }
+ return;
+- }, @inc);
++ }, follow => 1}, @inc);
+ warn join("\n", keys %e2x_dir), "\n";
+ for my $d (sort {$e2x_dir{$a} <=> $e2x_dir{$b}} keys %e2x_dir){
+ $_E2X = $d;
+@@ -1091,7 +1091,7 @@ sub make_configlocal_pm {
+ $LocalMod{$enc} ||= $mod;
+ }
+ };
+- File::Find::find({wanted => $wanted}, @INC);
++ File::Find::find({wanted => $wanted, follow => 1}, grep -d && !/^\./, @INC);
+ $_ModLines = "";
+ for my $enc ( sort keys %LocalMod ) {
+ $_ModLines .=
+diff --git a/t/porting/customized.t b/t/porting/customized.t
+index d425e5b..d906a82 100644
+--- a/t/porting/customized.t
++++ b/t/porting/customized.t
+@@ -108,8 +108,11 @@ foreach my $module ( sort keys %Modules ) {
+ print $data_fh join(' ', $module, $file, $id), "\n";
+ next;
+ }
++SKIP: {
++ skip("$file modified for Debian", 1) if $file eq 'cpan/Encode/bin/enc2xs';
+ my $should_be = $customised{ $module }->{ $file };
+ is( $id, $should_be, "SHA for $file matches stashed SHA" );
++}
+ }
+ }
+
diff --git a/debian/patches/debian/errno_ver.diff b/debian/patches/debian/errno_ver.diff
new file mode 100644
index 0000000..71ce86d
--- /dev/null
+++ b/debian/patches/debian/errno_ver.diff
@@ -0,0 +1,41 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 16 Dec 2005 01:32:14 +1100
+Subject: Remove Errno version check due to upgrade problems with long-running
+ processes.
+
+Bug-Debian: http://bugs.debian.org/343351
+
+Remove version check which can cause problems for long running
+processes embedding perl when upgrading to a newer version,
+compatible, but built on a different machine.
+---
+ ext/Errno/Errno_pm.PL | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 84fd151..9d1454c 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -292,22 +292,6 @@ package Errno;
+ require Exporter;
+ use strict;
+
+-EDQ
+-
+- # Errno only needs Config to make sure it hasn't changed platforms.
+- # If someone set $ENV{PERL_BUILD_EXPAND_CONFIG_VARS} at build time,
+- # they've already declared perl doesn't need to worry about this risk.
+- if(!$ENV{'PERL_BUILD_EXPAND_CONFIG_VARS'}) {
+- print <<"CONFIG_CHECK_END";
+-use Config;
+-"\$Config{'archname'}-\$Config{'osvers'}" eq
+-"$archname-$Config{'osvers'}" or
+- die "Errno architecture ($archname-$Config{'osvers'}) does not match executable architecture (\$Config{'archname'}-\$Config{'osvers'})";
+-
+-CONFIG_CHECK_END
+-}
+-
+- print <<"EDQ";
+ our \$VERSION = "$VERSION";
+ \$VERSION = eval \$VERSION;
+ our \@ISA = 'Exporter';
diff --git a/debian/patches/debian/extutils_set_libperl_path.diff b/debian/patches/debian/extutils_set_libperl_path.diff
new file mode 100644
index 0000000..006d6fd
--- /dev/null
+++ b/debian/patches/debian/extutils_set_libperl_path.diff
@@ -0,0 +1,23 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 10 May 2014 23:34:14 +0300
+Subject: EU:MM: set location of libperl.a under /usr/lib
+
+The Debian packaging moves libperl.a a couple of levels up from the
+CORE directory to match other static libraries.
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index dbb8651..780e390 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2564,7 +2564,7 @@ MAP_PRELIBS = $Config{perllibs} $Config{cryptlib}
+ ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
+ }
+ unless ($libperl && -f $lperl) { # Ilya's code...
+- my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
++ my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/../..";
+ $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL};
+ $libperl ||= "libperl$self->{LIB_EXT}";
+ $libperl = "$dir/$libperl";
diff --git a/debian/patches/debian/fakeroot.diff b/debian/patches/debian/fakeroot.diff
new file mode 100644
index 0000000..01cfd11
--- /dev/null
+++ b/debian/patches/debian/fakeroot.diff
@@ -0,0 +1,39 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Postpone LD_LIBRARY_PATH evaluation to the binary targets.
+
+Modify the setting of LD_LIBRARY_PATH to append pre-existing values at the
+time the rule is evaluated rather than when the Makefile is created.
+
+This is required when building packages with dpkg-buildpackage and fakeroot,
+since fakeroot (which now sets LD_LIBRARY_PATH) is not used for the "build"
+rule where the Makefile is created, but is for the clean/binary* targets.
+---
+ Makefile.SH | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile.SH b/Makefile.SH
+index 5777970..f8adb85 100755
+--- a/Makefile.SH
++++ b/Makefile.SH
+@@ -48,10 +48,7 @@ case "$useshrplib" in
+ true)
+ # Prefix all runs of 'miniperl' and 'perl' with
+ # $ldlibpth so that ./perl finds *this* shared libperl.
+- case "$LD_LIBRARY_PATH" in
+- '') ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `" ;;
+- *) ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `:` quote "$LD_LIBRARY_PATH" `" ;;
+- esac
++ ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `"'$${LD_LIBRARY_PATH:+:}$$LD_LIBRARY_PATH'
+
+ pldlflags="$cccdlflags"
+ static_ldflags=''
+@@ -130,7 +127,7 @@ true)
+ ;;
+ esac
+ case "$ldlibpthname" in
+- '') ;;
++ ''|LD_LIBRARY_PATH) ;;
+ *)
+ case "$osname" in
+ os2)
diff --git a/debian/patches/debian/find_html2text.diff b/debian/patches/debian/find_html2text.diff
new file mode 100644
index 0000000..cc87c43
--- /dev/null
+++ b/debian/patches/debian/find_html2text.diff
@@ -0,0 +1,33 @@
+From: Andreas Marschke <andreas.marschke@googlemail.com>
+Date: Sat, 17 Sep 2011 11:38:42 +0100
+Subject: Configure CPAN::Distribution with correct name of html2text
+
+Bug-Debian: http://bugs.debian.org/640479
+
+If you use cpan from Debian you usually wind up trying to read online
+documentation through it. Unfortunately cpan can't find the
+html2text.pl script even though it is installed using the Debian
+package 'html2text'.
+
+Please see the attached patch for a quick fix of this issue.
+
+[Maintainer's note: html2text in Debian is not the same implementation
+as the html2text.pl which is expected, but should provide similar
+functionality].
+---
+ cpan/CPAN/lib/CPAN/Distribution.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/CPAN/lib/CPAN/Distribution.pm b/cpan/CPAN/lib/CPAN/Distribution.pm
+index 717c9aa..6342955 100644
+--- a/cpan/CPAN/lib/CPAN/Distribution.pm
++++ b/cpan/CPAN/lib/CPAN/Distribution.pm
+@@ -4187,7 +4187,7 @@ sub _display_url {
+ if $CPAN::DEBUG;
+
+ # should we define it in the config instead?
+- my $html_converter = "html2text.pl";
++ my $html_converter = "html2text";
+
+ my $web_browser = $CPAN::Config->{'lynx'} || undef;
+ my $web_browser_out = $web_browser
diff --git a/debian/patches/debian/hppa_op_optimize_workaround.diff b/debian/patches/debian/hppa_op_optimize_workaround.diff
new file mode 100644
index 0000000..518a6a1
--- /dev/null
+++ b/debian/patches/debian/hppa_op_optimize_workaround.diff
@@ -0,0 +1,32 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 25 Sep 2016 09:59:22 +0200
+Subject: Temporarily lower the optimization of op.c on hppa due to gcc-6
+ problems
+
+This fixes a crash in ext/XS-APItest/t/customop.t
+
+It's currently unclear if the problem is with the code or the
+gcc-6 optimizer.
+
+Bug-Debian: https://bugs.debian.org/838613
+---
+ cflags.SH | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/cflags.SH b/cflags.SH
+index e60742f..3e4526f 100755
+--- a/cflags.SH
++++ b/cflags.SH
+@@ -497,6 +497,12 @@ for file do
+ # or customize here
+
+ case "$file" in
++ op) : work around http://bugs.debian.org/838613
++ case $archname in
++ hppa-*)
++ optimize="$optimize -O0";;
++ esac;;
++
+ regcomp) : work around http://bugs.debian.org/754054
+ case $archname in
+ mips-*|mipsel-*)
diff --git a/debian/patches/debian/hppa_opmini_optimize_workaround.diff b/debian/patches/debian/hppa_opmini_optimize_workaround.diff
new file mode 100644
index 0000000..8e0efb7
--- /dev/null
+++ b/debian/patches/debian/hppa_opmini_optimize_workaround.diff
@@ -0,0 +1,26 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 29 Jul 2017 23:30:20 +0300
+Subject: Lower the optimization level of opmini.c on hppa
+
+This further amends debian/hppa_op_optimize_workaround.diff to affect
+miniperl too.
+
+Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538
+Bug-Debian: https://bugs.debian.org/869122
+---
+ cflags.SH | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cflags.SH b/cflags.SH
+index 3e4526f..c8231e6 100755
+--- a/cflags.SH
++++ b/cflags.SH
+@@ -497,7 +497,7 @@ for file do
+ # or customize here
+
+ case "$file" in
+- op) : work around http://bugs.debian.org/838613
++ op|opmini) : work around http://bugs.debian.org/838613 and 869122
+ case $archname in
+ hppa-*)
+ optimize="$optimize -O0";;
diff --git a/debian/patches/debian/hurd-softupdates.diff b/debian/patches/debian/hurd-softupdates.diff
new file mode 100644
index 0000000..b13cd57
--- /dev/null
+++ b/debian/patches/debian/hurd-softupdates.diff
@@ -0,0 +1,24 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Thu, 28 Apr 2016 16:31:39 +0300
+Subject: Fix t/op/stat.t failures on hurd
+
+We already do this on GNU/kFreeBSD, and GNU/Hurd seems to need same
+treatment.
+
+Bug-Debian: https://bugs.debian.org/822735
+---
+ t/op/stat.t | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/t/op/stat.t b/t/op/stat.t
+index 2e75fec..19a6615 100644
+--- a/t/op/stat.t
++++ b/t/op/stat.t
+@@ -102,6 +102,7 @@ print FOO "Now is the time for all good men to come to.\n";
+ close(FOO);
+
+ stat($tmpfile) if $^O =~ /^gnukfreebsd/; # Work around Debian Bug#796798
++stat($tmpfile) if $^O eq 'gnu'; # Work around Debian Bug#822735
+ sleep 2;
+
+ my $has_link = 1;
diff --git a/debian/patches/debian/installman-utf8.diff b/debian/patches/debian/installman-utf8.diff
new file mode 100644
index 0000000..2da23b7
--- /dev/null
+++ b/debian/patches/debian/installman-utf8.diff
@@ -0,0 +1,26 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 19 Nov 2016 21:30:46 +0200
+Subject: Generate man pages with UTF-8 characters
+
+This fixes totally incorrectly rendered manual pages like
+perlunicook and perltw.
+
+TODO: should probably be a Configure option for proper upstreaming.
+
+Bug-Debian: https://bugs.debian.org/840211
+---
+ installman | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/installman b/installman
+index 0154be4..fff0ff0 100755
+--- a/installman
++++ b/installman
+@@ -161,6 +161,7 @@ sub pod2man {
+ $manpage = "${mandir}/${manpage}.${manext}";
+
+ my $parser = Pod::Man->new( section => $manext,
++ utf8 => 1,
+ official=> 1,
+ center => 'Perl Programmers Reference Guide'
+ );
diff --git a/debian/patches/debian/instmodsh_doc.diff b/debian/patches/debian/instmodsh_doc.diff
new file mode 100644
index 0000000..00ffbd3
--- /dev/null
+++ b/debian/patches/debian/instmodsh_doc.diff
@@ -0,0 +1,25 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Debian policy doesn't install .packlist files for core or vendor.
+
+---
+ cpan/ExtUtils-MakeMaker/bin/instmodsh | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/bin/instmodsh b/cpan/ExtUtils-MakeMaker/bin/instmodsh
+index ab0f9d1..b3b109f 100644
+--- a/cpan/ExtUtils-MakeMaker/bin/instmodsh
++++ b/cpan/ExtUtils-MakeMaker/bin/instmodsh
+@@ -19,9 +19,11 @@ instmodsh - A shell to examine installed modules
+
+ =head1 DESCRIPTION
+
+-A little interface to ExtUtils::Installed to examine installed modules,
++A little interface to ExtUtils::Installed to examine locally* installed modules,
+ validate your packlists and even create a tarball from an installed module.
+
++*On Debian system, B<core> and B<vendor> modules are managed by C<dpkg>.
++
+ =head1 SEE ALSO
+
+ ExtUtils::Installed
diff --git a/debian/patches/debian/kfreebsd-softupdates.diff b/debian/patches/debian/kfreebsd-softupdates.diff
new file mode 100644
index 0000000..2edf4be
--- /dev/null
+++ b/debian/patches/debian/kfreebsd-softupdates.diff
@@ -0,0 +1,27 @@
+From: Steven Chamberlain <steven@pyro.eu.org>
+Date: Thu, 17 Dec 2015 02:15:58 +0000
+Subject: Work around Debian Bug#796798
+
+kFreeBSD 10 (possibly only with softupdates enabled) may defer
+calculating the mtime for more than 2 seconds. Work around this
+with a stat() call to calculate the mtime immediately.
+
+(Modified to only stat() on kfreebsd by Niko Tyni)
+
+Bug-Debian: https://bugs.debian.org/796798
+---
+ t/op/stat.t | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/t/op/stat.t b/t/op/stat.t
+index e0ce03b..2e75fec 100644
+--- a/t/op/stat.t
++++ b/t/op/stat.t
+@@ -101,6 +101,7 @@ sleep 3 if $funky_FAT_timestamps;
+ print FOO "Now is the time for all good men to come to.\n";
+ close(FOO);
+
++stat($tmpfile) if $^O =~ /^gnukfreebsd/; # Work around Debian Bug#796798
+ sleep 2;
+
+ my $has_link = 1;
diff --git a/debian/patches/debian/ld_run_path.diff b/debian/patches/debian/ld_run_path.diff
new file mode 100644
index 0000000..40b4f70
--- /dev/null
+++ b/debian/patches/debian/ld_run_path.diff
@@ -0,0 +1,21 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Remove standard libs from LD_RUN_PATH as per Debian policy.
+
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+index a6da855..fb849b2 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+@@ -62,6 +62,8 @@ sub _unix_os2_ext {
+ $potential_libs =~ s/(^|\s)(-(?:weak_|reexport_|lazy_)?framework)\s+(\S+)/$1-Wl,$2 -Wl,$3/g;
+ $potential_libs =~ s/(^|\s)(-F)\s*(\S+)/$1-Wl,$2 -Wl,$3/g;
+ }
++ # Debian-specific: don't use LD_RUN_PATH for standard dirs
++ $ld_run_path_seen{$_}++ for @libpath;
+
+ foreach my $thislib ( split ' ', $potential_libs ) {
+ my ( $custom_name ) = '';
diff --git a/debian/patches/debian/libnet_config_path.diff b/debian/patches/debian/libnet_config_path.diff
new file mode 100644
index 0000000..3d9a1e1
--- /dev/null
+++ b/debian/patches/debian/libnet_config_path.diff
@@ -0,0 +1,35 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Set location of libnet.cfg to /etc/perl/Net as /usr may not be
+ writable.
+
+---
+ cpan/libnet/lib/Net/Config.pm | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/cpan/libnet/lib/Net/Config.pm b/cpan/libnet/lib/Net/Config.pm
+index 4f822a4..4b39781 100644
+--- a/cpan/libnet/lib/Net/Config.pm
++++ b/cpan/libnet/lib/Net/Config.pm
+@@ -72,9 +72,8 @@ my %nc = (
+ TRY_INTERNET_CONFIG
+ }
+
+-my $file = __FILE__;
++my $file = '/etc/perl/Net/libnet.cfg';
+ my $ref;
+-$file =~ s/Config.pm/libnet.cfg/;
+ if (-f $file) {
+ $ref = eval { local $SIG{__DIE__}; do $file };
+ if (ref($ref) eq 'HASH') {
+@@ -146,8 +145,8 @@ Net::Config - Local configuration data for libnet
+ C<Net::Config> holds configuration data for the modules in the libnet
+ distribution. During installation you will be asked for these values.
+
+-The configuration data is held globally in a file in the perl installation
+-tree, but a user may override any of these values by providing their own. This
++The configuration data is held globally in C</etc/perl/Net/libnet.cfg>,
++but a user may override any of these values by providing their own. This
+ can be done by having a C<.libnetrc> file in their home directory. This file
+ should return a reference to a HASH containing the keys described below.
+ For example
diff --git a/debian/patches/debian/libperl_embed_doc.diff b/debian/patches/debian/libperl_embed_doc.diff
new file mode 100644
index 0000000..6be7ade
--- /dev/null
+++ b/debian/patches/debian/libperl_embed_doc.diff
@@ -0,0 +1,23 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Note that libperl-dev package is required for embedded linking
+
+Bug-Debian: http://bugs.debian.org/186778
+---
+ lib/ExtUtils/Embed.pm | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lib/ExtUtils/Embed.pm b/lib/ExtUtils/Embed.pm
+index e75e41f..985c353 100644
+--- a/lib/ExtUtils/Embed.pm
++++ b/lib/ExtUtils/Embed.pm
+@@ -293,6 +293,9 @@ and extensions in your C/C++ applications.
+ Typically, an application F<Makefile> will invoke C<ExtUtils::Embed>
+ functions while building your application.
+
++Note that on Debian systems the B<libperl-dev> package is required for
++compiling applications which embed an interpreter.
++
+ =head1 @EXPORT
+
+ C<ExtUtils::Embed> exports the following functions:
diff --git a/debian/patches/debian/makemaker-manext.diff b/debian/patches/debian/makemaker-manext.diff
new file mode 100644
index 0000000..e9f6bcb
--- /dev/null
+++ b/debian/patches/debian/makemaker-manext.diff
@@ -0,0 +1,29 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Wed, 1 Jul 2015 22:23:53 +0300
+Subject: Make EU::MakeMaker honour MANnEXT settings in generated manpage
+ headers
+
+This was inherited from early changes by Brendan O'Dea, previously
+(accidentally) in debian/prefix_changes.diff and before that in
+debian/extutils_hacks.diff
+
+Bug-Debian: https://bugs.debian.org/247370
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm
+index 1a3893c..8bb0ef2 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm
+@@ -1090,8 +1090,8 @@ END
+ my @man_cmds;
+ foreach my $section (qw(1 3)) {
+ my $pods = $self->{"MAN${section}PODS"};
+- my $p2m = sprintf <<'CMD', $section, $] > 5.008 ? " -u" : "";
+- $(NOECHO) $(POD2MAN) --section=%s --perm_rw=$(PERM_RW)%s
++ my $p2m = sprintf <<CMD, $] > 5.008 ? " -u" : "";
++ \$(NOECHO) \$(POD2MAN) --section=\$(MAN${section}EXT) --perm_rw=\$(PERM_RW)%s
+ CMD
+ push @man_cmds, $self->split_command($p2m, map {($_,$pods->{$_})} sort keys %$pods);
+ }
diff --git a/debian/patches/debian/makemaker-pasthru.diff b/debian/patches/debian/makemaker-pasthru.diff
new file mode 100644
index 0000000..c240441
--- /dev/null
+++ b/debian/patches/debian/makemaker-pasthru.diff
@@ -0,0 +1,28 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 24 Aug 2014 12:56:11 -0700
+Subject: Pass LD settings through to subdirectories
+
+[rt.cpan.org #28632] fixed most issues with passing LD down to
+subdirectory Makefile.PL files. However, there are some distributions
+(including Wx, Par::Packer, and Verilog-Perl) that explicitly set
+LD. Those still can't be overridden from the command line. Adding LD to
+the PASTHRU list fixes this.
+
+Bug-Debian: https://bugs.debian.org/758471
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index 4977baa..bb41b27 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2955,7 +2955,7 @@ sub pasthru {
+ my($sep) = $Is{VMS} ? ',' : '';
+ $sep .= "\\\n\t";
+
+- foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
++ foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE LD
+ PREFIX INSTALL_BASE)
+ )
+ {
diff --git a/debian/patches/debian/mod_paths.diff b/debian/patches/debian/mod_paths.diff
new file mode 100644
index 0000000..e32356f
--- /dev/null
+++ b/debian/patches/debian/mod_paths.diff
@@ -0,0 +1,98 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Tweak @INC ordering for Debian
+
+Our order is:
+
+ etc (for config files)
+ site (5.8.1)
+ vendor (all)
+ core (5.8.1)
+ site (version-indep)
+ site (pre-5.8.1)
+
+The rationale being that an admin (via site), or module packager
+(vendor) can chose to shadow core modules when there is a newer
+version than is included in core.
+
+(later updates by Niko Tyni)
+---
+ perl.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 58 insertions(+)
+
+diff --git a/perl.c b/perl.c
+index f2de479..52ad1fd 100644
+--- a/perl.c
++++ b/perl.c
+@@ -4697,6 +4697,10 @@ S_init_perllib(pTHX)
+ SITEARCH, SITELIB, VENDORARCH, VENDORLIB, ARCHLIB and PRIVLIB
+ */
+ INCPUSH_APPLLIB_EXP
++#ifdef DEBIAN
++ /* for configuration where /usr is mounted ro (CPAN::Config, Net::Config) */
++ S_incpush_use_sep(aTHX_ STR_WITH_LEN("/etc/perl"), 0x0);
++#endif
+ INCPUSH_SITEARCH_EXP
+ INCPUSH_SITELIB_EXP
+ INCPUSH_PERL_VENDORARCH_EXP
+@@ -4708,6 +4712,60 @@ S_init_perllib(pTHX)
+ INCPUSH_APPLLIB_OLD_EXP
+ INCPUSH_SITELIB_STEM
+ INCPUSH_PERL_VENDORLIB_STEM
++
++#ifdef DEBIAN
++ /* Non-versioned site directory for local modules and for
++ compatability with the previous packages' site dirs */
++ S_incpush_use_sep(aTHX_ STR_WITH_LEN("/usr/local/lib/site_perl"),
++ INCPUSH_ADD_SUB_DIRS);
++
++#ifdef PERL_INC_VERSION_LIST
++ {
++ struct stat s;
++
++ /* add small buffer in case old versions are longer than the
++ current version */
++ char sitearch[sizeof(SITEARCH_EXP)+16] = SITEARCH_EXP;
++ char sitelib[sizeof(SITELIB_EXP)+16] = SITELIB_EXP;
++ char const *vers[] = { PERL_INC_VERSION_LIST };
++ char const **p;
++
++ char *arch_vers = strrchr(sitearch, '/');
++ char *lib_vers = strrchr(sitelib, '/');
++
++ if (arch_vers && isdigit(*++arch_vers))
++ *arch_vers = 0;
++ else
++ arch_vers = 0;
++
++ if (lib_vers && isdigit(*++lib_vers))
++ *lib_vers = 0;
++ else
++ lib_vers = 0;
++
++ /* there is some duplication here as incpush does something
++ similar internally, but required as sitearch is not a
++ subdirectory of sitelib */
++ for (p = vers; *p; p++)
++ {
++ if (arch_vers && !strchr(*p, '/')) /* skip arch-specific subdirs */
++ {
++ my_snprintf(arch_vers, 16, "%s", *p);
++ if (PerlLIO_stat(sitearch, &s) >= 0 && S_ISDIR(s.st_mode))
++ S_incpush_use_sep(aTHX_ sitearch, strlen(sitearch), 0x0);
++ }
++
++ if (lib_vers && !strchr(*p, '/')) /* skip arch-specific subdirs */
++ {
++ my_snprintf(lib_vers, 16, "%s", *p);
++ if (PerlLIO_stat(sitelib, &s) >= 0 && S_ISDIR(s.st_mode))
++ S_incpush_use_sep(aTHX_ sitelib, strlen(sitelib), 0x0);
++ }
++ }
++ }
++#endif
++#endif
++
+ INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
+
+ #endif /* !PERL_IS_MINIPERL */
diff --git a/debian/patches/debian/no_packlist_perllocal.diff b/debian/patches/debian/no_packlist_perllocal.diff
new file mode 100644
index 0000000..8c7b11a
--- /dev/null
+++ b/debian/patches/debian/no_packlist_perllocal.diff
@@ -0,0 +1,90 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Don't install .packlist or perllocal.pod for perl or vendor
+
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 35 +++----------------------
+ 1 file changed, 3 insertions(+), 32 deletions(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index 780e390..4977baa 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2232,11 +2232,6 @@ pure_perl_install :: all
+ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ };
+
+- push @m,
+-q{ read "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \
+- write "}.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \
+-} unless $self->{NO_PACKLIST};
+-
+ push @m,
+ q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
+ "$(INST_ARCHLIB)" "$(DESTINSTALLARCHLIB)" \
+@@ -2269,10 +2264,6 @@ q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \
+ pure_vendor_install :: all
+ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ };
+- push @m,
+-q{ read "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
+- write "}.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{" \
+-} unless $self->{NO_PACKLIST};
+
+ push @m,
+ q{ "$(INST_LIB)" "$(DESTINSTALLVENDORLIB)" \
+@@ -2298,37 +2289,19 @@ doc_vendor_install :: all
+
+ push @m, q{
+ doc_perl_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) umask 022; $(DOC_INSTALL) \
+- "Module" "$(NAME)" \
+- "installed into" "$(INSTALLPRIVLIB)" \
+- LINKTYPE "$(LINKTYPE)" \
+- VERSION "$(VERSION)" \
+- EXE_FILES "$(EXE_FILES)" \
+- >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
+
+ doc_site_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLARCHLIB)"
++ $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLSITEARCH)/perllocal.pod"
++ -$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLSITEARCH)"
+ -$(NOECHO) umask 02; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+- >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
++ >> "}.$self->catfile('$(DESTINSTALLSITEARCH)','perllocal.pod').q{"
+
+ doc_vendor_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) umask 022; $(DOC_INSTALL) \
+- "Module" "$(NAME)" \
+- "installed into" "$(INSTALLVENDORLIB)" \
+- LINKTYPE "$(LINKTYPE)" \
+- VERSION "$(VERSION)" \
+- EXE_FILES "$(EXE_FILES)" \
+- >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
+
+ } unless $self->{NO_PERLLOCAL};
+
+@@ -2337,13 +2310,11 @@ uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+ $(NOECHO) $(NOOP)
+
+ uninstall_from_perldirs ::
+- $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{"
+
+ uninstall_from_sitedirs ::
+ $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{"
+
+ uninstall_from_vendordirs ::
+- $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{"
+ };
+
+ join("",@m);
diff --git a/debian/patches/debian/patchlevel.diff b/debian/patches/debian/patchlevel.diff
new file mode 100644
index 0000000..2b9cb3d
--- /dev/null
+++ b/debian/patches/debian/patchlevel.diff
@@ -0,0 +1,27 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 15 May 2011 19:35:58 +0300
+Subject: List packaged patches in patchlevel.h
+
+Origin: vendor
+Bug-Debian: http://bugs.debian.org/567489
+
+The list of packaged patches is in patchlevel-debian.h, which is generated
+from the debian/patches/ directory when building the package.
+---
+ patchlevel.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/patchlevel.h b/patchlevel.h
+index acafc2b..814b30d 100644
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -137,6 +137,9 @@ static const char * const local_patches[] = {
+ ,"uncommitted-changes"
+ #endif
+ PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
++#ifdef DEBIAN
++#include "patchlevel-debian.h"
++#endif
+ ,NULL
+ };
+
diff --git a/debian/patches/debian/perl5db-x-terminal-emulator.patch b/debian/patches/debian/perl5db-x-terminal-emulator.patch
new file mode 100644
index 0000000..0d43a33
--- /dev/null
+++ b/debian/patches/debian/perl5db-x-terminal-emulator.patch
@@ -0,0 +1,26 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Sat, 14 Apr 2012 11:34:05 +0100
+Subject: Invoke x-terminal-emulator rather than xterm in perl5db.pl
+
+In Debian systems, xterm might not exist or might not be the preferred
+terminal emulator. Use x-terminal-emulator instead
+
+Bug-Debian: http://bugs.debian.org/668490
+Forwarded: not-needed
+---
+ lib/perl5db.pl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/perl5db.pl b/lib/perl5db.pl
+index e8a29da..1855c87 100644
+--- a/lib/perl5db.pl
++++ b/lib/perl5db.pl
+@@ -6985,7 +6985,7 @@ properly set up.
+ sub xterm_get_fork_TTY {
+ ( my $name = $0 ) =~ s,^.*[/\\],,s;
+ open XT,
+-qq[3>&1 xterm -title "Daughter Perl debugger $pids $name" -e sh -c 'tty 1>&3;\
++qq[3>&1 x-terminal-emulator -T "Daughter Perl debugger $pids $name" -e sh -c 'tty 1>&3;\
+ sleep 10000000' |];
+
+ # Get the output from 'tty' and clean it up a little.
diff --git a/debian/patches/debian/perlbug-editor.diff b/debian/patches/debian/perlbug-editor.diff
new file mode 100644
index 0000000..3909e00
--- /dev/null
+++ b/debian/patches/debian/perlbug-editor.diff
@@ -0,0 +1,22 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 24 Feb 2019 10:15:49 +0200
+Subject: Use "editor" as the default perlbug editor, as per Debian policy
+
+Bug-Debian: https://bugs.debian.org/922609
+---
+ utils/perlbug.PL | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/utils/perlbug.PL b/utils/perlbug.PL
+index d1eb1e0..4555d04 100644
+--- a/utils/perlbug.PL
++++ b/utils/perlbug.PL
+@@ -272,7 +272,7 @@ sub Init {
+ $ed = $opt{e} || $ENV{VISUAL} || $ENV{EDITOR} || $ENV{EDIT}
+ || ($Is_VMS && "edit/tpu")
+ || ($Is_MSWin32 && "notepad")
+- || "vi";
++ || "editor";
+
+ # Not OK - provide build failure template by finessing OK report
+ if ($opt{n}) {
diff --git a/debian/patches/debian/perldoc-pager.diff b/debian/patches/debian/perldoc-pager.diff
new file mode 100644
index 0000000..8ae92cb
--- /dev/null
+++ b/debian/patches/debian/perldoc-pager.diff
@@ -0,0 +1,26 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Fri, 13 Oct 2017 11:59:34 +0300
+Subject: Fix perldoc terminal escapes when sensible-pager is less
+
+This is a temporary fix while upstream is reworking the
+pager handling.
+
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=120229
+Bug-Debian: https://bugs.debian.org/870340
+---
+ cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm b/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm
+index 9501d63..a5aedf6 100644
+--- a/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm
++++ b/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm
+@@ -32,7 +32,7 @@ sub pager_configuration {
+ # do not modify anything on Windows or DOS
+ return if ( $perldoc->is_mswin32 || $perldoc->is_dos );
+
+- if ( $pager =~ /less/ ) {
++ if ( $pager =~ /sensible-pager|less/ ) {
+ $self->_maybe_modify_environment('LESS');
+ }
+ elsif ( $pager =~ /more/ ) {
diff --git a/debian/patches/debian/perlivp.diff b/debian/patches/debian/perlivp.diff
new file mode 100644
index 0000000..682f3e4
--- /dev/null
+++ b/debian/patches/debian/perlivp.diff
@@ -0,0 +1,36 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Fri, 9 Jan 2009 18:54:47 +0200
+Subject: Make perlivp skip include directories in /usr/local
+
+Bug-Debian: http://bugs.debian.org/510895
+
+On Sat, Jan 10, 2009 at 12:37:18AM +1100, Brendan O'Dea wrote:
+> On Wed, Jan 7, 2009 at 12:21 AM, Niko Tyni <ntyni@debian.org> wrote:
+
+> > We could create the directories in a postinst script, but I'm not sure
+> > I see the point. They will be created automatically when installing
+> > CPAN modules.
+>
+> The directories are intentionally not created, as this way they are
+> excluded from the search path at start-up, saving a bunch of wasted
+> stats at use/require time in the common case that the user has not
+> installed any local packages. As Niko points out, they will be
+> created as required.
+
+Signed-off-by: Niko Tyni <ntyni@debian.org>
+---
+ utils/perlivp.PL | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/utils/perlivp.PL b/utils/perlivp.PL
+index 50d187a..bd8091c 100644
+--- a/utils/perlivp.PL
++++ b/utils/perlivp.PL
+@@ -155,6 +155,7 @@ my $INC_total = 0;
+ my $INC_there = 0;
+ foreach (@INC) {
+ next if $_ eq '.'; # skip -d test here
++ next if m|/usr/local|; # not shipped on Debian
+ if (-d $_) {
+ print "## Perl \@INC directory '$_' exists.\n" if $opt{'v'};
+ $INC_there++;
diff --git a/debian/patches/debian/prune_libs.diff b/debian/patches/debian/prune_libs.diff
new file mode 100644
index 0000000..2ef92a2
--- /dev/null
+++ b/debian/patches/debian/prune_libs.diff
@@ -0,0 +1,42 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Prune the list of libraries wanted to what we actually need.
+
+Bug-Debian: http://bugs.debian.org/128355
+
+We want to keep the dependencies on perl-base as small as possible,
+and some of the original list may be present on buildds (see Bug#128355).
+
+(Backported to metaconfig unit probes by Niko Tyni)
+---
+ regen-configure/U/modified/Myinit.U | 3 +--
+ regen-configure/U/perl/End.U | 2 +-
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/regen-configure/U/modified/Myinit.U b/regen-configure/U/modified/Myinit.U
+index 0e3155a..e1d58c2 100644
+--- a/regen-configure/U/modified/Myinit.U
++++ b/regen-configure/U/modified/Myinit.U
+@@ -32,8 +32,7 @@
+ ?X: Put crypt here, even though I should really fix d_crypt.U to look
+ ?X: for it correctly, including possible shared library versions.
+ : If anyone needs extra -lxxx, put those in a hint file.
+-libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
+-libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
++libswanted='gdbm gdbm_compat db dl m c crypt'
+ : 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 ! !'`
+diff --git a/regen-configure/U/perl/End.U b/regen-configure/U/perl/End.U
+index 3520714..9716623 100644
+--- a/regen-configure/U/perl/End.U
++++ b/regen-configure/U/perl/End.U
+@@ -37,7 +37,7 @@ sunos*X4*)
+ ;;
+ *) case "$usedl" in
+ $define|true|[yY]*)
+- set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
++ set X `echo " $libs " | sed -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldb @ @'`
+ shift
+ perllibs="$*"
+ ;;
diff --git a/debian/patches/debian/sh4_op_optimize_workaround.diff b/debian/patches/debian/sh4_op_optimize_workaround.diff
new file mode 100644
index 0000000..7038a31
--- /dev/null
+++ b/debian/patches/debian/sh4_op_optimize_workaround.diff
@@ -0,0 +1,29 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 29 Jul 2017 23:32:51 +0300
+Subject: Also lower the optimization level of op.c and opmini.c on sh4
+
+This amends
+ debian/hppa_op_optimize_workaround.diff
+ debian/hppa_opmini_optimize_workaround.diff
+
+Bug-Debian: https://bugs.debian.org/869373
+---
+ cflags.SH | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cflags.SH b/cflags.SH
+index c8231e6..3bb0c3e 100755
+--- a/cflags.SH
++++ b/cflags.SH
+@@ -497,9 +497,9 @@ for file do
+ # or customize here
+
+ case "$file" in
+- op|opmini) : work around http://bugs.debian.org/838613 and 869122
++ op|opmini) : work around http://bugs.debian.org/838613 869122 869373
+ case $archname in
+- hppa-*)
++ hppa-*|sh4-*)
+ optimize="$optimize -O0";;
+ esac;;
+
diff --git a/debian/patches/debian/squelch-locale-warnings.diff b/debian/patches/debian/squelch-locale-warnings.diff
new file mode 100644
index 0000000..5a47318
--- /dev/null
+++ b/debian/patches/debian/squelch-locale-warnings.diff
@@ -0,0 +1,51 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 3 Oct 2010 21:36:17 +0300
+Subject: Squelch locale warnings in Debian package maintainer scripts
+
+Bug-Debian: http://bugs.debian.org/508764
+
+The system locales are rather frequently out of sync with the C library
+during package upgrades, causing a huge amount of useless Perl locale
+warnings. Squelch them when running package maintainer scripts, detected
+by the DPKG_RUNNING_VERSION environment variable.
+
+Any real locale problem will show up after the system upgrade too, and
+the warning will be triggered normally again at that point.
+---
+ locale.c | 3 +++
+ pod/perllocale.pod | 8 ++++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/locale.c b/locale.c
+index 87e11d6..8f5a3b4 100644
+--- a/locale.c
++++ b/locale.c
+@@ -3247,6 +3247,9 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
+
+ const bool locwarn = (printwarn > 1
+ || ( printwarn
++ &&
++ /* Debian specific change - see http://bugs.debian.org/508764 */
++ ( ! PerlEnv_getenv("DPKG_RUNNING_VERSION"))
+ && ( ! bad_lang_use_once
+ || (
+ /* disallow with "" or "0" */
+diff --git a/pod/perllocale.pod b/pod/perllocale.pod
+index df2db5c..f621919 100644
+--- a/pod/perllocale.pod
++++ b/pod/perllocale.pod
+@@ -1297,6 +1297,14 @@ B<NOTE>: C<PERL_BADLANG> only gives you a way to hide the warning message.
+ The message tells about some problem in your system's locale support,
+ and you should investigate what the problem is.
+
++=item DPKG_RUNNING_VERSION
++
++On Debian systems, if the DPKG_RUNNING_VERSION environment variable is
++set (to any value), the locale failure warnings will be suppressed just
++like with a zero PERL_BADLANG setting. This is done to avoid floods
++of spurious warnings during system upgrades.
++See L<http://bugs.debian.org/508764>.
++
+ =back
+
+ The following environment variables are not specific to Perl: They are
diff --git a/debian/patches/debian/writable_site_dirs.diff b/debian/patches/debian/writable_site_dirs.diff
new file mode 100644
index 0000000..fb6b18b
--- /dev/null
+++ b/debian/patches/debian/writable_site_dirs.diff
@@ -0,0 +1,33 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Set umask approproately for site install directories
+
+Policy requires group writable site directories
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index 274e35c..dbb8651 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2249,7 +2249,7 @@ q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
+
+
+ pure_site_install :: all
+- $(NOECHO) umask 022; $(MOD_INSTALL) \
++ $(NOECHO) umask 02; $(MOD_INSTALL) \
+ };
+ push @m,
+ q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
+@@ -2310,8 +2310,8 @@ doc_perl_install :: all
+
+ doc_site_install :: all
+ $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) umask 022; $(DOC_INSTALL) \
++ -$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLARCHLIB)"
++ -$(NOECHO) umask 02; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
diff --git a/debian/patches/fixes/autodie-scope.diff b/debian/patches/fixes/autodie-scope.diff
new file mode 100644
index 0000000..f6372f3
--- /dev/null
+++ b/debian/patches/fixes/autodie-scope.diff
@@ -0,0 +1,97 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Mon, 21 Dec 2015 19:20:12 +0200
+Subject: Fix a scoping issue with "no autodie" and the "system" sub
+
+Don't queue nonexisting subs for reinstalling later when
+exiting the 'no autodie' scope.
+
+FIXME: if the original sub 'can be undef for "CORE::" subs', does this
+break for those? Is that the case when $symbol =~ /::/, as guarded for
+on L566?
+
+Bug: https://github.com/pjf/autodie/issues/69
+Bug-Debian: https://bugs.debian.org/798096
+Origin: upstream, https://github.com/pjf/autodie/commit/c1b4fc4a319f8139d1cd6770bfb7b72a59ae232d
+---
+ cpan/autodie/lib/Fatal.pm | 7 ++++++-
+ cpan/autodie/t/no-all.t | 22 ++++++++++++++++++++++
+ cpan/autodie/t/no-default.t | 23 +++++++++++++++++++++++
+ 3 files changed, 51 insertions(+), 1 deletion(-)
+ create mode 100644 cpan/autodie/t/no-all.t
+ create mode 100644 cpan/autodie/t/no-default.t
+
+diff --git a/cpan/autodie/lib/Fatal.pm b/cpan/autodie/lib/Fatal.pm
+index 16e1743..2058abd 100644
+--- a/cpan/autodie/lib/Fatal.pm
++++ b/cpan/autodie/lib/Fatal.pm
+@@ -580,7 +580,12 @@ sub unimport {
+ # Record the current sub to be reinstalled at end of scope
+ # and then restore the original (can be undef for "CORE::"
+ # subs)
+- $reinstall_subs{$symbol} = \&$sub;
++
++ {
++ no strict 'refs';
++ $reinstall_subs{$symbol} = \&$sub
++ if exists ${"${pkg}::"}{$symbol};
++ }
+ $uninstall_subs{$symbol} = $Original_user_sub{$sub};
+
+ }
+diff --git a/cpan/autodie/t/no-all.t b/cpan/autodie/t/no-all.t
+new file mode 100644
+index 0000000..1a503f6
+--- /dev/null
++++ b/cpan/autodie/t/no-all.t
+@@ -0,0 +1,22 @@
++#!/usr/bin/perl
++
++package foo;
++use warnings;
++use strict;
++use Test::More tests => 1;
++use autodie qw(:all);
++
++use_system();
++ok("system() works with a lexical 'no autodie' block (github issue #69");
++
++sub break_system {
++ no autodie;
++ open(my $fh, "<", 'NONEXISTENT');
++ ok("survived failing open");
++}
++
++sub use_system {
++ system($^X, '-e' , 1);
++}
++
++1;
+diff --git a/cpan/autodie/t/no-default.t b/cpan/autodie/t/no-default.t
+new file mode 100644
+index 0000000..44d2acf
+--- /dev/null
++++ b/cpan/autodie/t/no-default.t
+@@ -0,0 +1,23 @@
++#!/usr/bin/perl
++
++package foo;
++use warnings;
++use strict;
++use Test::More tests => 2;
++use autodie;
++
++
++use_system();
++ok("system() works with a lexical 'no autodie' block (github issue #69");
++break_system();
++
++sub break_system {
++ no autodie;
++ open(my $fh, "<", 'NONEXISTENT');
++ ok("survived failing open");
++}
++
++sub use_system {
++ system($^X, '-e' , 1);
++}
++1;
diff --git a/debian/patches/fixes/cpan_web_link.diff b/debian/patches/fixes/cpan_web_link.diff
new file mode 100644
index 0000000..958e1bc
--- /dev/null
+++ b/debian/patches/fixes/cpan_web_link.diff
@@ -0,0 +1,24 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Sat, 30 Apr 2016 23:13:34 +0100
+Subject: CPAN: Add link to main CPAN web site
+
+Bug: https://github.com/andk/cpanpm/pull/96
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=367291
+---
+ cpan/CPAN/lib/CPAN.pm | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/cpan/CPAN/lib/CPAN.pm b/cpan/CPAN/lib/CPAN.pm
+index 0c9b9f5..3f30a83 100644
+--- a/cpan/CPAN/lib/CPAN.pm
++++ b/cpan/CPAN/lib/CPAN.pm
+@@ -3992,6 +3992,9 @@ your operating system) then typing C<cpan> in a console window will
+ work for you as well. Above that the utility provides several
+ commandline shortcuts.
+
++The main CPAN website, which includes general information about the
++service, is at L<http://www.cpan.org/>.
++
+ melezhik (Alexey) sent me a link where he published a chef recipe to
+ work with CPAN.pm: http://community.opscode.com/cookbooks/cpan.
+
diff --git a/debian/patches/fixes/document_makemaker_ccflags.diff b/debian/patches/fixes/document_makemaker_ccflags.diff
new file mode 100644
index 0000000..987b321
--- /dev/null
+++ b/debian/patches/fixes/document_makemaker_ccflags.diff
@@ -0,0 +1,28 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Mon, 30 May 2011 22:54:24 +0300
+Subject: Document that CCFLAGS should include $Config{ccflags}
+
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=68613
+Bug-Debian: http://bugs.debian.org/628522
+
+Compiling XS extensions without $Config{ccflags} can break the
+binary interface on some platforms.
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
+index 90d9eac..81bdc96 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
+@@ -1838,6 +1838,10 @@ currently used by MakeMaker but may be handy in Makefile.PLs.
+ String that will be included in the compiler call command line between
+ the arguments INC and OPTIMIZE.
+
++The default value is taken from $Config{ccflags}. When overriding
++CCFLAGS, make sure to include the $Config{ccflags} settings to avoid
++binary incompatibilities.
++
+ =item CONFIG
+
+ Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from
diff --git a/debian/patches/fixes/eumm-usrmerge.diff b/debian/patches/fixes/eumm-usrmerge.diff
new file mode 100644
index 0000000..e228aaa
--- /dev/null
+++ b/debian/patches/fixes/eumm-usrmerge.diff
@@ -0,0 +1,122 @@
+From: =?utf-8?q?Dagfinn_Ilmari_Manns=C3=A5ker?= <ilmari@ilmari.org>
+Date: Tue, 13 Nov 2018 16:00:48 +0000
+Subject: Avoid mangling /bin non-perl shebangs on merged-/usr systems
+
+If the shebang is absolute and exists in PATH, but was not the first
+one found, leave it alone if it's actually the same file as first one.
+
+This avoids packages built on merged-/usr systems with /usr/bin before
+/bin in the path breaking when installed on systems without merged
+/usr. See e.g. https://bugs.debian.org/913637.
+
+Origin: backport, https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/9766f9c5ffd1ac915d75b309cd18c9f42794b710
+Bug: https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/pull/330
+Bug-Debian: https://bugs.debian.org/913637
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 22 +++++++++++++--
+ cpan/ExtUtils-MakeMaker/t/fixin.t | 33 +++++++++++++++++++++-
+ .../t/lib/MakeMaker/Test/Setup/BFD.pm | 3 ++
+ 3 files changed, 55 insertions(+), 3 deletions(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index bb41b27..2e33d0a 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -1243,8 +1243,8 @@ sub _fixin_replace_shebang {
+ my ( $self, $file, $line ) = @_;
+
+ # Now figure out the interpreter name.
+- my ( $cmd, $arg ) = split ' ', $line, 2;
+- $cmd =~ s!^.*/!!;
++ my ( $origcmd, $arg ) = split ' ', $line, 2;
++ (my $cmd = $origcmd) =~ s!^.*/!!;
+
+ # Now look (in reverse) for interpreter in absolute PATH (unless perl).
+ my $interpreter;
+@@ -1270,6 +1270,24 @@ sub _fixin_replace_shebang {
+ $interpreter = $maybefile;
+ }
+ }
++
++ # If the shebang is absolute and exists in PATH, but was not
++ # the first one found, leave it alone if it's actually the
++ # same file as first one. This avoids packages built on
++ # merged-/usr systems with /usr/bin before /bin in the path
++ # breaking when installed on systems without merged /usr
++ if ($origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)) {
++ my $origdir = dirname($origcmd);
++ if ($self->maybe_command($origcmd) && grep { $_ eq $origdir } @absdirs) {
++ my ($odev, $oino) = stat $origcmd;
++ my ($idev, $iino) = stat $interpreter;
++ if ($odev == $idev && $oino == $iino) {
++ warn "$origcmd is the same as $interpreter, leaving alone"
++ if $Verbose;
++ $interpreter = $origcmd;
++ }
++ }
++ }
+ }
+
+ # Figure out how to invoke interpreter on this machine.
+diff --git a/cpan/ExtUtils-MakeMaker/t/fixin.t b/cpan/ExtUtils-MakeMaker/t/fixin.t
+index 061e456..872b023 100644
+--- a/cpan/ExtUtils-MakeMaker/t/fixin.t
++++ b/cpan/ExtUtils-MakeMaker/t/fixin.t
+@@ -9,7 +9,7 @@ BEGIN {
+
+ use File::Spec;
+
+-use Test::More tests => 22;
++use Test::More tests => 30;
+
+ use Config;
+ use TieOut;
+@@ -123,3 +123,34 @@ END
+ }
+ );
+ }
++
++SKIP: {
++ eval { chmod(0755, "usrbin/interp") }
++ or skip "no chmod", 8;
++
++ my $dir = getcwd();
++ local $ENV{PATH} = join $Config{path_sep}, map "$dir/$_", qw(usrbin bin);
++
++ test_fixin(<<END,
++#!$dir/bin/interp
++
++blah blah blah
++END
++ sub {
++ is $_[0], "#!$dir/usrbin/interp\n", 'interpreter updated to one found in PATH';
++ }
++ );
++
++ eval { symlink("../usrbin/interp", "bin/interp") }
++ or skip "no symlinks", 4;
++
++ test_fixin(<<END,
++#!$dir/bin/interp
++
++blah blah blah
++END
++ sub {
++ is $_[0], "#!$dir/bin/interp\n", 'symlinked interpreter later in PATH not mangled';
++ }
++ );
++}
+diff --git a/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/BFD.pm b/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/BFD.pm
+index 3d093fc..cfe49e5 100644
+--- a/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/BFD.pm
++++ b/cpan/ExtUtils-MakeMaker/t/lib/MakeMaker/Test/Setup/BFD.pm
+@@ -53,6 +53,9 @@ program - this is a program
+ =cut
+
+ 1;
++END
++ 'Big-Dummy/usrbin/interp' => <<'END',
++This is a dummy interpreter
+ END
+
+ 'Big-Dummy/test.pl' => <<'END',
diff --git a/debian/patches/fixes/getopt-long-4.diff b/debian/patches/fixes/getopt-long-4.diff
new file mode 100644
index 0000000..9d5750e
--- /dev/null
+++ b/debian/patches/fixes/getopt-long-4.diff
@@ -0,0 +1,28 @@
+From: Johan Vromans <jvromans@squirrel.nl>
+Date: Tue, 13 Jun 2017 13:26:00 +0200
+Subject: Fix issue #122068.
+
+Origin: backport, https://github.com/sciurius/perl-Getopt-Long/commit/2d16f355e25537aa742eb2833a7d52a63051429b
+Bug: https://rt.cpan.org/Ticket/Display.html?id=122068
+Bug-Debian: https://bugs.debian.org/864544
+---
+ cpan/Getopt-Long/lib/Getopt/Long.pm | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/cpan/Getopt-Long/lib/Getopt/Long.pm b/cpan/Getopt-Long/lib/Getopt/Long.pm
+index 664c8b6..e4e3026 100644
+--- a/cpan/Getopt-Long/lib/Getopt/Long.pm
++++ b/cpan/Getopt-Long/lib/Getopt/Long.pm
+@@ -1123,6 +1123,12 @@ sub FindOption ($$$$$) {
+ $optargtype = 3;
+ }
+ if(($optargtype == 0) && !$mand) {
++ if ( $type eq 'I' ) {
++ # Fake incremental type.
++ my @c = @$ctl;
++ $c[CTL_TYPE] = '+';
++ return (1, $opt, \@c, 1);
++ }
+ my $val
+ = defined($ctl->[CTL_DEFAULT]) ? $ctl->[CTL_DEFAULT]
+ : $type eq 's' ? ''
diff --git a/debian/patches/fixes/gid-parsing.diff b/debian/patches/fixes/gid-parsing.diff
new file mode 100644
index 0000000..4c0bd46
--- /dev/null
+++ b/debian/patches/fixes/gid-parsing.diff
@@ -0,0 +1,35 @@
+From: Manuel Mausz <manuel@mausz.at>
+Date: Tue, 4 Jun 2019 00:29:09 +0200
+Subject: (perl #134169) mg.c reset endptr after use
+
+Perl_grok_atoUV has been changed so endptr constraints the input. Thus we need to reset the endptr after every use.
+
+Bug: https://rt.perl.org/Public/Bug/Display.html?id=134169
+Bug-Debian: https://bugs.debian.org/941985
+Origin: backport, http://perl5.git.perl.org/perl.git/commitdiff/79e302e6c3f815bf4cb72a5bacc3012595970db9
+---
+ mg.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mg.c b/mg.c
+index afe452f..910bbd1 100644
+--- a/mg.c
++++ b/mg.c
+@@ -3178,7 +3178,8 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
+ {
+ const char *p = SvPV_const(sv, len);
+ Groups_t *gary = NULL;
+- const char* endptr = p + len;
++ const char* p_end = p + len;
++ const char* endptr = p_end;
+ UV uv;
+ #ifdef _SC_NGROUPS_MAX
+ int maxgrp = sysconf(_SC_NGROUPS_MAX);
+@@ -3201,6 +3202,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
+ if (endptr == NULL)
+ break;
+ p = endptr;
++ endptr = p_end;
+ while (isSPACE(*p))
+ ++p;
+ if (!*p)
diff --git a/debian/patches/fixes/math_complex_doc_angle_units.diff b/debian/patches/fixes/math_complex_doc_angle_units.diff
new file mode 100644
index 0000000..215c240
--- /dev/null
+++ b/debian/patches/fixes/math_complex_doc_angle_units.diff
@@ -0,0 +1,26 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Sat, 30 Apr 2016 22:56:56 +0100
+Subject: Math::Trig: document angle units
+
+Bug: https://rt.cpan.org/Ticket/Display.html?id=114106
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731505
+---
+ cpan/Math-Complex/lib/Math/Trig.pm | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/cpan/Math-Complex/lib/Math/Trig.pm b/cpan/Math-Complex/lib/Math/Trig.pm
+index acad31f..bc7ac78 100644
+--- a/cpan/Math-Complex/lib/Math/Trig.pm
++++ b/cpan/Math-Complex/lib/Math/Trig.pm
+@@ -263,6 +263,11 @@ core Perl which defines only the C<sin()> and C<cos()>. The constant
+ B<pi> is also defined as are a few convenience functions for angle
+ conversions, and I<great circle formulas> for spherical movement.
+
++=head1 ANGLES
++
++All angles are defined in radians, except where otherwise specified
++(for example in the deg/rad conversion functions).
++
+ =head1 TRIGONOMETRIC FUNCTIONS
+
+ The tangent
diff --git a/debian/patches/fixes/math_complex_doc_great_circle.diff b/debian/patches/fixes/math_complex_doc_great_circle.diff
new file mode 100644
index 0000000..9eed968
--- /dev/null
+++ b/debian/patches/fixes/math_complex_doc_great_circle.diff
@@ -0,0 +1,23 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Sat, 30 Apr 2016 22:50:52 +0100
+Subject: Math::Trig: clarify definition of great_circle_midpoint
+
+Bug: https://rt.cpan.org/Ticket/Display.html?id=114104
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697567
+---
+ cpan/Math-Complex/lib/Math/Trig.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/Math-Complex/lib/Math/Trig.pm b/cpan/Math-Complex/lib/Math/Trig.pm
+index 1d9612a..efc2ff8 100644
+--- a/cpan/Math-Complex/lib/Math/Trig.pm
++++ b/cpan/Math-Complex/lib/Math/Trig.pm
+@@ -608,7 +608,7 @@ or the midpoint if you know the end points:
+ ($thetam, $phim) =
+ great_circle_midpoint($theta0, $phi0, $theta1, $phi1);
+
+-The great_circle_midpoint() is just a special case of
++The great_circle_midpoint() is just a special case (with $way = 0.5) of
+
+ =head2 great_circle_waypoint
+
diff --git a/debian/patches/fixes/math_complex_doc_see_also.diff b/debian/patches/fixes/math_complex_doc_see_also.diff
new file mode 100644
index 0000000..7a19833
--- /dev/null
+++ b/debian/patches/fixes/math_complex_doc_see_also.diff
@@ -0,0 +1,23 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Sat, 30 Apr 2016 22:53:44 +0100
+Subject: Math::Trig: add missing SEE ALSO
+
+Bug: https://rt.cpan.org/Ticket/Display.html?id=114105
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697568
+---
+ cpan/Math-Complex/lib/Math/Trig.pm | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/cpan/Math-Complex/lib/Math/Trig.pm b/cpan/Math-Complex/lib/Math/Trig.pm
+index efc2ff8..acad31f 100644
+--- a/cpan/Math-Complex/lib/Math/Trig.pm
++++ b/cpan/Math-Complex/lib/Math/Trig.pm
+@@ -743,6 +743,8 @@ an answer instead of giving a fatal runtime error.
+
+ Do not attempt navigation using these formulas.
+
++=head1 SEE ALSO
++
+ L<Math::Complex>
+
+ =head1 AUTHORS
diff --git a/debian/patches/fixes/memoize-pod.diff b/debian/patches/fixes/memoize-pod.diff
new file mode 100644
index 0000000..e253a07
--- /dev/null
+++ b/debian/patches/fixes/memoize-pod.diff
@@ -0,0 +1,32 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 6 Feb 2016 20:15:19 +0200
+Subject: Fix POD errors in Memoize
+
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=89441
+Author: Dominic Hargreaves <dom@cpan.org>
+---
+ cpan/Memoize/Memoize.pm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cpan/Memoize/Memoize.pm b/cpan/Memoize/Memoize.pm
+index f4e6522d4..2f28b36 100644
+--- a/cpan/Memoize/Memoize.pm
++++ b/cpan/Memoize/Memoize.pm
+@@ -752,6 +752,8 @@ cache that was populated by the first call. C<complicated> ends up
+ being called only once, and both subsequent calls return C<3> from the
+ cache, regardless of the calling context.
+
++=back
++
+ =head3 List values in scalar context
+
+ Consider this function:
+@@ -801,8 +803,6 @@ This normalizer function will store scalar context return values in
+ the disk file under keys that begin with C<S:>, and list context
+ return values under keys that begin with C<L:>.
+
+-=back
+-
+ =head1 OTHER FACILITIES
+
+ =head2 C<unmemoize>
diff --git a/debian/patches/fixes/memoize_storable_nstore.diff b/debian/patches/fixes/memoize_storable_nstore.diff
new file mode 100644
index 0000000..ba58a56
--- /dev/null
+++ b/debian/patches/fixes/memoize_storable_nstore.diff
@@ -0,0 +1,108 @@
+From: Jonathan Nieder <jrnieder@gmail.com>
+Date: Fri, 27 Jul 2012 10:35:07 -0500
+Subject: Memoize::Storable: respect 'nstore' option not respected
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+Memoize(3perl) says:
+
+ tie my %cache => 'Memoize::Storable', $filename, 'nstore';
+ memoize 'function', SCALAR_CACHE => [HASH => \%cache];
+
+ Include the ‘nstore’ option to have the "Storable" database
+ written in ‘network order’. (See Storable for more details
+ about this.)
+
+In fact the "nstore" option does no such thing. Option parsing looks
+like this:
+
+ @options{@_} = ();
+
+$self->{OPTIONS}{'nstore'} is accordingly set to undef. Later
+Memoize::Storable checks if the option is true, and since undef is
+not true, the "else" branch is always taken.
+
+ if ($self->{OPTIONS}{'nstore'}) {
+ Storable::nstore($self->{H}, $self->{FILENAME});
+ } else {
+ Storable::store($self->{H}, $self->{FILENAME});
+ }
+
+Correcting the condition to (exists $self->{OPTIONS}{'nstore'}) fixes
+it.
+
+Noticed because git-svn, which uses the 'nstore' option for its
+on-disk caches, was producing
+
+ Byte order is not compatible at ../../lib/Storable.pm
+
+when run using a perl with a different integer size (and hence
+byteorder).
+
+Reported by Tim Retout (RT#77790)
+
+Bug-Debian: http://bugs.debian.org/587650
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=77790
+Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=77790
+---
+ cpan/Memoize/Memoize/Storable.pm | 2 +-
+ cpan/Memoize/t/tie_storable.t | 24 ++++++++++++++++++++----
+ 2 files changed, 21 insertions(+), 5 deletions(-)
+
+diff --git a/cpan/Memoize/Memoize/Storable.pm b/cpan/Memoize/Memoize/Storable.pm
+index 1314797..87876f2 100644
+--- a/cpan/Memoize/Memoize/Storable.pm
++++ b/cpan/Memoize/Memoize/Storable.pm
+@@ -55,7 +55,7 @@ sub DESTROY {
+ require Carp if $Verbose;
+ my $self= shift;
+ print STDERR "Memoize::Storable::DESTROY(@_)\n" if $Verbose;
+- if ($self->{OPTIONS}{'nstore'}) {
++ if (exists $self->{OPTIONS}{'nstore'}) {
+ Storable::nstore($self->{H}, $self->{FILENAME});
+ } else {
+ Storable::store($self->{H}, $self->{FILENAME});
+diff --git a/cpan/Memoize/t/tie_storable.t b/cpan/Memoize/t/tie_storable.t
+index de3b8dc..a624238 100644
+--- a/cpan/Memoize/t/tie_storable.t
++++ b/cpan/Memoize/t/tie_storable.t
+@@ -31,18 +31,34 @@ if ($@) {
+ exit 0;
+ }
+
+-print "1..4\n";
++print "1..9\n";
+
+ $file = "storable$$";
+ 1 while unlink $file;
+ tryout('Memoize::Storable', $file, 1); # Test 1..4
+ 1 while unlink $file;
++tryout('Memoize::Storable', $file, 5, 'nstore'); # Test 5..8
++assert_netorder($file, 9); # Test 9
++1 while unlink $file;
++
++
++sub assert_netorder {
++ my ($file, $testno) = @_;
++
++ my $netorder = Storable::file_magic($file)->{'netorder'};
++ print ($netorder ? "ok $testno\n" : "not ok $testno\n");
++}
+
+ sub tryout {
+- my ($tiepack, $file, $testno) = @_;
++ my ($tiepack, $file, $testno, $option) = @_;
+
+- tie my %cache => $tiepack, $file
+- or die $!;
++ if (defined $option) {
++ tie my %cache => $tiepack, $file, $option
++ or die $!;
++ } else {
++ tie my %cache => $tiepack, $file
++ or die $!;
++ }
+
+ memoize 'c5',
+ SCALAR_CACHE => [HASH => \%cache],
diff --git a/debian/patches/fixes/respect_umask.diff b/debian/patches/fixes/respect_umask.diff
new file mode 100644
index 0000000..d3f84e4
--- /dev/null
+++ b/debian/patches/fixes/respect_umask.diff
@@ -0,0 +1,150 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Respect umask during installation
+
+This is needed to satisfy Debian policy regarding group-writable
+site directories.
+---
+ cpan/ExtUtils-Install/lib/ExtUtils/Install.pm | 18 +++++++++---------
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 18 +++++++++---------
+ 2 files changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm b/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm
+index 047c007..cd7e4f2 100644
+--- a/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm
++++ b/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm
+@@ -463,7 +463,7 @@ sub _can_write_dir {
+
+ =pod
+
+-=item _mkpath($dir,$show,$mode,$verbose,$dry_run)
++=item _mkpath($dir,$show,$verbose,$dry_run)
+
+ Wrapper around File::Path::mkpath() to handle errors.
+
+@@ -480,13 +480,13 @@ writable.
+ =cut
+
+ sub _mkpath {
+- my ($dir,$show,$mode,$verbose,$dry_run)=@_;
++ my ($dir,$show,$verbose,$dry_run)=@_;
+ if ( $verbose && $verbose > 1 && ! -d $dir) {
+ $show= 1;
+- printf "mkpath(%s,%d,%#o)\n", $dir, $show, $mode;
++ printf "mkpath(%s,%d)\n", $dir, $show;
+ }
+ if (!$dry_run) {
+- if ( ! eval { File::Path::mkpath($dir,$show,$mode); 1 } ) {
++ if ( ! eval { File::Path::mkpath($dir,$show); 1 } ) {
+ _choke("Can't create '$dir'","$@");
+ }
+
+@@ -799,7 +799,7 @@ sub install { #XXX OS-SPECIFIC
+ _chdir($cwd);
+ }
+ foreach my $targetdir (sort keys %check_dirs) {
+- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
++ _mkpath( $targetdir, 0, $verbose, $dry_run );
+ }
+ foreach my $found (@found_files) {
+ my ($diff, $ffd, $origfile, $mode, $size, $atime, $mtime,
+@@ -813,7 +813,7 @@ sub install { #XXX OS-SPECIFIC
+ $targetfile= _unlink_or_rename( $targetfile, 'tryhard', 'install' )
+ unless $dry_run;
+ } elsif ( ! -d $targetdir ) {
+- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
++ _mkpath( $targetdir, 0, $verbose, $dry_run );
+ }
+ print "Installing $targetfile\n";
+
+@@ -853,7 +853,7 @@ sub install { #XXX OS-SPECIFIC
+
+ if ($pack{'write'}) {
+ $dir = install_rooted_dir(dirname($pack{'write'}));
+- _mkpath( $dir, 0, 0755, $verbose, $dry_run );
++ _mkpath( $dir, 0, $verbose, $dry_run );
+ print "Writing $pack{'write'}\n" if $verbose;
+ $packlist->write(install_rooted_file($pack{'write'})) unless $dry_run;
+ }
+@@ -1199,7 +1199,7 @@ environment variable will silence this output.
+ sub pm_to_blib {
+ my($fromto,$autodir,$pm_filter) = @_;
+
+- _mkpath($autodir,0,0755) if defined $autodir;
++ _mkpath($autodir,0) if defined $autodir;
+ while(my($from, $to) = each %$fromto) {
+ if( -f $to && -s $from == -s $to && -M $to < -M $from ) {
+ print "Skip $to (unchanged)\n" unless $INSTALL_QUIET;
+@@ -1222,7 +1222,7 @@ sub pm_to_blib {
+ # we wont try hard here. its too likely to mess things up.
+ forceunlink($to);
+ } else {
+- _mkpath(dirname($to),0,0755);
++ _mkpath(dirname($to),0);
+ }
+ if ($need_filtering) {
+ run_filter($pm_filter, $from, $to);
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index fe53be1..274e35c 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2229,7 +2229,7 @@ doc__install : doc_site_install
+ $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+ pure_perl_install :: all
+- $(NOECHO) $(MOD_INSTALL) \
++ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ };
+
+ push @m,
+@@ -2249,7 +2249,7 @@ q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
+
+
+ pure_site_install :: all
+- $(NOECHO) $(MOD_INSTALL) \
++ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ };
+ push @m,
+ q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
+@@ -2267,7 +2267,7 @@ q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \
+ "}.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{"
+
+ pure_vendor_install :: all
+- $(NOECHO) $(MOD_INSTALL) \
++ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ };
+ push @m,
+ q{ read "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
+@@ -2299,8 +2299,8 @@ doc_vendor_install :: all
+ push @m, q{
+ doc_perl_install :: all
+ $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) $(DOC_INSTALL) \
++ -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
++ -$(NOECHO) umask 022; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLPRIVLIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+@@ -2310,8 +2310,8 @@ doc_perl_install :: all
+
+ doc_site_install :: all
+ $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) $(DOC_INSTALL) \
++ -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
++ -$(NOECHO) umask 022; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+@@ -2321,8 +2321,8 @@ doc_site_install :: all
+
+ doc_vendor_install :: all
+ $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) $(DOC_INSTALL) \
++ -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
++ -$(NOECHO) umask 022; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLVENDORLIB)" \
+ LINKTYPE "$(LINKTYPE)" \
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..c31c904
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,46 @@
+debian/cpan_definstalldirs.diff
+debian/db_file_ver.diff
+debian/doc_info.diff
+debian/enc2xs_inc.diff
+debian/errno_ver.diff
+debian/libperl_embed_doc.diff
+fixes/respect_umask.diff
+debian/writable_site_dirs.diff
+debian/extutils_set_libperl_path.diff
+debian/no_packlist_perllocal.diff
+debian/fakeroot.diff
+debian/instmodsh_doc.diff
+debian/ld_run_path.diff
+debian/libnet_config_path.diff
+debian/perlivp.diff
+debian/squelch-locale-warnings.diff
+debian/patchlevel.diff
+fixes/document_makemaker_ccflags.diff
+debian/find_html2text.diff
+debian/perl5db-x-terminal-emulator.patch
+debian/cpan-missing-site-dirs.diff
+fixes/memoize_storable_nstore.diff
+debian/makemaker-pasthru.diff
+debian/makemaker-manext.diff
+debian/kfreebsd-softupdates.diff
+fixes/autodie-scope.diff
+fixes/memoize-pod.diff
+debian/hurd-softupdates.diff
+fixes/math_complex_doc_great_circle.diff
+fixes/math_complex_doc_see_also.diff
+fixes/math_complex_doc_angle_units.diff
+fixes/cpan_web_link.diff
+debian/hppa_op_optimize_workaround.diff
+debian/installman-utf8.diff
+fixes/getopt-long-4.diff
+debian/hppa_opmini_optimize_workaround.diff
+debian/sh4_op_optimize_workaround.diff
+debian/perldoc-pager.diff
+debian/prune_libs.diff
+debian/mod_paths.diff
+debian/configure-regen.diff
+debian/deprecate-with-apt.diff
+debian/disable-stack-check.diff
+fixes/eumm-usrmerge.diff
+debian/perlbug-editor.diff
+fixes/gid-parsing.diff